-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (133 loc) · 5.2 KB
/
integration-test.yml
File metadata and controls
154 lines (133 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Integration test
on:
schedule:
- cron: "0 0 * * *" # Run daily at midnight UTC
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
python: ["3.12", "3.13"]
is_pre: [true, false]
package:
# extras should be a comma seperated list of strings, like `extras: "lazy,accelerated"`
# The 'test' extra is always installed
- {name: "mudata", extras: ""}
- {name: "spatialdata", extras: ""}
- {name: "scirpy", extras: ""}
- {name: "muon", extras: ""}
- {name: "scanpy", extras: ""}
- {name: "squidpy", extras: ""}
- {name: "scvi-tools", extras: ""}
- {name: "pertpy", extras: "de"}
- {name: "decoupler", extras: ""}
- {name: "SnapATAC2", extras: ""}
exclude:
- { python: 3.12, is_pre: true }
defaults:
run:
shell: bash -el {0}
runs-on: ubuntu-latest
env:
# This env variable is used by the `gh` CLI
GH_TOKEN: ${{ secrets.TOKEN_FOR_ISSUE_WRITE }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: blob:none
path: integration-testing
- uses: actions/checkout@v4
with:
repository: scverse/${{ matrix.package.name }}
fetch-depth: 0
filter: blob:none
path: ${{ matrix.package.name }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install UV
uses: hynek/setup-cached-uv@v2
# For snapatac2
- name: Install rust-cache
uses: Swatinem/rust-cache@v2
- name: Install toml parsers
run: |
uv pip install --system toml-cli
- name: Install AnnData and scverse package
run: |
EXTRAS=""
GROUP=""
if toml get 'dependency-groups.test' --toml-path pyproject.toml > /dev/null; then
GROUP="--group test"
if [ -n "${{ matrix.package.extras }}" ]; then
EXTRAS="${{ matrix.package.extras }}"
fi
else
if [ -n "${{ matrix.package.extras }}" ]; then
EXTRAS="test,${{ matrix.package.extras }}"
else
EXTRAS="test"
fi
fi
uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" git+https://github.com/scverse/anndata -c ../integration-testing/constraints.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides.txt' || ''}} $GROUP -v
working-directory: ${{ matrix.package.name }}
- name: Set failure type for install
if: failure()
run: |
echo "Installation failed for ${{ matrix.package.name }}"
echo "failure_type=install" >> $GITHUB_ENV
- name: Env list
run: uv pip freeze
- name: Run test
env:
DISPLAY: :42
COLUMNS: 120
run: |
pytest
working-directory: ${{ matrix.package.name }}
- name: Set failure type for test
if: failure() && env.failure_type != 'install'
run: |
echo "Test failed for ${{ matrix.package.name }}"
echo "failure_type=test" >> $GITHUB_ENV
- name: Check for open failure issue
if: failure() && github.event_name == 'schedule'
id: find_issue
run: |
ISSUE_TITLE="Integration Testing CI ${failure_type^} Failure on python ${{ matrix.python }}${{matrix.is_pre && ' with prerelease dependencies' || ''}}"
echo "Checking for existing issue: $ISSUE_TITLE"
ISSUE_COUNT=$(gh issue list --repo scverse/${{ matrix.package.name }} --state open --search "${ISSUE_TITLE}" --json number --jq 'length')
if [[ "$ISSUE_COUNT" -gt 0 ]]; then
echo "${failure_type^} failure issue already exists for today."
echo "issue_exists=true" >> $GITHUB_ENV
else
echo "issue_exists=false" >> $GITHUB_ENV
echo "issue_title=$ISSUE_TITLE" >> $GITHUB_ENV
fi
- name: Report failure issue
if: failure() && env.issue_exists == 'false' && github.event_name == 'schedule'
run: |
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
ISSUE_BODY="The daily CI failed on ${failure_type} for ${{ matrix.package.name }} failed. Please go to [the logs of the integration testing repo](${RUN_URL}) to review. @scverse/anndata"
gh issue create --repo scverse/${{ matrix.package.name }} --title "${{ env.issue_title }}" --body "${ISSUE_BODY}"
keepalive-job:
name: Keepalive Workflow
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Re-enable workflow
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN || github.token }}
shell: sh
run: |
gh api --verbose -X PUT "repos/${GITHUB_REPOSITORY}/actions/workflows/integration-test.yml/enable"