-
Notifications
You must be signed in to change notification settings - Fork 3
171 lines (169 loc) · 6.46 KB
/
main.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Build
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
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:
build:
runs-on: ubuntu-latest
steps:
- name: Retrieve the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Build the package
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
conda install conda-build
conda build conda.recipe
mv $CONDA/conda-bld .
- name: Upload build artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
if-no-files-found: error
name: conda-bld
path: conda-bld/
test:
needs: build
env:
ANACONDA_ANON_USAGE_DEBUG: 1
ANACONDA_ANON_USAGE_RAISE: 1
PYTHONUNBUFFERED: 1
defaults:
run:
# https://github.com/conda-incubator/setup-miniconda#use-a-default-shell
shell: bash -el {0} # bash exit immediately on error + login shell
strategy:
fail-fast: false
matrix:
# ubuntu-latest runs on x86_64, ubuntu-24.04-arm on arm64
# macos-13 defaults to osx-64, macos-14 defaults to osx-arm64
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-14, windows-latest]
# 23.5.2 : last patch-based variant
# 23.7.0 : first plugin-based variant, but conda info --envs --json is broken
# 23.9.0 : last variant with the classic default solver
# 23.10.0 : first variant with the libmamba default solver
cversion: ['4.11.0', '4.14.0', '22.11.1', '23.5.2', '23.7.1', '23.9.0', '23.10.0', '24.11.3', '25.1.1']
runs-on: ${{ matrix.os }}
steps:
- name: Retrieve the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Download build artfiacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: conda-bld
path: conda-bld
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1
with:
miniconda-version: 'latest'
auto-activate-base: true
activate-environment: ""
conda-solver: classic
- name: Build test environments
run: |
source $CONDA/etc/profile.d/conda.sh
conda config --add channels defaults
conda activate base
rm -rf $CONDA/conda-bld || :
mv conda-bld $CONDA/
version=$(conda search local::anaconda-anon-usage | tail -1 | awk '{print $2}')
pkg="anaconda-anon-usage=$version"
conda install -c local anaconda-client constructor $pkg
conda create -p ./testenv -c local $pkg conda==${{ matrix.cversion }} --file tests/requirements.txt
mkdir -p ./testenv/envs
conda create -p ./testenv/envs/testchild1 python --yes
conda create -p ./testenv/envs/testchild2 python --yes
if [ -f ./testenv/Scripts/conda.exe ]; then \
sed -i.bak "s@CONDA_EXE=.*@CONDA_EXE=$PWD/testenv/Scripts/conda.exe@" testenv/etc/profile.d/conda.sh; \
fi
- name: Test code
run: |
source testenv/etc/profile.d/conda.sh
conda activate base
conda info 2>&1 | tee output.txt
if grep -q 'Error loading' output.txt; then exit -1; fi
pytest
python tests/integration/test_config.py
- name: Test heartbeats (pwsh)
if: matrix.os == 'windows-latest' && (matrix.cversion == '24.11.3' || matrix.cversion == '25.1.1')
shell: pwsh
run: |
.\testenv\shell\condabin\conda-hook.ps1
conda activate base
python tests\integration\test_heartbeats.py powershell
- name: Test heartbeats (cmd)
if: matrix.os == 'windows-latest' && (matrix.cversion == '24.11.3' || matrix.cversion == '25.1.1')
shell: cmd
run: |
call .\testenv\Scripts\activate.bat
if %errorlevel% neq 0 exit 1
python tests\integration\test_heartbeats.py cmd.exe
if %errorlevel% neq 0 exit 1
- name: Test heartbeats (bash)
if: matrix.os != 'windows-latest' && (matrix.cversion == '24.11.3' || matrix.cversion == '25.1.1')
run: |
source ./testenv/bin/activate
conda info
python tests/integration/test_heartbeats.py posix
- name: Build an installer
run: |
cd tests/integration
export CONDA_PREFIX=$CONDA
bash test_installer.sh ${{ matrix.cversion }}
- name: Run the installer (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
source $CONDA/bin/activate
cd tests/integration
start /wait AIDTest-1.0-Windows-x86_64.exe /S /D=%USERPROFILE%\aidtest
call %USERPROFILE%\aidtest\Scripts\activate
conda info
- name: Run the installer (Unix)
if: matrix.os != 'windows-latest'
run: |
cd tests/integration
bash AIDTest*.sh -b -p ~/aidtest -k
source ~/aidtest/bin/activate
conda info
- name: Test the installed environment
run: |
cd tests/integration
bash test_environment.sh ~/aidtest
upload:
needs: test
runs-on: ubuntu-latest
steps:
- name: Download build artfiacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: conda-bld
path: conda-bld
- name: Upload to anaconda.org
if: github.event_name == 'push'
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
GITHUB_REF: ${{ github.ref }}
run: |
source $CONDA/bin/activate
conda install anaconda-client
[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || export LABEL="--label dev"
packages=$(ls -1 conda-bld/*/*.{tar.bz2,conda} 2>/dev/null || :)
anaconda --verbose --token $ANACONDA_TOKEN upload --user ctools $LABEL $files --force