Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbeaver/dbeaver-devops#1525 add github checks #42

Merged
merged 30 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c0b4af
dbeaver/dbeaver-devops#1525 add github checks
Wroud Oct 12, 2024
ee86b4c
chore: rename jobs
Wroud Oct 12, 2024
d9564e9
dbeaver/dbeaver-devops#1525 remove pull-repositories action
Wroud Oct 12, 2024
3c843fe
dbeaver/dbeaver-devops#1525 rename steps
Wroud Oct 14, 2024
4c37185
dbeaver/dbeaver-devops#1525 reuse workflows
Wroud Oct 14, 2024
a364691
dbeaver/dbeaver-devops#1525 always pull to subfolder
Wroud Oct 14, 2024
1238c10
dbeaver/dbeaver-devops#1525 try to use mvn from setup-java action
Wroud Oct 14, 2024
2963883
Revert "dbeaver/dbeaver-devops#1525 try to use mvn from setup-java ac…
Wroud Oct 14, 2024
b0bb5cf
dbeaver/dbeaver-devops#1525 try to use custom mvn install action
Wroud Oct 14, 2024
5de532f
dbeaver/dbeaver-devops#1525 try to use custom mvn install action 2
Wroud Oct 14, 2024
75f5053
dbeaver/dbeaver-devops#1525 try to use custom mvn install action 3
Wroud Oct 14, 2024
2974798
dbeaver/dbeaver-devops#1525 try to different OS
Wroud Oct 14, 2024
71dc48e
dbeaver/dbeaver-devops#1525 try to different OS 2
Wroud Oct 14, 2024
be5aa3c
dbeaver/dbeaver-devops#1525 try to different OS 3
Wroud Oct 14, 2024
4ab21c7
dbeaver/dbeaver-devops#1525 try checkstyle
Wroud Oct 14, 2024
b9c6bd4
dbeaver/dbeaver-devops#1525 try checkstyle 2
Wroud Oct 14, 2024
f8f0202
dbeaver/dbeaver-devops#1525 try checkstyle 3
Wroud Oct 14, 2024
064ce05
dbeaver/dbeaver-devops#1525 try checkstyle 4
Wroud Oct 14, 2024
76c08e4
dbeaver/dbeaver-devops#1525 try checkstyle 5
Wroud Oct 14, 2024
1df7f4f
dbeaver/dbeaver-devops#1525 try checkstyle 6
Wroud Oct 14, 2024
10dcdac
dbeaver/dbeaver-devops#1525 try checkstyle 7
Wroud Oct 14, 2024
5c7498e
dbeaver/dbeaver-devops#1525 try checkstyle 8
Wroud Oct 14, 2024
1a545e6
dbeaver/dbeaver-devops#1525 use dbelyaev/action-checkstyle@master
Wroud Oct 14, 2024
737dbf5
dbeaver/dbeaver-devops#1525 revert checkstyle trigger
Wroud Oct 14, 2024
52c7dd9
dbeaver/dbeaver-devops#1525 remove comment
Wroud Oct 14, 2024
edfad2c
dbeaver/dbeaver-devops#1525 move checkstyle config from dbeaver repo
Wroud Oct 14, 2024
9279d81
dbeaver/dbeaver-devops#1525 clone dbeaver-common for checkstyle config
Wroud Oct 14, 2024
fdd4307
dbeaver/dbeaver-devops#1525 use fork for checkstyle action
Wroud Oct 14, 2024
2f84584
dbeaver/dbeaver-devops#1525 simplify workflow
Wroud Oct 14, 2024
b58cff9
dbeaver/dbeaver-devops#1525 move checkstyle file
Wroud Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
363 changes: 363 additions & 0 deletions .github/dbeaver-checkstyle-config.xml

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions .github/workflows/cleanup-caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Cleanup caches

on:
workflow_call:

jobs:
delete-caches:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Cleanup caches
run: |
gh extension install actions/gh-actions-cache

echo "Fetching list of cache keys"
cacheKeys=$(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 $cacheKeys
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: ${{ github.event_name == 'pull_request' && format('refs/pull/{0}/merge', github.event.pull_request.number) || 'refs/heads/main' }}
41 changes: 41 additions & 0 deletions .github/workflows/java-checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint

on:
# Allows you to reuse workflows by referencing their YAML files
workflow_call:

concurrency:
group: |
# For pull requests, group by the pull request ID
${{ github.event_name == 'pull_request' && format('pr-{0}-java-checkstyle', github.event.pull_request.number) }}

# For pushes to main, group by the branch name (e.g., 'main')
${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'main-branch-java-checkstyle' }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Checkout checkstyle config repository
uses: actions/checkout@v4
with:
repository: dbeaver/dbeaver-common
path: dbeaver-common

- run: |
cp dbeaver-common/.github/dbeaver-checkstyle-config.xml ./dbeaver-checkstyle-config.xml
rm -rf dbeaver-common

- uses: dbeaver/action-java-checkstyle@master
with:
reporter: github-pr-annotations
filter_mode: diff_context
checkstyle_config: ./dbeaver-checkstyle-config.xml
fail_on_error: true
69 changes: 69 additions & 0 deletions .github/workflows/mvn-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: MVN Package

on:
workflow_call:
inputs:
project-directory:
required: false
type: string
timeout-minutes:
required: false
type: number
default: 10
project-deps:
required: false
type: string

outputs:
run-id:
value: ${{ jobs.build-and-test.outputs.run-id }}

secrets:
DEVOPS_ISSUE_RO_TOKEN:
required: false

concurrency:
group: |
# For pull requests, group by the pull request ID
${{ github.event_name == 'pull_request' && format('pr-{0}-mvn-package', github.event.pull_request.number) }}

# For pushes to main, group by the branch name (e.g., 'main')
${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'main-branch-mvn-package' }}
cancel-in-progress: true

jobs:
build-and-test:
name: Build
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.timeout-minutes }}
permissions:
contents: read

outputs:
run-id: ${{ github.run_id }}

steps:
- name: Set repository path variable
run: echo "CHECKOUT_PATH=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV

- uses: actions/checkout@v4
with:
path: ${{ env.CHECKOUT_PATH || '.' }}

- uses: dbeaver/github-actions/clone-repositories@devel
if: ${{ inputs.project-deps != null }}
with:
project_deps_path: ${{ inputs.project-deps }}
token: ${{ secrets.DEVOPS_ISSUE_RO_TOKEN }}

- uses: dbeaver/github-actions/install-maven@devel
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: maven

- name: Build
run: mvn -B -T 1C clean package
working-directory: ${{ inputs.project-directory || env.CHECKOUT_PATH || '.' }}

14 changes: 14 additions & 0 deletions .github/workflows/pr-close-push-devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Cleanup

on:
pull_request:
types: [closed]
push:
branches:
- devel

jobs:
delete-caches:
name: Cleanup
uses: ./.github/workflows/cleanup-caches.yml
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/push-pr-devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on:
pull_request:
types:
- opened
- synchronize
- reopened
push:
branches: [devel]

jobs:
build:
uses: ./.github/workflows/mvn-package.yml
name: Check
secrets: inherit
with:
timeout-minutes: 5

lint:
uses: ./.github/workflows/java-checkstyle.yml
name: Check
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# java
target/
.project
.classpath
.settings/