-
Notifications
You must be signed in to change notification settings - Fork 92
160 lines (160 loc) · 5.39 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
name: Build
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
jobs:
package:
runs-on: ubuntu-latest
steps:
- name: Retrieve the source code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install build dependencies
run: |
source $CONDA/bin/activate
conda config --append channels conda-forge
conda install -y conda-build conda-verify sphinx numpydoc sphinxcontrib-autoprogram make
python -m pip install -e .
- name: Build the documentation as a test
run: |
source $CONDA/bin/activate
cd docs
make html
- name: Build the package
run: conda build conda-recipe --no-test
- name: Reduce the size of the build artifact
run: rm -rf /usr/share/miniconda/conda-bld/{git_cache,work,conda-pack*,*/.cache}
- name: Upload the build artifact
uses: actions/upload-artifact@v3
with:
name: package-${{ github.sha }}
path: /usr/share/miniconda/conda-bld
retention-days: 5
testbed:
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest,macos-latest,windows-latest]
steps:
- name: Retrieve the source code
uses: actions/checkout@v3
- id: conda-root
name: Set CONDA_ROOT
run: |
CONDA_ROOT=$(dirname $GITHUB_WORKSPACE)/conda
echo "value=$(dirname $GITHUB_WORKSPACE)/conda" >> $GITHUB_OUTPUT
echo "CONDA_ROOT=$CONDA_ROOT" >> $GITHUB_ENV
echo "CONDA_ROOT: $CONDA_ROOT"
# Use a smaller cache entry to enable a quicker exit if we
# have already built the testbed. Any small file will do
- id: cache-key
name: Retrieve cache key
uses: actions/cache@v3
with:
path: LICENSE.txt
key: key-${{ matrix.os }}-${{ hashFiles('testing') }}-5
- name: Retrieve or create the testbed cache
if: steps.cache-key.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: ${{ steps.conda-root.outputs.value }}
key: testbed-${{ matrix.os }}-${{ hashFiles('testing') }}-5
- name: Verify or create the testbed
if: steps.cache-key.outputs.cache-hit != 'true'
run: testing/setup_envs.sh purge-packages
tests:
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
needs: [package,testbed]
strategy:
fail-fast: false
matrix:
os: [macos-latest,ubuntu-latest,windows-latest]
pyver: ["3.7","3.8","3.9","3.10"]
include:
# include the appropriate dependencies for testing SquashFS on each OS
- os: macos-latest
squashfs_deps: "conda-forge::squashfs-tools"
- os: ubuntu-latest
squashfs_deps: "conda-forge::squashfs-tools conda-forge::squashfuse"
- os: windows-latest
squashfs_deps: ""
steps:
- name: Retrieve the source code
uses: actions/checkout@v3
- id: conda-root
name: Set CONDA_ROOT
run: |
CONDA_ROOT=$(dirname $GITHUB_WORKSPACE)/conda
echo "value=$(dirname $GITHUB_WORKSPACE)/conda" >> $GITHUB_OUTPUT
echo "CONDA_ROOT=$CONDA_ROOT" >> $GITHUB_ENV
echo "CONDA_ROOT: $CONDA_ROOT"
- name: Retrieve the testbed cache
uses: actions/cache@v3
with:
path: ${{ steps.conda-root.outputs.value }}
key: testbed-${{ matrix.os }}-${{ hashFiles('testing') }}-5
- name: Download the build artifact
uses: actions/download-artifact@v3
with:
name: package-${{ github.sha }}
path: conda-bld
- name: Verify or create the testbed
run: testing/setup_envs.sh
- name: Create the test environment and run the tests
run: |
source $CONDA_ROOT/etc/profile.d/conda.sh
conda info -a
mv conda-bld $CONDA_ROOT/conda-bld
conda create -n cptest local::conda-pack conda-forge::pytest conda-forge::pytest-cov python=${{ matrix.pyver }} ${{ matrix.squashfs_deps }}
conda activate cptest
pytest -v -ss --cov=conda_pack --cov-branch --cov-report=xml conda_pack/tests
- uses: codecov/codecov-action@v3
upload:
needs: tests
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Retrieve the source code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download the build artifacts
uses: actions/download-artifact@v3
with:
name: package-${{ github.sha }}
path: conda-bld
- name: Install deployment dependencies and build the docs
run: |
source $CONDA/bin/activate
conda config --append channels conda-forge
conda install -y sphinx numpydoc sphinxcontrib-autoprogram make anaconda-client
python -m pip install -e .
cd docs
make html
- name: Deploy the documentation
if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
- name: Upload to anaconda.org
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
GITHUB_REF: ${{ github.ref }}
run: |
source $CONDA/bin/activate
[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || export LABEL="--label dev"
anaconda --verbose --token $ANACONDA_TOKEN upload --user ctools $LABEL conda-bld/*/*.tar.bz2 --force