ci: run pre-commit checks first

This commit is contained in:
Nanne Baars 2024-10-28 21:54:49 +01:00
parent 52c20738f9
commit d94d99a942
No known key found for this signature in database
GPG Key ID: A6D6C06FE4EC14E7
4 changed files with 22 additions and 49 deletions

View File

@ -11,6 +11,25 @@ on:
- main
jobs:
pre-commit:
name: Pre-commit check
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Pre-commit checks
uses: pre-commit/action@v3.0.0
- name: pre-commit-ci-lite
uses: pre-commit-ci/lite-action@v1.1.0
if: always()
build:
runs-on: ${{ matrix.os }}
strategy:
@ -26,11 +45,6 @@ jobs:
distribution: 'temurin'
java-version: 21
architecture: x64
- name: Cache Maven packages
uses: actions/cache@v4.1.1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
cache: 'maven'
- name: Build with Maven
run: mvn --no-transfer-progress verify

View File

@ -1,29 +0,0 @@
name: Pre-commit check
on:
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
pre-commit:
name: Pre-commit check
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Pre-commit checks
uses: pre-commit/action@v3.0.0
- name: pre-commit-ci-lite
uses: pre-commit-ci/lite-action@v1.1.0
if: always()

View File

@ -21,13 +21,7 @@ jobs:
distribution: 'temurin'
java-version: 21
architecture: x64
- name: Cache Maven packages
uses: actions/cache@v4.1.1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
cache: 'maven'
- name: "Set labels for ${{ github.ref }}"
run: |

View File

@ -35,13 +35,7 @@ jobs:
distribution: 'temurin'
java-version: 21
architecture: x64
#Uses an action to set up a cache using a certain key based on the hash of the dependencies
- name: Cache Maven packages
uses: actions/cache@v4.1.1
with:
path: ~/.m2
key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ubuntu-latest-m2-
cache: 'maven'
- uses: BSFishy/pip-action@v1
with:
packages: |