-
Notifications
You must be signed in to change notification settings - Fork 9
125 lines (112 loc) · 4.43 KB
/
tests.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
name: Tests
on:
# NOTE: github.event context is push payload:
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
push:
branches:
- main
- feature/**
# NOTE: github.event context is pull_request payload:
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
pull_request:
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
test:
name: conda-index (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
with:
python-version: ${{ matrix.python-version }}
channels: defaults
show-channel-urls: true
environment-file: tests/environment.yml
# does the fact that conda-index is now a conda-build dependency cause
# issues here, since an older version will already be installed?
- name: Source Scripts
run: |
pip install -e .[test]
conda info
pytest --cov
- name: Upload Coverage
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
with:
flags: ${{ runner.os }},${{ runner.arch }},${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }} # required
analyze:
name: Analyze test results
needs: [test]
if: always()
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
- name: Upload Combined Test Results
# provides one downloadable archive of all matrix run test results for further analysis
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
name: test-results-${{ github.sha }}-all
include-hidden-files: true
path: test-results-*
retention-days: 7 # for durations.yml workflow
- name: Test Summary
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
with:
paths: test-results-*/test-report.xml
- name: Determine Success
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
id: alls-green
with:
# permit jobs to be skipped if there are no code changes (see changes job)
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
build:
name: Canary Build
needs: [analyze]
# only build canary build if
# - prior steps succeeded,
# - this is the main repo, and
# - we are on the main (or feature) branch
if: >-
success()
&& !github.event.repository.fork
&& (
github.ref_name == 'main'
|| startsWith(github.ref_name, 'feature/')
)
runs-on: ubuntu-latest
steps:
# Clean checkout of specific git ref needed for package metadata version
# which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0
- name: Create and upload canary build
uses: conda/actions/canary-release@a46e86a61fbca7dec20c0df4c6b95ce3b4ea2263 # v25.2.0
with:
package-name: ${{ github.event.repository.name }}
subdir: noarch
anaconda-org-channel: conda-canary
anaconda-org-label: ${{ github.ref_name == 'main' && 'dev' || github.ref_name }}
anaconda-org-token: ${{ secrets.ANACONDA_ORG_CONDA_CANARY_TOKEN }}