-
Notifications
You must be signed in to change notification settings - Fork 95
136 lines (130 loc) · 4.52 KB
/
python-package-conda.yml
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
# heavily adapted from scikit-bio's CI
# https://github.com/biocore/scikit-bio/blob/31123c6471dc62f45a55bfdff59c61a4850be367/.github/workflows/ci.yml#L1
name: biom-format CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
latest_python: "3.12"
supported_pythons: '["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]'
miniforge_version: "22.9.0-2"
miniforge_variant: "Mambaforge"
jobs:
conf:
# This job is needed to route the global environment variables into
# a context that's available for matrix (and name, but that's unimportant)
name: Prepare Test Plan
runs-on: "ubuntu-latest"
outputs:
latest_python: ${{ steps.set-vars.outputs.latest_python }}
supported_pythons: ${{ steps.set-vars.outputs.supported_pythons }}
steps:
- name: Report Plan
id: set-vars
run: |
echo "latest_python=$latest_python" >> $GITHUB_OUTPUT
echo "supported_pythons=$supported_pythons" >> $GITHUB_OUTPUT
lint:
name: Lint code (${{ needs.conf.outputs.latest_python }}, ubuntu-latest)
needs: conf
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
shell: bash -l {0}
run: |
pip install -r ci/requirements.lint.txt
conda list
- name: Run linter
shell: bash -l {0}
run: make lint
doc:
name: Build Documentation (${{ needs.conf.outputs.latest_python }}, ubuntu-latest)
needs: ["conf", "lint"]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ env.latest_python }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies
shell: bash -l {0}
run: |
pip install -r ci/requirements.doc.txt
pip install .
conda list
- name: Make docs
shell: bash -l {0}
run: make doc
test-all:
name: Test (${{ matrix.python_version }}, ${{ matrix.os }}, ${{ fromJSON('["pypi", "conda"]')[matrix.use_conda] }})
needs: ["conf", "lint"]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python_version: ${{ fromJSON(needs.conf.outputs.supported_pythons) }}
use_conda: [true, false]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python_version }}
miniforge-version: ${{ env.miniforge_version }}
miniforge-variant: ${{ env.miniforge_variant }}
environment-file: ci/conda_host_env.yml
- name: Install dependencies (conda)
if: ${{ matrix.use_conda }}
shell: bash -l {0}
run: |
conda install -q --yes -c conda-forge --file ci/conda_requirements.txt
pip install . --no-deps
conda list
- name: Install dependencies (pip)
if: ${{ !matrix.use_conda }}
shell: bash -l {0}
run: |
pip install .
conda list
- name: Run unit tests
shell: bash -l {0}
run: make test
test-aarch64:
name: Test (${{ needs.conf.outputs.latest_python }}, qemu::aarch64-centos)
needs: ["conf", "lint", "doc", "test-all"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# setup-buildx-action uses the git context directly
# but checklist wants the .git directory
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and test for linux-aarch64
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
# ^ to use the local checkout, not the git context
file: aarch64.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
PYTHON_VERSION=${{ env.latest_python }}