CI #69
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# <minute [0,59]> <hour [0,23]> <day of the month [1,31]> | |
# <month of the year [1,12]> <day of the week [0,6]> | |
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07 | |
- cron: "27 14 * * 1" | |
workflow_dispatch: | |
jobs: | |
test-repo-gen: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- uses: extractions/setup-just@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Dependencies | |
run: | | |
pip install --upgrade pip | |
pip install cookiecutter | |
- name: Generate Repo | |
run: | | |
cookiecutter . --no-input | |
- name: Test Generated Repo Install | |
run: | | |
cd bioio-my-custom-file-format | |
git init | |
git config --global user.email "[email protected]" | |
git config --global user.name "Sally Tests" | |
git add -A | |
git commit -m "Initial commit" | |
just install | |
- name: Test Generated Repo Build | |
run: | | |
cd bioio-my-custom-file-format | |
just build | |
- name: Test Generated Repo Clean | |
run: | | |
cd bioio-my-custom-file-format | |
just clean | |
- name: Test Generated Repo Updates | |
run: | | |
cd bioio-my-custom-file-format | |
just update-from-cookiecutter | |
git status | |
# GitHub does not provide a "all status checks must pass" option | |
# in branch protection settings. Instead, you have to specify exactly | |
# what status checks want to require to pass before merging. However, | |
# naming each individual check would be effectively impossible. | |
# Therefore, by creating this stage in every repo in the org we can | |
# require "Report Result" to pass before merging and this stage can | |
# represent the result of the other checks where it only passes if | |
# all the other checks pass. | |
results: | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
needs: test-repo-gen | |
runs-on: ubuntu-latest | |
name: Report Result | |
steps: | |
- run: exit 1 | |
# see https://stackoverflow.com/a/67532120/4907315 | |
if: >- | |
${{ | |
contains(needs.*.result, 'failure') | |
|| contains(needs.*.result, 'cancelled') | |
}} |