-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (85 loc) · 2.91 KB
/
test.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
name: "test"
on:
pull_request:
branches:
- main
merge_group:
workflow_call:
jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on:
labels: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- name: Checkout
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: ${{ matrix.python-version }}
- name: Install testing dependencies
run: python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
build-conda-package:
name: Build conda package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4
with:
fetch-depth: 0
- name: Create build environment
run: |
source $CONDA/bin/activate
conda create -n build --file ./etc/build.linux-64.lock
- name: conda build
run: |
source $CONDA/bin/activate && conda activate build
mkdir -p ./conda-bld
VERSION=`hatch version` conda build -c conda-forge -c defaults --override-channels conda.recipe --output-folder ./conda-bld
- name: Upload the build artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: anaconda-cli-base-conda-${{ github.sha }}
path: ./conda-bld
if-no-files-found: error
retention-days: 7
build-wheel:
name: Build the wheel
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.10"
- name: Install build dependencies
run: pip install build
- name: Build the package
run: python -m build
- name: Upload the build artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: anaconda-cli-base-wheel-${{ github.sha }}
path: dist/*
if-no-files-found: error
retention-days: 7
# This check job runs to ensure all tests and builds have passed, such that we can use it as a "wildcard"
# for branch protection to ensure all tests pass before a PR can be merged.
check:
name: Check all tests passed
if: always()
needs: [test, build-conda-package, build-wheel]
runs-on: ubuntu-latest
steps:
- name: Decide whether all required jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}