-
Notifications
You must be signed in to change notification settings - Fork 3
174 lines (172 loc) · 6 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
172
173
174
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:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Retrieve the source code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 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 --no-test
mv $CONDA/conda-bld .
- name: Upload build artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
with:
if-no-files-found: error
name: cb-${{ matrix.os }}
path: conda-bld/
test:
needs: build
env:
ANACONDA_ANON_USAGE_DEBUG: 1
ANACONDA_ANON_USAGE_RAISE: 1
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
cversion: ['4.11.0', '4.14.0', '23.7.3', '23.5.2', '23.3.1', '23.1.0', '22.11.1']
runs-on: ${{ matrix.os }}
steps:
- name: Retrieve the source code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0
- name: Download build artfiacts (Unix)
if: matrix.os != 'windows-latest'
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
with:
name: cb-ubuntu-latest
path: conda-bld
- name: Download build artfiacts (Windows)
if: matrix.os == 'windows-latest'
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
with:
name: cb-windows-latest
path: conda-bld
- name: Build test environments
run: |
rm -rf $CONDA/conda-bld || :
mv conda-bld $CONDA/
source $CONDA/etc/profile.d/conda.sh
conda activate base
version=$(conda search local::anaconda-anon-usage | tail -1 | awk '{print $2}')
pkg="anaconda-anon-usage=$version"
conda install -c local -vvv anaconda-client constructor $pkg
if [[ "${{ matrix.cversion }}" == 23.7.* ]]; then
mamba=conda-libmamba-solver
echo "MAMBA=yes" >> "$GITHUB_ENV"
fi
conda create -p ./testenv -c local $pkg conda==${{ matrix.cversion }} $mamba --file tests/requirements.txt
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 environments (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
call testenv\Scripts\activate
conda info 1>output.txt 2>&1 | type output.txt
find "Error loading" output.txt >nul
if %errorlevel% equ 0 exit -1
conda create -n testchild1 --yes
conda create -n testchild2 --yes
python tests\integration\test_config.py
if "%MAMBA%" equ "yes" (
conda config --set solver libmamba
python tests\integration\test_config.py
conda config --set solver classic
)
- name: Test code (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
call testenv\Scripts\activate
pytest
- name: Test environments (Unix)
if: matrix.os != 'windows-latest'
run: |
source ./testenv/bin/activate
conda info 2>&1 | tee output.txt
if grep -q 'Error loading' output.txt; then exit -1; fi
python tests/integration/test_config.py
if [ "$MAMBA" = "yes" ]; then
conda config --set solver libmamba
python tests/integration/test_config.py
conda config --set solver classic
fi
- name: Test code (Unix)
if: matrix.os != 'windows-latest'
run: |
source ./testenv/bin/activate
pytest
- 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: |
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 package
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
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"
anaconda --verbose --token $ANACONDA_TOKEN upload --user ctools $LABEL conda-bld/*/*.tar.bz2 --force