diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8f67908e8..fcfd96891 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -57,6 +57,13 @@ We welcome ideas for improvements and new features. To suggest an enhancement, o 5. Push your branch to your fork on GitHub. 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. +#### Skipping CI Checks + +You can skip certain CI checks by including specific keywords in your commit messages: + +- `[skip ci]` or `skip ci` - Skips all CI checks for that commit +- `[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. + ## Style Guidelines ### Code Style diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 912b3f1d6..fe63aa313 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -188,13 +188,44 @@ jobs: run: | find "$(pip cache dir)/http-v2" -type f -mtime +14 -exec rm {} \; + gate-skip-e2e: + needs: [pre-commit, pytest, pytest-sdist] + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.compute.outputs.skip }} + steps: + - uses: actions/github-script@v7 + id: compute + with: + script: | + const token = /\[skip-e2e\]/i; + let msg = ''; + if (context.eventName === 'push') { + msg = context.payload.head_commit?.message || ''; + } else if (context.eventName === 'pull_request') { + const { owner, repo } = context.repo; + const prNumber = context.payload.pull_request.number; + const commits = await github.paginate( + github.rest.pulls.listCommits, + { owner, repo, pull_number: prNumber, per_page: 100 } + ); + msg = commits.at(-1)?.commit?.message || ''; + } + const title = context.payload.pull_request?.title || ''; + const body = context.payload.pull_request?.body || ''; + const skip = token.test(msg) || token.test(title) || token.test(body); + core.setOutput('skip', String(skip)); + docker-e2e-tests-1st: # Run this job first as a gate for running the remainder of the test matrix - if: ${{ ! contains(github.event.commits[0].message, '[skip e2e]') && github.repository_owner == 'axolotl-ai-cloud' && !github.event.pull_request.draft }} + if: > + github.repository_owner == 'axolotl-ai-cloud' && + (github.event_name != 'pull_request' || !github.event.pull_request.draft) && + needs.gate-skip-e2e.outputs.skip != 'true' # this job needs to be run on self-hosted GPU runners... runs-on: [self-hosted, modal] timeout-minutes: 120 - needs: [pre-commit, pytest, pytest-sdist] + needs: [pre-commit, pytest, pytest-sdist, gate-skip-e2e] strategy: fail-fast: false @@ -240,13 +271,16 @@ jobs: modal run cicd.e2e_tests docker-e2e-tests: - if: ${{ github.repository_owner == 'axolotl-ai-cloud' && !github.event.pull_request.draft }} + if: > + github.repository_owner == 'axolotl-ai-cloud' && + (github.event_name != 'pull_request' || !github.event.pull_request.draft) && + needs.gate-skip-e2e.outputs.skip != 'true' # this job needs to be run on self-hosted GPU runners... runs-on: [self-hosted, modal] timeout-minutes: 120 # Only run the remainder of the matrix if the first e2e check passed; # this is to save on wasted compute costs for known failures that get caught in the first run - needs: [pre-commit, pytest, docker-e2e-tests-1st] + needs: [pre-commit, pytest, gate-skip-e2e, docker-e2e-tests-1st] strategy: fail-fast: false