Skip to content

Commit

Permalink
ci: Verific skipping conditional on github.ref
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KrystalDelusion committed Sep 2, 2024
1 parent 840c515 commit fcb94ba
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/test-verific.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build and run tests with Verific (Linux)

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:
pre-job:
Expand All @@ -15,9 +19,10 @@ jobs:
# don't cancel previous builds
cancel_others: 'false'
# only run on push *or* pull_request, not both
concurrent_skipping: 'same_content_newer'
# we have special actions when running on main, so this should be off
skip_after_successful_duplicate: 'false'
# unless this is a build which needs to run for docs generation
concurrent_skipping: ${{ (env.is_docs_job == 'true') && 'never' || 'same_content_newer' }}
# we can skip testing if it has already passed
skip_after_successful_duplicate: 'true'

test-verific:
needs: pre-job
Expand Down Expand Up @@ -74,19 +79,20 @@ jobs:
prepare-docs:
name: Generate docs artifact
needs: [pre-job, test-verific]
if: needs.pre-job.outputs.should_skip != 'true'
runs-on: [self-hosted, linux, x64, fast]
steps:
- name: Checkout Yosys
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true

- name: Runtime environment
run: |
echo "procs=$(nproc)" >> $GITHUB_ENV
- name: Build Yosys
if: ${{ (needs.pre-job.outputs.should_skip != 'true') || env.is_docs_job }}
run: |
make config-clang
echo "ENABLE_VERIFIC := 1" >> Makefile.conf
Expand All @@ -97,11 +103,13 @@ jobs:
make -j${{ env.procs }} ENABLE_LTO=1
- name: Prepare docs
if: ${{ (needs.pre-job.outputs.should_skip != 'true') || env.is_docs_job }}
shell: bash
run:
make docs/source/cmd/abc.rst docs/gen_examples docs/gen_images docs/guidelines docs/usage docs/reqs TARGETS= EXTRA_TARGETS=

- name: Upload artifact
if: ${{ (needs.pre-job.outputs.should_skip != 'true') || env.is_docs_job }}
uses: actions/upload-artifact@v4
with:
name: cmd-ref-${{ github.sha }}
Expand All @@ -112,7 +120,7 @@ jobs:
docs/source/code_examples
- 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/[email protected]
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
Expand Down

0 comments on commit fcb94ba

Please sign in to comment.