From 300b402b28a4f952a3c66d60e66b8e9ff3c8febc Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Wed, 16 Aug 2023 11:48:48 +0300 Subject: [PATCH] github: refactor verify workflow Change the verify workflow to run on PRs only. Add concurrency rule so that in-progress runs for a PR are canceled if the PR is updated before their completion. Add a nightly verify workflow that runs on the master branch every day at 2:30 UTC. --- .../workflows/{verify.yml => common-verify.yaml} | 13 ++++++------- .github/workflows/verify-periodic.yaml | 14 ++++++++++++++ .github/workflows/verify-pr.yaml | 11 +++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) rename .github/workflows/{verify.yml => common-verify.yaml} (85%) create mode 100644 .github/workflows/verify-periodic.yaml create mode 100644 .github/workflows/verify-pr.yaml diff --git a/.github/workflows/verify.yml b/.github/workflows/common-verify.yaml similarity index 85% rename from .github/workflows/verify.yml rename to .github/workflows/common-verify.yaml index 16e9c00ac..5b67c5cbc 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/common-verify.yaml @@ -1,13 +1,13 @@ name: Verify -on: [push, pull_request] -jobs: - build: - name: Build +on: + - workflow_call + +jobs: + build-and-test: runs-on: ubuntu-22.04 steps: - - - name: Check out code into the Go module directory + - name: Check out code uses: actions/checkout@v1 - name: Set up Go @@ -37,7 +37,6 @@ jobs: run: bash <(curl -s https://codecov.io/bash) build-docs: - name: Verify docs build and gh-pages update uses: "./.github/workflows/common-build-docs.yaml" trivy-scan: diff --git a/.github/workflows/verify-periodic.yaml b/.github/workflows/verify-periodic.yaml new file mode 100644 index 000000000..c60c8ca6b --- /dev/null +++ b/.github/workflows/verify-periodic.yaml @@ -0,0 +1,14 @@ +name: Verify branches periodic + +on: + schedule: + - cron: '30 2 * * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + verify: + uses: "./.github/workflows/common-verify.yaml" + diff --git a/.github/workflows/verify-pr.yaml b/.github/workflows/verify-pr.yaml new file mode 100644 index 000000000..2f4c41ce0 --- /dev/null +++ b/.github/workflows/verify-pr.yaml @@ -0,0 +1,11 @@ +name: Verify PR + +on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + verify: + uses: "./.github/workflows/common-verify.yaml"