Skip to content

Commit e0dd5e5

Browse files
keewismathause
andauthored
import and call the env analysis script (#4)
* import the script * list the dependencies * call the script from within the action * explicitly specify the shell * quote the `envs-path` variable * try setting the input type of env-paths * try serializing to json * quote the input * missing shell * correct the input name * print the decoded paths * typo * use the right function names * unquote * try using `join` * remove debug step * allow expected failures * add test env files * compare strings instead * pass expected failure as a list * another failing example * show the status of the current dir * more debugging * print the content of `envs` * rename `env1` * use a existing version of `pandas` * use an existing version of `packaging` * enforce a column width of 120 * proper syntax * try setting in a different place * remove debug step * enforce colors * remove the `always` * split up into smaller steps * don't cancel in-progress jobs when others fail * cancel duplicate workflow runs * continue if the action fails * more output * tests for `Spec.parse` * always set the pass status * check the output of the status functions * consolidate into a single step * continue on error * some more adjustments * fix the `xfail` * Apply suggestions from code review Co-authored-by: Mathias Hauser <[email protected]> * expect pypi-compliant versions * extend the inexact versions warning * add and fix tests for `Policy.minimum_version` --------- Co-authored-by: Mathias Hauser <[email protected]>
1 parent e17bd4e commit e0dd5e5

File tree

8 files changed

+487
-2
lines changed

8 files changed

+487
-2
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ on:
55
pull_request:
66
branches: [main]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
ci:
1014
name: tests
1115
runs-on: [ubuntu-latest]
1216
strategy:
17+
fail-fast: false
1318
matrix:
1419
python-version: ["3.10", "3.11", "3.12", "3.13"]
1520

@@ -36,16 +41,51 @@ jobs:
3641
runs-on: [ubuntu-latest]
3742

3843
strategy:
44+
fail-fast: false
3945
matrix:
4046
env-paths:
4147
- ["envs/env1.yaml"]
4248
- ["envs/env2.yaml"]
4349
- ["envs/env1.yaml", "envs/env2.yaml"]
50+
expected-failure: ["false"]
51+
include:
52+
- env-paths: ["envs/failing-env1.yaml"]
53+
expected-failure: "true"
54+
- env-paths: ["envs/env1.yaml", "envs/failing-env1.yaml"]
55+
expected-failure: "true"
4456

4557
steps:
4658
- name: clone the repository
4759
uses: actions/checkout@v4
4860
- name: run action
4961
uses: ./
62+
id: action-run
63+
continue-on-error: true
5064
with:
51-
environment-paths: ${{ matrix.env-paths }}
65+
environment-paths: "${{ toJSON(matrix.env-paths) }}"
66+
- name: detect outcome
67+
if: always()
68+
shell: bash -l {0}
69+
run: |
70+
if [[ "${{ steps.action-run.outcome }}" == "success" && ${{ matrix.expected-failure }} == "true" ]]; then
71+
# unexpected pass
72+
echo "workflow xpassed"
73+
export STATUS=1
74+
elif [[ "${{ steps.action-run.outcome }}" == "failure" && ${{ matrix.expected-failure }} == "false" ]]; then
75+
# unexpected failure
76+
echo "workflow failed"
77+
export STATUS=2
78+
elif [[ "${{ steps.action-run.outcome }}" == "success" && ${{ matrix.expected-failure }} == "false" ]]; then
79+
# normal pass
80+
echo "workflow passed"
81+
export STATUS=0
82+
elif [[ "${{ steps.action-run.outcome }}" == "failure" && ${{ matrix.expected-failure }} == "true" ]]; then
83+
# expected failure
84+
echo "workflow xfailed"
85+
export STATUS=0
86+
else
87+
# cancelled
88+
echo "workflow cancelled"
89+
export STATUS=3
90+
fi
91+
exit $STATUS

action.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,21 @@ inputs:
66
description: >-
77
The paths to the environment files
88
required: True
9+
type: string
910
outputs: {}
1011

1112
runs:
1213
using: "composite"
13-
steps: {}
14+
15+
steps:
16+
- name: install dependencies
17+
shell: bash -l {0}
18+
run: |
19+
python -m pip install -r requirements.txt
20+
- name: analyze environments
21+
shell: bash -l {0}
22+
env:
23+
COLUMNS: 120
24+
FORCE_COLOR: 3
25+
run: |
26+
python minimum_versions.py ${{ join(fromJSON(inputs.environment-paths), ' ') }}

envs/env1.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
channels:
2+
- conda-forge
3+
dependencies:
4+
- python=3.10
5+
- numpy=1.24
6+
- pandas=2.1
7+
- packaging=23.1

envs/env2.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
channels:
2+
- conda-forge
3+
dependencies:
4+
- python=3.10
5+
- numpy=1.23
6+
- xarray=2023.10.0
7+
- dask=2023.10.0
8+
- distributed=2023.10.0

envs/failing-env1.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
channels:
2+
- conda-forge
3+
dependencies:
4+
- python=3.11
5+
- numpy=2.1
6+
- pandas=2.2.1

0 commit comments

Comments
 (0)