ci: Verific skipping conditional on github.ref

Docs jobs should not skip on concurrent jobs (in case a non-docs job is already
running, such as when a commit has been tagged for docs-preview). However, a
successful `test-verific` can allow for a future docs job to skip testing and go
straight to the preview.
This commit is contained in:
Krystine Sherwin 2024-09-03 11:00:28 +12:00
parent 840c515ffc
commit a97d99cbac
No known key found for this signature in database
1 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,10 @@
name: Build and run tests with Verific (Linux) name: Build and run tests with Verific (Linux)
on: [push, pull_request] on: [push, pull_request]
# docs builds are needed for anything on main, any tagged versions, and any tag
# or branch starting with docs-preview
env:
is_docs_job: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/docs-preview') || startsWith(github.ref, 'refs/tags/') }}
jobs: jobs:
pre-job: pre-job:
@ -16,8 +20,8 @@ jobs:
cancel_others: 'false' cancel_others: 'false'
# only run on push *or* pull_request, not both # only run on push *or* pull_request, not both
concurrent_skipping: 'same_content_newer' concurrent_skipping: 'same_content_newer'
# we have special actions when running on main, so this should be off # we can skip testing if it has already passed
skip_after_successful_duplicate: 'false' skip_after_successful_duplicate: 'true'
test-verific: test-verific:
needs: pre-job needs: pre-job
@ -74,7 +78,6 @@ jobs:
prepare-docs: prepare-docs:
name: Generate docs artifact name: Generate docs artifact
needs: [pre-job, test-verific] needs: [pre-job, test-verific]
if: needs.pre-job.outputs.should_skip != 'true'
runs-on: [self-hosted, linux, x64, fast] runs-on: [self-hosted, linux, x64, fast]
steps: steps:
- name: Checkout Yosys - name: Checkout Yosys
@ -82,11 +85,13 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
submodules: true submodules: true
- name: Runtime environment - name: Runtime environment
run: | run: |
echo "procs=$(nproc)" >> $GITHUB_ENV echo "procs=$(nproc)" >> $GITHUB_ENV
- name: Build Yosys - name: Build Yosys
if: ${{ (needs.pre-job.outputs.should_skip != 'true') || env.is_docs_job }}
run: | run: |
make config-clang make config-clang
echo "ENABLE_VERIFIC := 1" >> Makefile.conf echo "ENABLE_VERIFIC := 1" >> Makefile.conf
@ -97,11 +102,13 @@ jobs:
make -j${{ env.procs }} ENABLE_LTO=1 make -j${{ env.procs }} ENABLE_LTO=1
- name: Prepare docs - name: Prepare docs
if: ${{ (needs.pre-job.outputs.should_skip != 'true') || env.is_docs_job }}
shell: bash shell: bash
run: run:
make docs/source/cmd/abc.rst docs/gen_examples docs/gen_images docs/guidelines docs/usage docs/reqs TARGETS= EXTRA_TARGETS= make docs/source/cmd/abc.rst docs/gen_examples docs/gen_images docs/guidelines docs/usage docs/reqs TARGETS= EXTRA_TARGETS=
- name: Upload artifact - name: Upload artifact
if: ${{ (needs.pre-job.outputs.should_skip != 'true') || env.is_docs_job }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: cmd-ref-${{ github.sha }} name: cmd-ref-${{ github.sha }}
@ -112,7 +119,7 @@ jobs:
docs/source/code_examples docs/source/code_examples
- name: Trigger RTDs build - name: Trigger RTDs build
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/docs-preview') || startsWith(github.ref, 'refs/tags/') }} if: ${{ env.is_docs_job }}
uses: dfm/rtds-action@v1.1.0 uses: dfm/rtds-action@v1.1.0
with: with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }} webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}