Skip to content

Commit

Permalink
Merge pull request chipsalliance#3460 from chipsalliance/dev/seldridg…
Browse files Browse the repository at this point in the history
…e/ci-nightly-circt-2

- Add ability to specify CI branch
- Add CIRCT nightly CI
  • Loading branch information
seldridge authored Aug 8, 2023
2 parents 00abcea + 604e4e6 commit 79253e6
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 5 deletions.
102 changes: 97 additions & 5 deletions .github/workflows/ci-circt-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,104 @@ on:
# Run on PRs that target the
pull_request:
branches:
- ${{ branch-name }}
- ci/ci-circt-nightly

jobs:
hello:
name: Hello World
update-branch:
name: Integrate staging branch with default branch
runs-on: ubuntu-20.04
steps:
- name: Hello
run: echo "World"
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- run: |
# Leave the staging branch unchanged if this is a PR. This is not a
# GitHub Actions-level "if" because we want this job to return success
# (so that subsequent jobs run).
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
exit 0
fi
# Rebase the staging branch on the default branch. Create the staging
# branch if it doesn't exist.
git checkout -b ${{ env.branch-name }}
if [[ `git fetch origin ${{ env.branch-name }}` ]]; then
git reset --hard origin ${{ env.branch-name }}
git rebase origin/main
fi
git push --force origin ${{ env.branch-name }}
# If this is running on a PR, then use the branch of the PR. Otherwise, use
# the staging branch.
determine-branch:
name: Determine what branch to run tests on
runs-on: ubuntu-20.04
steps:
- name: Determine Branch
id: determine-branch
run: |
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
echo branches='["${{ env.branch-name }}"]' >> $GITHUB_OUTPUT
else
echo branches='["${{ github.ref }}"]' >> $GITHUB_OUTPUT
fi
outputs:
branches: ${{ steps.determine-branch.outputs.branches }}

ci:
name: ci
needs: [update-branch, determine-branch]
strategy:
matrix:
system: ["ubuntu-20.04"]
jvm: [8]
scala: ["2.13.11"]
espresso: ["2.4"]
circt: ["nightly"]
ref: ${{ fromJSON(needs.determine-branch.outputs.branches) }}
uses: ./.github/workflows/test.yml
with:
system: ${{ matrix.system }}
jvm: ${{ matrix.jvm }}
scala: ${{ matrix.scala }}
espresso: ${{ matrix.espresso }}
circt: ${{ matrix.circt }}
ref: ${{ matrix.ref }}

# Sentinel job to simplify how we specify which checks need to pass in branch
# protection and in Mergify. This job checks that all matrix jobs were
# successful.
check-tests:
name: "check tests"
needs: [ci]
runs-on: ubuntu-20.04
outputs:
success: ${{ steps.setoutput.outputs.success }}
steps:
- id: setoutput
run: echo "success=true" >> $GITHUB_OUTPUT

# Related to check-tests above, this job _always_ runs (even if tests fail
# and thus check-steps is skipped). This two sentinel job approach avoids an
# issue where failing tests causes a single sentinel job to be skipped which
# counts as passing for purposes of branch protection.
#
# See: https://brunoscheufler.com/blog/2022-04-09-the-required-github-status-check-that-wasnt
all_tests_passed:
name: "all tests passed"
runs-on: ubuntu-20.04
if: always() # Always run so that we never skip this check
needs: check-tests
# Pass only if check-tests set its output value
steps:
- run: |
PASSED=${{ needs.check-tests.outputs.success }}
if [[ $PASSED == "true" ]]; then
echo "### All tests passed! :rocket:" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "### One or more tests FAILED! :bangbang:" >> $GITHUB_STEP_SUMMARY
exit 1
fi
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Continuous Integration
on:
workflow_dispatch:
pull_request:
branches-ignore:
- ci/ci-circt-nightly
push:
tags:
- '*'
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ on:
description: 'The CIRCT version to use (must be a valid release tag or "nightly")'
required: true
type: string
ref:
description: 'The branch, tag, or git hash to checkout'
default: ''
required: false
type: string

jobs:
ci:
Expand All @@ -36,6 +41,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Install Tabby OSS Cad Suite
uses: ./.github/workflows/setup-oss-cad-suite
- name: Install Espresso
Expand Down Expand Up @@ -66,6 +73,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Install Mill
uses: jodersky/setup-mill@v0.3.0
with:
Expand All @@ -84,6 +93,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Setup Scala
uses: actions/setup-java@v3
with:
Expand All @@ -104,6 +115,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Install Tabby OSS Cad Suite
uses: ./.github/workflows/setup-oss-cad-suite
- name: Install Espresso
Expand Down Expand Up @@ -131,6 +144,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Install Tabby OSS Cad Suite
uses: ./.github/workflows/setup-oss-cad-suite
- name: Setup Scala
Expand All @@ -151,6 +166,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Setup Scala
uses: actions/setup-java@v3
with:
Expand Down

0 comments on commit 79253e6

Please sign in to comment.