mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
dbeaver/dbeaver-devops#1525 update ci workflows (#2998)
* dbeaver/dbeaver-devops#1525 update ci workflows * dbeaver/dbeaver-devops#1525 fix frontend lint * dbeaver/dbeaver-devops#1525 move checkstyle config from dbeaver repo * dbeaver/dbeaver-devops#1525 use own maven setup action * dbeaver/dbeaver-devops#1525 reuse workflows * dbeaver/dbeaver-devops#1525 fix concurrency * dbeaver/dbeaver-devops#1525 fix concurrency
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
name: Backend Build
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build-backend:
|
||||
name: Backend
|
||||
name: Build
|
||||
timeout-minutes: 10
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: cloudbeaver
|
||||
|
||||
- name: Clone Deps Repositories
|
||||
uses: dbeaver/github-actions/clone-repositories@devel
|
||||
with:
|
||||
project_deps_path: './cloudbeaver/project.deps'
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
@@ -23,34 +27,16 @@ jobs:
|
||||
java-version: "17"
|
||||
cache: maven
|
||||
|
||||
- uses: stCarolas/setup-maven@v5
|
||||
with:
|
||||
maven-version: 3.9.0
|
||||
|
||||
- name: Give permissions
|
||||
run: |
|
||||
sudo chmod 777 ../
|
||||
shell: bash
|
||||
|
||||
- name: Determine branches
|
||||
id: determine-branch
|
||||
run: |
|
||||
echo "pr_branch=${{ github.head_ref }}" >> $GITHUB_ENV
|
||||
echo "base_branch=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Clone dbeaver/dbeaver
|
||||
id: clone-repo
|
||||
run: |
|
||||
git clone -b ${{ env.pr_branch }} https://github.com/dbeaver/dbeaver.git ../dbeaver || git clone -b ${{ env.base_branch }} https://github.com/dbeaver/dbeaver.git ../dbeaver
|
||||
- uses: dbeaver/github-actions/install-maven@devel
|
||||
|
||||
- name: Run build script
|
||||
run: ./build-backend.sh
|
||||
shell: bash
|
||||
working-directory: ./deploy
|
||||
working-directory: ./cloudbeaver/deploy
|
||||
|
||||
- name: Archive build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: backend-build-artifacts
|
||||
path: deploy/cloudbeaver
|
||||
path: cloudbeaver/deploy/cloudbeaver
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
name: Backend Lint
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
inputs:
|
||||
skip_cache:
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Backend
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout checkstyle config repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: dbeaver/dbeaver
|
||||
path: dbeaver-config
|
||||
|
||||
- name: Copy checkstyle config
|
||||
run: cp dbeaver-config/dbeaver-checkstyle-config.xml ./dbeaver-checkstyle-config.xml
|
||||
|
||||
- name: Remove checkstyle config directory
|
||||
run: rm -rf dbeaver-config
|
||||
|
||||
- uses: dbelyaev/action-checkstyle@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
reporter: github-pr-review
|
||||
filter_mode: diff_context
|
||||
checkstyle_config: ./dbeaver-checkstyle-config.xml
|
||||
fail_on_error: true
|
||||
@@ -1,57 +1,14 @@
|
||||
name: Cleanup checks
|
||||
name: Cleanup
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
push:
|
||||
branches:
|
||||
- devel
|
||||
|
||||
jobs:
|
||||
delete-caches:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cleanup
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
|
||||
echo "Fetching list of cache key"
|
||||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
|
||||
|
||||
## Setting this to not fail the workflow while deleting cache keys.
|
||||
set +e
|
||||
echo "Deleting caches..."
|
||||
for cacheKey in $cacheKeysForPR
|
||||
do
|
||||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
|
||||
done
|
||||
echo "Done"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
|
||||
# delete-docker-image:
|
||||
# name: Delete Docker Image
|
||||
# if: github.event.pull_request.merged == true
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - name: Check out the repository
|
||||
# uses: actions/checkout@v4
|
||||
|
||||
# - name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v3
|
||||
|
||||
# - name: Determine Docker Image Tag
|
||||
# run: |
|
||||
# REPO_NAME=$(basename ${{ github.repository }})
|
||||
# IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/$REPO_NAME
|
||||
# BRANCH_NAME=${{ github.event.pull_request.head.ref }}
|
||||
# TAG_NAME=$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9._-]/-/g')
|
||||
# echo "image=$IMAGE_NAME:$TAG_NAME" >> $GITHUB_ENV
|
||||
|
||||
# - name: Log in to GitHub Container Registry
|
||||
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
||||
|
||||
# - name: Delete Docker Image
|
||||
# run: |
|
||||
# docker rmi ${{ env.image }}
|
||||
# echo "Deleted image: ${{ env.image }}"
|
||||
name: Cleanup
|
||||
uses: dbeaver/dbeaver-common/.github/workflows/cleanup-caches.yml@devel
|
||||
secrets: inherit
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
name: Frontend Build
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
outputs:
|
||||
@@ -20,8 +17,11 @@ on:
|
||||
|
||||
jobs:
|
||||
frontend-build:
|
||||
name: Frontend
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
outputs:
|
||||
build-status: ${{ steps.build.outcome }}
|
||||
@@ -34,6 +34,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
@@ -58,30 +59,14 @@ jobs:
|
||||
|
||||
- name: yarn clean
|
||||
if: env.skip_cache == 'true'
|
||||
uses: borales/actions-yarn@v5
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: clean
|
||||
run: yarn clear
|
||||
|
||||
- name: yarn install --frozen-lockfile
|
||||
uses: borales/actions-yarn@v5
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: install
|
||||
- run: yarn install --immutable
|
||||
|
||||
- run: yarn bundle
|
||||
working-directory: ./webapp/packages/product-default
|
||||
|
||||
- name: build
|
||||
id: build
|
||||
uses: borales/actions-yarn@v5
|
||||
with:
|
||||
dir: webapp/packages/product-default
|
||||
cmd: bundle
|
||||
|
||||
- name: test
|
||||
id: test
|
||||
uses: borales/actions-yarn@v5
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: test
|
||||
- run: yarn test
|
||||
|
||||
- name: Archive build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
name: Frontend Lint
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Allows you to reuse workflows by referencing their YAML files
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Frontend
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./webapp
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
@@ -29,17 +34,12 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules-
|
||||
|
||||
- name: yarn install --frozen-lockfile
|
||||
uses: borales/actions-yarn@v5
|
||||
with:
|
||||
dir: webapp
|
||||
cmd: install
|
||||
|
||||
- name: Lint
|
||||
uses: reviewdog/action-eslint@v1
|
||||
with:
|
||||
reporter: github-pr-review
|
||||
filter_mode: file
|
||||
workdir: webapp
|
||||
fail_on_error: true
|
||||
eslint_flags: "--ext .ts,.tsx"
|
||||
- run: |
|
||||
yarn install --immutable
|
||||
git fetch origin "${{ github.base_ref }}" --depth=1
|
||||
FILES=$(git diff --name-only 'origin/${{ github.base_ref }}' ${{ github.sha }} -- . | sed 's|^webapp/||')
|
||||
if [ -n "$FILES" ]; then
|
||||
yarn lint --pass-on-no-patterns --no-error-on-unmatched-pattern $FILES
|
||||
else
|
||||
echo "No files to lint"
|
||||
fi
|
||||
|
||||
@@ -1,40 +1,38 @@
|
||||
name: Check
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- devel
|
||||
pull_request:
|
||||
branches:
|
||||
- devel
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
push:
|
||||
branches: [devel]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip_cache:
|
||||
description: "Skip cache restoration"
|
||||
required: false
|
||||
default: "false"
|
||||
concurrency:
|
||||
group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'push-pr-devel' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
call-backend-build:
|
||||
name: Build
|
||||
build-server:
|
||||
name: Server
|
||||
uses: ./.github/workflows/backend-build.yml
|
||||
secrets: inherit
|
||||
|
||||
call-frontend-build:
|
||||
name: Build
|
||||
build-frontend:
|
||||
name: Frontend
|
||||
uses: ./.github/workflows/frontend-build.yml
|
||||
with:
|
||||
skip_cache: ${{ github.event.inputs.skip_cache }}
|
||||
secrets: inherit
|
||||
|
||||
call-frontend-lint:
|
||||
name: Lint
|
||||
needs: call-frontend-build
|
||||
lint-server:
|
||||
name: Server
|
||||
uses: dbeaver/dbeaver-common/.github/workflows/java-checkstyle.yml@devel
|
||||
secrets: inherit
|
||||
|
||||
lint-frontend:
|
||||
name: Frontend
|
||||
uses: ./.github/workflows/frontend-lint.yml
|
||||
|
||||
call-backend-lint:
|
||||
name: Lint
|
||||
uses: ./.github/workflows/backend-lint.yml
|
||||
secrets: inherit
|
||||
|
||||
# call-frontend-tests:
|
||||
# name: Frontend Unit Tests
|
||||
Reference in New Issue
Block a user