Skip to content

Commit

Permalink
[build] Create triggers for release/test related jobs in github action.
Browse files Browse the repository at this point in the history
The previous jobs related to release/test will check condition
multiple times, now it will check only once in an empty trigger job.
  • Loading branch information
hzhangxyz committed Dec 11, 2023
1 parent 770397d commit 6056ac6
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ name: build
on: [push, pull_request]

jobs:
test_trigger:
name: trigger for run test
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"

steps:
- name: nothing
run: echo this is an empty job

test_TAT_hpp:
name: test TAT.hpp
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
needs: [test_trigger]

steps:
- name: checkout
Expand All @@ -28,7 +37,7 @@ jobs:
test_lazy_py:
name: test lazy.py
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
needs: [test_trigger]
steps:
- name: checkout
uses: actions/checkout@v3
Expand All @@ -45,7 +54,7 @@ jobs:
test_scalapack_py:
name: test scalapack.py
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
needs: [test_trigger]
steps:
- name: checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -271,11 +280,20 @@ jobs:
with:
path: ${{github.workspace}}/${{matrix.package}}/dist/*.whl

release_trigger:
name: trigger for release
runs-on: ubuntu-latest
needs: [build_pytat_wheels, build_pure_python_wheels]
if: startsWith(github.ref, 'refs/tags')

steps:
- name: nothing
run: echo this is an empty job

upload_pypi:
name: upload wheels to pypi
runs-on: ubuntu-latest
needs: [build_wheels_trigger, build_pytat_wheels, build_pure_python_wheels]
if: startsWith(github.ref, 'refs/tags')
needs: [release_trigger]

environment: release
permissions:
Expand All @@ -296,8 +314,7 @@ jobs:
create_release:
name: create github release
runs-on: ubuntu-latest
needs: [build_wheels_trigger, build_pytat_wheels, build_pure_python_wheels]
if: startsWith(github.ref, 'refs/tags')
needs: [release_trigger]

steps:
- name: checkout
Expand All @@ -322,11 +339,10 @@ jobs:
- name: push to main branch
run: git remote set-url origin https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}} && git push origin HEAD:main

doxygen:
build_doxygen:
name: build doxygen github pages
runs-on: ubuntu-latest
needs: [build_wheels_trigger, build_pytat_wheels, build_pure_python_wheels]
if: startsWith(github.ref, 'refs/tags')
needs: [release_trigger]

steps:
- name: checkout
Expand Down

0 comments on commit 6056ac6

Please sign in to comment.