Skip to content

Commit 2d967c4

Browse files
committed
fix gedidb-contrib/ci-trigger@v1 action
1 parent f250890 commit 2d967c4

File tree

1 file changed

+113
-35
lines changed

1 file changed

+113
-35
lines changed

.github/workflows/ci.yaml

Lines changed: 113 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
name: CI Pipeline
2-
1+
name: CI
32
on:
43
push:
54
branches:
65
- "main"
7-
- "staging"
8-
- "documentation"
96
pull_request:
107
branches:
118
- "main"
12-
- "staging"
13-
- "documentation"
14-
workflow_dispatch: # Allows manual triggering
9+
workflow_dispatch: # allows you to trigger manually
1510

1611
concurrency:
1712
group: ${{ github.workflow }}-${{ github.ref }}
1813
cancel-in-progress: true
1914

2015
env:
21-
FORCE_COLOR: 3 # Enables colored output
16+
FORCE_COLOR: 3
2217

2318
jobs:
2419
detect-ci-trigger:
25-
name: Detect CI Trigger
20+
name: detect ci trigger
2621
runs-on: ubuntu-latest
22+
if: |
23+
github.repository == 'gedidb'
24+
&& (github.event_name == 'push' || github.event_name == 'pull_request')
25+
outputs:
26+
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
2727
steps:
2828
- uses: actions/checkout@v4
2929
with:
@@ -32,55 +32,132 @@ jobs:
3232
id: detect-trigger
3333
with:
3434
keyword: "[skip-ci]"
35-
outputs:
36-
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
37-
3835
test:
39-
name: ${{ matrix.os }} | py${{ matrix.python-version }}
36+
name: ${{ matrix.os }} py${{ matrix.python-version }} ${{ matrix.env }}
4037
runs-on: ${{ matrix.os }}
4138
needs: detect-ci-trigger
4239
if: needs.detect-ci-trigger.outputs.triggered == 'false'
40+
env:
41+
ZARR_V3_EXPERIMENTAL_API: 1
42+
defaults:
43+
run:
44+
shell: bash -l {0}
4345
strategy:
4446
fail-fast: false
4547
matrix:
4648
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
47-
python-version: ["3.8", "3.10", "3.12"]
48-
49+
# Bookend python versions
50+
python-version: ["3.10", "3.13"]
51+
env: [""]
52+
include:
53+
# Minimum python version:
54+
- env: "bare-minimum"
55+
python-version: "3.10"
56+
os: ubuntu-latest
57+
- env: "min-all-deps"
58+
python-version: "3.10"
59+
os: ubuntu-latest
60+
# Latest python version:
61+
- env: "all-but-numba"
62+
python-version: "3.13"
63+
os: ubuntu-latest
64+
- env: "all-but-dask"
65+
python-version: "3.12"
66+
os: ubuntu-latest
67+
- env: "flaky"
68+
python-version: "3.13"
69+
os: ubuntu-latest
4970
steps:
50-
- name: Checkout Code
51-
uses: actions/checkout@v4
71+
- uses: actions/checkout@v4
5272
with:
53-
fetch-depth: 0
73+
fetch-depth: 0 # Fetch all history for all branches and tags.
74+
- name: Set environment variables
75+
run: |
76+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
5477
55-
- name: Setup Python Environment
56-
uses: actions/setup-python@v5
78+
if [[ ${{ matrix.os }} == windows* ]] ;
79+
then
80+
if [[ ${{ matrix.python-version }} != "3.14" ]]; then
81+
echo "CONDA_ENV_FILE=ci/requirements/environment-windows.yml" >> $GITHUB_ENV
82+
else
83+
echo "CONDA_ENV_FILE=ci/requirements/environment-windows-3.14.yml" >> $GITHUB_ENV
84+
fi
85+
elif [[ "${{ matrix.env }}" != "" ]] ;
86+
then
87+
if [[ "${{ matrix.env }}" == "flaky" ]] ;
88+
then
89+
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
90+
echo "PYTEST_ADDOPTS=-m 'flaky or network' --run-flaky --run-network-tests -W default" >> $GITHUB_ENV
91+
else
92+
echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV
93+
fi
94+
if [[ "${{ matrix.env }}" == "min-all-deps" ]] ;
95+
then
96+
# Don't raise on warnings
97+
echo "PYTEST_ADDOPTS=-W default" >> $GITHUB_ENV
98+
fi
99+
else
100+
if [[ ${{ matrix.python-version }} != "3.14" ]]; then
101+
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
102+
else
103+
echo "CONDA_ENV_FILE=ci/requirements/environment-3.14.yml" >> $GITHUB_ENV
104+
fi
105+
fi
106+
107+
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
108+
109+
- name: Setup micromamba
110+
uses: mamba-org/setup-micromamba@v2
57111
with:
58-
python-version: ${{ matrix.python-version }}
59-
cache: "pip"
112+
environment-file: ${{ env.CONDA_ENV_FILE }}
113+
environment-name: gedidb-tests
114+
cache-environment: true
115+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
116+
create-args: >-
117+
python=${{matrix.python-version}}
118+
119+
# We only want to install this on one run, because otherwise we'll have
120+
# duplicate annotations.
121+
- name: Install error reporter
122+
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.12'
123+
run: |
124+
python -m pip install pytest-github-actions-annotate-failures
60125
61-
- name: Install Dependencies
126+
- name: Install gedidb
62127
run: |
63-
python -m pip install --upgrade pip
64-
python -m pip install --no-cache-dir -e .
65-
python -m pip install pytest pytest-cov flake8 pytest-xdist
128+
python -m pip install --no-deps -e .
66129
67-
- name: Run Linting (Flake8)
68-
run: flake8 gedidb
130+
- name: Version info
131+
run: |
132+
python gedidb/utils/print_versions.py
69133
70-
- name: Run Tests
134+
- name: Import gedidb
71135
run: |
72-
pytest -n 4 --timeout=180 \
73-
--cov=gedidb --cov-branch --cov-report=xml --cov-report=term \
136+
python -c "import gedidb"
137+
138+
- name: Restore cached hypothesis directory
139+
uses: actions/cache@v4
140+
with:
141+
path: .hypothesis/
142+
key: cache-hypothesis
143+
enableCrossOsArchive: true
144+
save-always: true
145+
146+
- name: Run tests
147+
run: python -m pytest -n 4
148+
--timeout 180
149+
--cov=gedidb
150+
--cov-report=xml
74151
--junitxml=pytest.xml
75152

76-
- name: Upload Test Results
153+
- name: Upload test results
77154
if: always()
78155
uses: actions/upload-artifact@v4
79156
with:
80-
name: Test Results (${{ matrix.os }} - py${{ matrix.python-version }})
157+
name: Test results for ${{ runner.os }}-${{ matrix.python-version }} ${{ matrix.env }}
81158
path: pytest.xml
82159

83-
- name: Upload Code Coverage to Codecov
160+
- name: Upload code coverage to Codecov
84161
uses: codecov/codecov-action@v5.3.1
85162
env:
86163
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -94,8 +171,9 @@ jobs:
94171
event_file:
95172
name: "Event File"
96173
runs-on: ubuntu-latest
174+
if: github.repository == 'gedidb'
97175
steps:
98-
- name: Upload GitHub Event File
176+
- name: Upload
99177
uses: actions/upload-artifact@v4
100178
with:
101179
name: Event File

0 commit comments

Comments
 (0)