diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa0e8af7d..cb7f00fab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: fail-on-error: true pyflakes: false - test: + build-and-test: runs-on: ubuntu-latest steps: - name: Checkout @@ -56,6 +56,12 @@ jobs: with: version: 3.x + - name: Create bin directory + run: mkdir -p "$HOME/bin" + + - name: Build + run: task build + - name: Run tests run: | task test @@ -79,32 +85,8 @@ jobs: - name: Check licenses run: go-licenses check . --allowed_licenses=Apache-2.0,MIT,BSD-3-Clause,BSD-2-Clause --ignore modernc.org/mathutil - build: - needs: [lint, test, license-check] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - - name: Set up Go - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 - with: - go-version: "1.26.0" - cache: true - - - name: Install Task - uses: go-task/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1.0.0 - with: - version: 3.x - - - name: Create bin directory - run: mkdir -p "$HOME/bin" - - - name: Build - run: task build - build-image: - needs: [lint, test, license-check] + needs: [lint, build-and-test, license-check] runs-on: ubuntu-latest steps: - name: Checkout @@ -142,5 +124,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - GIT_TAG=${{ github.ref_name }} - GIT_COMMIT=${{ github.sha }} + GIT_TAG=${{ github.event_name == 'pull_request' && 'pr' || github.ref_name }} + GIT_COMMIT=${{ github.event_name == 'pull_request' && 'dev' || github.sha }} + cache-from: type=gha,scope=buildx + cache-to: type=gha,mode=max,scope=buildx