-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (85 loc) · 3.47 KB
/
deploy-conda.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
name: deploy-conda
on:
push:
branches:
- main
release:
types:
- published
jobs:
build_conda:
runs-on: ubuntu-latest
name: Publish to Conda
strategy:
fail-fast: false
# To upload to PyPI on every tag starting with 'v', use the following:
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# To publish to pypi on each GitHub Release, use the following:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: true
- name: Build and upload package
shell: bash -el {0}
run: |
# conda update -y -n base conda
# conda install -y -n base conda-libmamba-solver
# conda config --set solver libmamba
conda install -y conda-build anaconda-client
conda config --set anaconda_upload yes
export PATH=$(conda info --root):$PATH
export PATH=$(conda info --root)/bin:$PATH
conda-build --output-folder . . -c conda-forge
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
test_conda:
needs: [build_conda]
name: Test on ${{ matrix.os }} and Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
steps:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: myenv
- name: Checkout
uses: actions/checkout@v3
# Move source to avoid import from local folder
- name: Rename source
run: |
mv restoreio restoreio-DoNotImport
rm setup.cfg
# This is to prevent the error "libomp is already initialized",
# which occurs only in MacOS. To circumvent the error, the
# following script will remove libomp.dylib from imate package, and
# copies libomp.dylib from restoreio to imate package.
# - name: Test (MacOS)
# if: matrix.os == 'macos-latest'
# run: |
# export PATH=$(conda info --root):$PATH
# export PATH=$(conda info --root)/bin:$PATH
# conda install -c s-ameli restoreio -y
# conda install pytest -y
# chmod +x scripts/fix_libomp.sh
# ./scripts/fix_libomp.sh "$(conda info --root)/bin/python"
# pytest
# shell: bash
# - name: Test (Linux, Windows)
# if: matrix.os != 'macos-latest'
- name: Test
shell: bash -l {0}
run: |
conda install -c conda-forge -c s-ameli restoreio -y
conda install pytest -y
pytest