Skip to content

Commit 79885b7

Browse files
committed
Add download and testing of conda packages
1 parent ad5dcb9 commit 79885b7

File tree

1 file changed

+44
-88
lines changed

1 file changed

+44
-88
lines changed

.github/workflows/build-and-release.yml

Lines changed: 44 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929
build-windows:
3030
strategy:
3131
matrix:
32-
python_version: ['3.7', '3.8', '3.9', '3.10']
32+
python_version: ['3.9', '3.10']
33+
3334
runs-on: windows-2019
3435

3536
steps:
@@ -39,111 +40,55 @@ jobs:
3940
with:
4041
auto-update-conda: true
4142
python-version: ${{ matrix.python_version }}
43+
conda-build-version: ${{ env.conda_build_version }}
44+
45+
- name: Inspect Conda Environment
46+
run: |
47+
which python
48+
conda list
49+
conda info --all
4250
- name: Add scripts path
4351
run: echo "$env:CONDA\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
44-
- name: Updating conda-build...
45-
shell: cmd
46-
run: |
47-
# on Windows conda is a bat file that will exit it not "CALL"'d
48-
# https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#using-conda-in-windows-batch-script-exits-early
49-
call activate
50-
call conda update --yes conda
51-
call conda install --yes conda-build
52-
call conda create --yes --quiet --name bld --no-default-packages
53-
call conda install --yes --name bld conda-build=${{ env.conda_build_version }}
5452
- name: Building...
5553
shell: cmd
5654
run: |
57-
call activate bld
5855
call conda build --no-build-id --python "${{ matrix.python_version }}" --output-folder channel recipe
5956
- name: Publishing artifact...
6057
uses: actions/upload-artifact@v3
6158
with:
6259
path: "channel/*/simpleitk*.tar.bz2"
6360

64-
build-linux:
61+
artifact-test:
62+
runs-on: windows-2019
63+
needs: build-windows
6564
strategy:
6665
matrix:
67-
python_version: ['3.7', '3.8', '3.9', '3.10']
68-
runs-on: ubuntu-latest
69-
steps:
70-
- uses: actions/checkout@v3
71-
name: Checkout
66+
python_version: ['3.9', '3.10']
7267

73-
- name: Add conda to PATH
74-
shell: bash
75-
run: echo "$CONDA/bin" >> $GITHUB_PATH
68+
steps:
69+
- uses: actions/download-artifact@v3
70+
- name: Verify files
71+
run: ls -LR
72+
- name: Add Conda
73+
uses: conda-incubator/setup-miniconda@v2
74+
with:
75+
auto-update-conda: true
76+
python-version: ${{ matrix.python_version }}
77+
conda-build-version: ${{ env.conda_build_version }}
7678

77-
- name: "Creating updated environment with conda-build..."
78-
shell: bash
79-
run: |
80-
source activate
81-
conda update --yes conda
82-
conda create --yes --quiet --name bld --no-default-packages
83-
conda install --yes --name bld conda-build
84-
85-
- name: "Building conda package..."
86-
shell: bash
87-
run: |
88-
set -x
89-
source activate bld
90-
conda build --python ${{ matrix.python_version }} --output-folder channel recipe
91-
- uses: actions/upload-artifact@v3
92-
with:
93-
path: "${{github.workspace}}/channel/*/simpleitk*.tar.bz2"
79+
- name: Inspect Conda Environment
80+
run: |
81+
which python
82+
conda list
83+
conda info --all
84+
- name: Test Install
85+
run: |
86+
conda list
87+
conda info --all
88+
conda install --channel . simpleitk
9489
95-
build-mac:
96-
strategy:
97-
matrix:
98-
python_version: ['3.7', '3.8', '3.9', '3.10']
99-
env:
100-
MACOSX_SDK: '10.10'
101-
MACOSX_DEPLOYMENT_TARGET: '10.9'
102-
runs-on: macos-11
103-
steps:
104-
- uses: actions/checkout@v3
105-
name: Checkout
106-
- name: Take ownership of conda installation
107-
run: sudo chown -R $USER $CONDA
108-
shell: bash
109-
- name: Add conda to PATH
110-
shell: bash
111-
run: echo "$CONDA/bin" >> $GITHUB_PATH
112-
- name: "Creating updated environment with conda-build..."
113-
shell: bash
114-
run: |
115-
set -x
116-
sudo xcode-select --switch /Applications/Xcode_11.7.0.app
117-
xcode-select -p
11890
119-
# https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html?highlight=CONDA_BUILD_SYSROOT#macos-sdk
120-
echo "Downloading ${MACOSX_SDK} sdk"
121-
curl -L -O https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX${MACOSX_SDK}.sdk.tar.xz
122-
tar -xf MacOSX${MACOSX_SDK}.sdk.tar.xz -C "$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs"
12391
124-
# path autoloaded: https://docs.conda.io/projects/conda-build/en/latest/resources/variants.html#creating-conda-build-variant-config-files
125-
cat << EOF >> ~/conda_build_config.yml
126-
CONDA_BUILD_SYSROOT:
127-
- $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${MACOSX_SDK}.sdk
128-
MACOSX_DEPLOYMENT_TARGET:
129-
- ${MACOSX_DEPLOYMENT_TARGET}
130-
EOF
131-
132-
source activate
133-
conda update --yes conda
134-
conda create --yes --quiet --name bld --no-default-packages
135-
conda install --yes --name bld conda-build
136-
- name: "Building conda package..."
137-
shell: bash
138-
run: |
139-
export PYTHONUNBUFFERED=1
140-
set -x
141-
source activate bld
142-
conda build --python ${{ matrix.python_version }} --output-folder channel recipe
143-
- uses: actions/upload-artifact@v3
144-
with:
145-
path: "${{github.workspace}}/channel/*/simpleitk*.tar.bz2"
146-
14792
publish:
14893
environment:
14994
name: release
@@ -156,6 +101,17 @@ jobs:
156101
- name: Verify files
157102
run: ls -LR
158103

104+
- name: Setup conda environment with mambaforge
105+
uses: conda-incubator/setup-miniconda@v2
106+
with:
107+
use-mamba: true
108+
activate-environment: ptac-dev
109+
python-version: ${{ matrix.python-version }}
110+
condarc-file: ${{ matrix.condarc-file }}
111+
environment-file: ${{ matrix.environment-file }}
112+
miniforge-variant: ${{ matrix.miniforge-variant }}
113+
miniforge-version: ${{ matrix.miniforge-version }}
114+
159115
- name: Add conda to PATH
160116
shell: bash
161117
run: echo "$CONDA/bin" >> $GITHUB_PATH

0 commit comments

Comments
 (0)