Skip to content

Commit d1de6f5

Browse files
Add option to skip slow tests in PRs (#3060) [skip ci]
* testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * testing e2e skip [skip-e2e] * stop running multigpu [skip-e2e] * should work now [skip-e2e] * reverting [skip-e2e] * testing [skip-e2e] * debug [skip-e2e] * debug [skip-e2e] * round 2[skip-e2e] * removing debug [skip-e2e] * support skipping whole PR [skip-e2e] * use script for e2e skip [skip-e2e] * contributing [skip-e2e] * contributing [skip-e2e] --------- Co-authored-by: Wing Lian <wing@axolotl.ai>
1 parent 48b7ae1 commit d1de6f5

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

.github/CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ We welcome ideas for improvements and new features. To suggest an enhancement, o
5757
5. Push your branch to your fork on GitHub.
5858
6. Open a new pull request against the `main` branch of the axolotl repository. Include a clear and concise description of your changes, referencing any related issues.
5959

60+
#### Skipping CI Checks
61+
62+
You can skip certain CI checks by including specific keywords in your commit messages:
63+
64+
- `[skip ci]` or `skip ci` - Skips all CI checks for that commit
65+
- `[skip-e2e]` or `skip-e2e` - Skips only end-to-end tests while running other CI checks. You may also include this in the title of your PR to disable end-to-end tests for the entire PR.
66+
6067
## Style Guidelines
6168

6269
### Code Style

.github/workflows/tests.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,44 @@ jobs:
188188
run: |
189189
find "$(pip cache dir)/http-v2" -type f -mtime +14 -exec rm {} \;
190190
191+
gate-skip-e2e:
192+
needs: [pre-commit, pytest, pytest-sdist]
193+
runs-on: ubuntu-latest
194+
outputs:
195+
skip: ${{ steps.compute.outputs.skip }}
196+
steps:
197+
- uses: actions/github-script@v7
198+
id: compute
199+
with:
200+
script: |
201+
const token = /\[skip-e2e\]/i;
202+
let msg = '';
203+
if (context.eventName === 'push') {
204+
msg = context.payload.head_commit?.message || '';
205+
} else if (context.eventName === 'pull_request') {
206+
const { owner, repo } = context.repo;
207+
const prNumber = context.payload.pull_request.number;
208+
const commits = await github.paginate(
209+
github.rest.pulls.listCommits,
210+
{ owner, repo, pull_number: prNumber, per_page: 100 }
211+
);
212+
msg = commits.at(-1)?.commit?.message || '';
213+
}
214+
const title = context.payload.pull_request?.title || '';
215+
const body = context.payload.pull_request?.body || '';
216+
const skip = token.test(msg) || token.test(title) || token.test(body);
217+
core.setOutput('skip', String(skip));
218+
191219
docker-e2e-tests-1st:
192220
# Run this job first as a gate for running the remainder of the test matrix
193-
if: ${{ ! contains(github.event.commits[0].message, '[skip e2e]') && github.repository_owner == 'axolotl-ai-cloud' && !github.event.pull_request.draft }}
221+
if: >
222+
github.repository_owner == 'axolotl-ai-cloud' &&
223+
(github.event_name != 'pull_request' || !github.event.pull_request.draft) &&
224+
needs.gate-skip-e2e.outputs.skip != 'true'
194225
# this job needs to be run on self-hosted GPU runners...
195226
runs-on: [self-hosted, modal]
196227
timeout-minutes: 120
197-
needs: [pre-commit, pytest, pytest-sdist]
228+
needs: [pre-commit, pytest, pytest-sdist, gate-skip-e2e]
198229

199230
strategy:
200231
fail-fast: false
@@ -240,13 +271,16 @@ jobs:
240271
modal run cicd.e2e_tests
241272
242273
docker-e2e-tests:
243-
if: ${{ github.repository_owner == 'axolotl-ai-cloud' && !github.event.pull_request.draft }}
274+
if: >
275+
github.repository_owner == 'axolotl-ai-cloud' &&
276+
(github.event_name != 'pull_request' || !github.event.pull_request.draft) &&
277+
needs.gate-skip-e2e.outputs.skip != 'true'
244278
# this job needs to be run on self-hosted GPU runners...
245279
runs-on: [self-hosted, modal]
246280
timeout-minutes: 120
247281
# Only run the remainder of the matrix if the first e2e check passed;
248282
# this is to save on wasted compute costs for known failures that get caught in the first run
249-
needs: [pre-commit, pytest, docker-e2e-tests-1st]
283+
needs: [pre-commit, pytest, gate-skip-e2e, docker-e2e-tests-1st]
250284

251285
strategy:
252286
fail-fast: false

0 commit comments

Comments
 (0)