|
| 1 | +name: Update lockfile |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + # At 06:12 UTC on Monday |
| 7 | + - cron: 12 6 * * MON |
| 8 | + |
| 9 | +jobs: |
| 10 | + conda-lock: |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + python-version: ["3.8", "3.9", "3.10"] |
| 14 | + defaults: |
| 15 | + run: |
| 16 | + # Ensure the environment is activated |
| 17 | + # <https://github.com/mamba-org/setup-micromamba#about-login-shells> |
| 18 | + shell: bash -l {0} |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Install Conda environment with Micromamba |
| 23 | + uses: mamba-org/setup-micromamba@v1 |
| 24 | + with: |
| 25 | + environment-file: conda/environment-conda-locker.yaml |
| 26 | + environment-name: conda-lock-env |
| 27 | + cache-environment: true |
| 28 | + |
| 29 | + - name: Run conda-lock |
| 30 | + run: | |
| 31 | + conda-lock lock --mamba \ |
| 32 | + --extras test \ |
| 33 | + --filter-extras \ |
| 34 | + --file pyproject.toml \ |
| 35 | + --file conda/environment-test-${{ matrix.python-version }}.yaml \ |
| 36 | + --lockfile conda/conda-lock-${{ matrix.python-version }}.yaml |
| 37 | +
|
| 38 | + - name: Upload lockfile |
| 39 | + uses: actions/upload-artifact@v4 |
| 40 | + with: |
| 41 | + name: lockfile-${{ matrix.python-version }} |
| 42 | + path: conda/conda-lock-${{ matrix.python-version }}.yaml |
| 43 | + |
| 44 | + open-pr: |
| 45 | + needs: conda-lock |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - name: Checkout repo |
| 49 | + uses: actions/checkout@v4 |
| 50 | + - name: Download all lockfiles |
| 51 | + uses: actions/download-artifact@v4 |
| 52 | + with: |
| 53 | + path: /tmp/conda |
| 54 | + - name: Replace existing lockfiles with downloaded ones |
| 55 | + run: | |
| 56 | + mv /tmp/conda/lockfile-*/* conda/ |
| 57 | + - name: Open a pull request |
| 58 | + uses: peter-evans/create-pull-request@v5 |
| 59 | + with: |
| 60 | + # This PAT should have read-write permissions for "Pull Requests" |
| 61 | + # and read-write permissions for "Contents". |
| 62 | + token: ${{ secrets.GH_PAT_FOR_PR }} |
| 63 | + commit-message: Relock dependencies |
| 64 | + title: Relock dependencies |
| 65 | + body: > |
| 66 | + This pull request relocks the dependencies with conda-lock. |
| 67 | + It was created automatically with the GitHub Action |
| 68 | + [update-lockfile.yml](.github/workflows/update-lockfile.yml). |
| 69 | + branch: relock-deps |
| 70 | + labels: conda-lock |
| 71 | + delete-branch: true |
| 72 | + committer: update-lockfile.yml <nobody@pymc-labs.com> |
| 73 | + author: update-lockfile.yml <nobody@pymc-labs.com> |
0 commit comments