feat: add first version of action #37
Workflow file for this run
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: tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: null | |
concurrency: | |
group: tests | |
cancel-in-progress: false | |
jobs: | |
tests-lock: | |
name: tests lock | |
runs-on: "ubuntu-latest" | |
if: github.event.pull_request.title != 'relock w/ conda-lock' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: relock | |
id: relock | |
uses: ./ | |
with: | |
environment-file: test-env.yml | |
lock-file: conda-lock.yml | |
ignored-packages: '' | |
relock-all-packages: false | |
github-token: ${{ secrets.GH_PAT }} | |
automerge: false | |
base-branch: ${{ github.head_ref }} | |
- name: did it relock? | |
if: steps.relock.outputs.relocked != 'true' | |
run: exit 1 | |
- name: test that PR is OK | |
if: steps.relock.outputs.relocked == 'true' | |
shell: bash | |
run: | | |
gh pr checkout ${{ steps.relock.outputs.pull-request-number }} | |
ls -lah | |
if [ -f conda-lock.yml ]; then | |
: # do nothing | |
else | |
echo "conda-lock.yml not found" | |
exit 1 | |
fi | |
grep numpy conda-lock.yml | |
grep python conda-lock.yml | |
env: | |
GH_TOKEN: ${{ secrets.GH_PAT }} | |
- name: close PR | |
if: always() | |
continue-on-error: true | |
shell: bash | |
run: gh pr close ${{ steps.relock.outputs.pull-request-number }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_PAT }} | |
tests-no-lock: | |
name: tests lock | |
runs-on: "ubuntu-latest" | |
if: github.event.pull_request.title != 'relock w/ conda-lock' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1 | |
with: | |
environment-name: relock-env | |
create-args: >- | |
python | |
click | |
ruamel.yaml | |
conda | |
conda-lock | |
condarc: | | |
channels: | |
- conda-forge | |
- name: make the lock file | |
shell: bash -leo pipefail {0} | |
run: | | |
conda lock --file test-env.yml --lockfile conda-lockk.yml | |
- name: relock | |
id: relock | |
uses: ./ | |
with: | |
environment-file: test-env.yml | |
lock-file: conda-lockk.yml | |
ignored-packages: '' | |
relock-all-packages: false | |
github-token: ${{ secrets.GH_PAT }} | |
automerge: false | |
base-branch: ${{ github.head_ref }} | |
- name: did it not relock? | |
if: steps.relock.outputs.relocked == 'true' | |
run: exit 1 | |
- name: close PR | |
if: always() | |
continue-on-error: true | |
shell: bash | |
run: gh pr close ${{ steps.relock.outputs.pull-request-number }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_PAT }} |