From d94d99a94205cf0f0fd088aef47e02e3d7be6dcf Mon Sep 17 00:00:00 2001 From: Nanne Baars Date: Mon, 28 Oct 2024 21:54:49 +0100 Subject: [PATCH] ci: run pre-commit checks first --- .github/workflows/build.yml | 26 ++++++++++++++++++++------ .github/workflows/pre-commit.yaml | 29 ----------------------------- .github/workflows/release.yml | 8 +------- .github/workflows/test.yml | 8 +------- 4 files changed, 22 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/pre-commit.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5030f190b..fc9032b86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index 5101f000a..000000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -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() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9048655d5..81dd6ebfd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8105d942a..54ea4f461 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: |