Compile new test_package environments #125
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update_env | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "test_package/*/requirements.txt" | |
branches-ignore: | |
- "main" | |
jobs: | |
compile: | |
# We only get to this `if` statement when `requirements.txt` is part of the job's git diff. | |
# `event.commits` contains a max of 20 most recent commit messages. If it contains that many, | |
# this is either a giant branch/PR (>=20 commits) or a rebase of a very old branch. | |
if: ${{ !github.event.forced && github.event.commits[19] == null | |
&& !contains(github.event.commits.*.author.name, 'update-env') }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Compile | |
run: | | |
python -m pip install pip-tools==7.4.1 | |
python .github/workflows/update_env.py compile | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: env-${{ matrix.os }} | |
path: test_package/**/env/*.txt | |
retention-days: 1 | |
commit: | |
needs: compile | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Commit | |
run: | | |
python .github/workflows/update_env.py gather | |
git config user.name update-env | |
git config user.email [email protected] | |
git add . | |
git commit -m "Compile new test_package environments" | |
git push |