Skip to content

Commit

Permalink
Make all GitHub Actions run independently
Browse files Browse the repository at this point in the history
This removes `pull-request.yaml` and let's each dependent workflow initiate on its own.
  • Loading branch information
mhostetter committed Aug 26, 2022
1 parent 7faa30a commit 17b09a4
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 62 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: Build

on:
workflow_call
# push:
# branches:
# - master
pull_request:
branches:
- master

jobs:
build_wheel:
build-wheel:
name: Wheel
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Docs

on:
workflow_call
# push:
# branches:
# - master
pull_request:
branches:
- master

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fast-forward-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [created]

jobs:
fast_forward:
fast-forward:
name: Fast forward
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/fast-forward')
runs-on: ubuntu-latest
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Lint

on:
workflow_call
# push:
# branches:
# - master
pull_request:
branches:
- master

jobs:
run-linter:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/pull-request.yaml

This file was deleted.

28 changes: 2 additions & 26 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ on:
jobs:
build:
name: Build the package
id: build
uses: ./.github/workflows/build.yaml

# TODO: Add other CI workflows here: lint, docs, test?
# Here would also be the place to build the docs and then add a GitHub pages release job

release:
name: Create GitHub release
id: release
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -53,16 +51,10 @@ jobs:
body_path: release_notes.md
draft: true

publish-test:
name: Publish on TestPyPI
id: publish-test
publish:
name: Publish on PyPI
needs: build, release
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all commits and tags
ref: ${{ github.REF }}

- name: Download build artifacts
uses: actions/download-artifact@v2
with:
Expand All @@ -78,22 +70,6 @@ jobs:
packages_dir: dist/
verbose: true

publish:
name: Publish on PyPI
id: publish
needs: publish-test
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all commits and tags
ref: ${{ github.REF }}

- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
Expand Down
38 changes: 31 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
name: Test

on:
workflow_call
# push:
# branches:
# - master
pull_request:
branches:
- master

jobs:
wait-on-wheel:
name: Wait for wheel
runs-on: ubuntu-latest
steps:
- name: Wait on build.yaml to build the wheel
uses: lewagon/wait-on-check-action@v1.0.0
with:
# NOTE: https://github.com/lewagon/wait-on-check-action/issues/25#issuecomment-784773361
# May need to modify this if running tests on `master` too
ref: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
check-name: 'Wheel'
allowed-conclusions: success
wait-interval: 10

test-min:
name: Min
needs: wait-on-wheel
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
Expand All @@ -23,10 +44,11 @@ jobs:
run: python3 -m pip install --upgrade pip

- name: Download wheel artifact
uses: actions/download-artifact@v2
uses: dawidd6/action-download-artifact@v2
with:
name: dist
path: dist/
workflow: build.yaml
workflow_conclusion: success
commit: ${{github.event.pull_request.head.sha}}

# This is needed because Windows terminal cannot expand `pip install galois-*.whl`
- name: Get wheel file name
Expand All @@ -52,6 +74,7 @@ jobs:

test-latest:
name: Latest
needs: wait-on-wheel
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
Expand All @@ -69,10 +92,11 @@ jobs:
run: python3 -m pip install --upgrade pip

- name: Download wheel artifact
uses: actions/download-artifact@v2
uses: dawidd6/action-download-artifact@v2
with:
name: dist
path: dist/
workflow: build.yaml
workflow_conclusion: success
commit: ${{github.event.pull_request.head.sha}}

# This is needed because Windows terminal cannot expand `pip install galois-*.whl`
- name: Get wheel file name
Expand Down

0 comments on commit 17b09a4

Please sign in to comment.