|
13 | 13 | - main
|
14 | 14 |
|
15 | 15 | jobs:
|
16 |
| - pre-commit: |
17 |
| - name: Test pre-commit hooks |
| 16 | + cancel-previous: |
| 17 | + name: Cancel Previous Runs |
18 | 18 | runs-on: ubuntu-latest
|
19 |
| - timeout-minutes: 5 |
20 | 19 | steps:
|
21 | 20 | - name: Cancel previous
|
22 |
| - |
| 21 | + |
| 22 | + if: ${{github.ref != 'refs/head/main'}} |
23 | 23 | with:
|
24 | 24 | access_token: ${{ github.token }}
|
25 |
| - if: ${{github.ref != 'refs/head/main'}} |
| 25 | + workflow_id: ${{ github.event.workflow.id }} |
| 26 | + all_but_latest: true |
| 27 | + pre-commit: |
| 28 | + name: Test pre-commit hooks |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
26 | 31 | - uses: actions/checkout@v3
|
27 | 32 | - name: Set up Python 3.8
|
28 | 33 | uses: actions/setup-python@v3
|
|
33 | 38 | name: Check commit count
|
34 | 39 | runs-on: ubuntu-latest
|
35 | 40 | steps:
|
36 |
| - - name: Cancel previous |
37 |
| - |
38 |
| - with: |
39 |
| - access_token: ${{ github.token }} |
40 | 41 | - uses: actions/checkout@v2
|
41 | 42 | # We allow at most 5 commits in a branch to ensure our CI doesn't break.
|
42 | 43 | - name: Check commit count in PR
|
|
59 | 60 | echo "See $url for help on how to resolve this."
|
60 | 61 | exit 1
|
61 | 62 | fi
|
| 63 | + test-import: |
| 64 | + name: Test import standalone |
| 65 | + runs-on: ubuntu-latest |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + python-version: [3.7, 3.8, 3.9] |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v2 |
| 71 | + - name: Set up Python ${{ matrix.python-version }} |
| 72 | + uses: actions/setup-python@v1 |
| 73 | + with: |
| 74 | + python-version: ${{ matrix.python-version }} |
| 75 | + - name: Install standalone dependencies only |
| 76 | + run: | |
| 77 | + pip install . |
| 78 | + - name: Test importing Flax |
| 79 | + run: | |
| 80 | + python -c "import flax" |
62 | 81 | tests:
|
63 | 82 | name: Run Tests
|
| 83 | + needs: [cancel-previous, pre-commit, commit-count, test-import] |
64 | 84 | runs-on: ubuntu-latest
|
65 | 85 | strategy:
|
66 | 86 | matrix:
|
|
72 | 92 | - test-type: pytype
|
73 | 93 | python-version: 3.8
|
74 | 94 | steps:
|
75 |
| - - name: Cancel previous |
76 |
| - |
77 |
| - with: |
78 |
| - access_token: ${{ github.token }} |
79 | 95 | - uses: actions/checkout@v2
|
80 | 96 | - name: Set up Python ${{ matrix.python-version }}
|
81 | 97 | uses: actions/setup-python@v1
|
@@ -121,23 +137,3 @@ jobs:
|
121 | 137 | "description": "'$status'",
|
122 | 138 | "context": "github-actions/Build"
|
123 | 139 | }'
|
124 |
| - test-import: |
125 |
| - name: Test import standalone |
126 |
| - runs-on: ubuntu-latest |
127 |
| - strategy: |
128 |
| - matrix: |
129 |
| - python-version: [3.7, 3.8, 3.9] |
130 |
| - steps: |
131 |
| - - uses: actions/checkout@v2 |
132 |
| - - name: Set up Python ${{ matrix.python-version }} |
133 |
| - uses: actions/setup-python@v1 |
134 |
| - with: |
135 |
| - python-version: ${{ matrix.python-version }} |
136 |
| - - name: Install standalone dependencies only |
137 |
| - run: | |
138 |
| - pip install . |
139 |
| - - name: Test importing Flax |
140 |
| - run: | |
141 |
| - python -c "import flax" |
142 |
| -
|
143 |
| -
|
0 commit comments