Skip to content

Commit

Permalink
improve gh actions (#3283)
Browse files Browse the repository at this point in the history
(1) add merge_group event;
(2) cancel the previous run when a new one is triggered;
(3) enable test_cuda for merge_group.

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Feb 17, 2024
1 parent b65375a commit d19d841
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build_cc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
on:
push:
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
name: Build C++
jobs:
buildcc:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Build and upload to PyPI
on:
push:
pull_request:
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
determine-arm64-runner:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
pull_request:
schedule:
- cron: '45 2 * * 2'

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
5 changes: 4 additions & 1 deletion .github/workflows/package_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Build C library
on:
push:
pull_request:

merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build_c:
name: Build C library
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test_cc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
on:
push:
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
name: Test C++
jobs:
testcc:
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/test_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
pull_request:
types:
- "labeled"
# to let the PR pass the test
- "synchronize"
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
name: Test CUDA
jobs:
test_cuda:
Expand All @@ -13,7 +19,7 @@ jobs:
container:
image: nvidia/cuda:12.2.0-devel-ubuntu22.04
options: --gpus all
if: github.repository_owner == 'deepmodeling' && github.event.label.name == 'Test CUDA' || github.event_name == 'workflow_dispatch'
if: github.repository_owner == 'deepmodeling' && (github.event_name == 'pull_request' && github.event.label && github.event.label.name == 'Test CUDA' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group')
steps:
- name: Make sudo and git work
run: apt-get update && apt-get install -y sudo git
Expand Down Expand Up @@ -69,3 +75,13 @@ jobs:
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
pass:
name: Pass testing on CUDA
needs: [test_cuda]
runs-on: ubuntu-latest
if: always()
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
6 changes: 4 additions & 2 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
on:
push:
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
name: Test Python
jobs:
testpython:
Expand All @@ -27,8 +31,6 @@ jobs:
mpi: openmpi
# https://github.com/pypa/pip/issues/11770
- run: python -m pip install -U "pip>=21.3.1,!=23.0.0"
- run: python -m pip install -U "torch==${{ matrix.torch }}" "numpy<1.20"
if: matrix.torch != ''
- run: pip install -e .[cpu,test,torch]
env:
TENSORFLOW_VERSION: ${{ matrix.tf }}
Expand Down

0 comments on commit d19d841

Please sign in to comment.