-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (115 loc) · 3.49 KB
/
Copy pathpublish.yml
File metadata and controls
137 lines (115 loc) · 3.49 KB
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
name: Publish Conda Package
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
pytest:
name: Run Pytest Release Gate
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Run tests
run: pytest
build-and-test:
name: Build And Test Conda Package
runs-on: ubuntu-latest
env:
CHANNEL: MOMA-AUH
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: gcnvplot-build
environment-file: environment.yml
channels: conda-forge,bioconda,defaults
channel-priority: strict
use-mamba: true
- name: Install conda-build
shell: bash -l {0}
run: |
conda install -n base -y -c conda-forge conda-build
- name: Build package
shell: bash -l {0}
run: |
conda build conda-recipe/
- name: Locate built package
id: locate
shell: bash -l {0}
run: |
PKG_PATH="$(conda build conda-recipe/ --output)"
if [ -z "$PKG_PATH" ]; then
echo "No conda package path reported by conda build"
exit 1
fi
if [ ! -f "$PKG_PATH" ]; then
echo "Reported package path does not exist: $PKG_PATH"
exit 1
fi
echo "pkg_path=${PKG_PATH}" >> "$GITHUB_OUTPUT"
- name: Smoke test built package
shell: bash -l {0}
run: |
conda build --test "${{ steps.locate.outputs.pkg_path }}"
- name: Upload conda artifact
uses: actions/upload-artifact@v4
with:
name: conda-package
path: ${{ steps.locate.outputs.pkg_path }}
publish-conda:
name: Publish To Anaconda Channel
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- pytest
- build-and-test
env:
CHANNEL: MOMA-AUH
environment:
name: conda
url: https://anaconda.org/MOMA-AUH/gcnvplot
steps:
- name: Download conda artifact
uses: actions/download-artifact@v4
with:
name: conda-package
path: dist
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: gcnvplot-publish
python-version: "3.12"
- name: Install upload tooling
shell: bash -l {0}
run: |
conda install -y -c defaults anaconda-client
- name: Publish package to MOMA-AUH channel
shell: bash -l {0}
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
run: |
PKG_PATH=$(find dist -type f \( -name "*.conda" -o -name "*.tar.bz2" \) | head -n 1)
if [ -z "$PKG_PATH" ]; then
echo "No conda package found to upload"
exit 1
fi
anaconda -t "$ANACONDA_API_TOKEN" upload --user "$CHANNEL" "$PKG_PATH"