Skip to content

Commit 79fd795

Browse files
committed
Adding Anaconda build
1 parent a6d8c9e commit 79fd795

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Conda Build & Publish
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: [master, develop]
8+
tags:
9+
- "v**"
10+
release:
11+
types: [published]
12+
13+
jobs:
14+
# ---------------------------------------------------------------------------
15+
# Version sanity checks
16+
# ---------------------------------------------------------------------------
17+
check-version-strings:
18+
runs-on: ubuntu-latest
19+
container: python:3.12-slim
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install dependencies
25+
run: pip install pyyaml
26+
27+
- name: Test version strings
28+
run: python testversion.py
29+
30+
# ---------------------------------------------------------------------------
31+
# Conda build (Windows only, matrix Python versions)
32+
# ---------------------------------------------------------------------------
33+
build-conda-windows:
34+
needs: check-version-strings
35+
runs-on: windows-latest
36+
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Set up Miniconda
46+
uses: conda-incubator/setup-miniconda@v3
47+
with:
48+
auto-activate-base: false
49+
activate-environment: build
50+
python-version: ${{ matrix.python-version }}
51+
channels: conda-forge,defaults
52+
environment-file: environment.yml
53+
use-mamba: true
54+
55+
- name: Set up MSVC toolchain
56+
uses: ilammy/msvc-dev-cmd@v1
57+
with:
58+
arch: x64
59+
60+
- name: Build conda package
61+
shell: bash -l {0}
62+
run: |
63+
CONDA_BASE=$(conda info --base)
64+
mkdir -p build_artifacts
65+
conda build . \
66+
--no-include-recipe \
67+
--output-folder build_artifacts
68+
69+
- name: Upload artifacts
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: conda-windows-py${{ matrix.python-version }}
73+
path: build_artifacts/**/*
74+
if-no-files-found: error
75+
76+
# ---------------------------------------------------------------------------
77+
# Publish (runs only on tagged releases)
78+
# ---------------------------------------------------------------------------
79+
publish-conda:
80+
needs: build-conda-windows
81+
if: startsWith(github.ref, 'refs/tags/v')
82+
runs-on: ubuntu-latest
83+
84+
environment:
85+
name: anaconda
86+
url: https://anaconda.org/ifilot/pyqint
87+
88+
steps:
89+
- uses: actions/checkout@v4
90+
91+
- name: Set up Miniconda
92+
uses: conda-incubator/setup-miniconda@v3
93+
with:
94+
auto-activate-base: false
95+
activate-environment: upload
96+
use-mamba: true
97+
channels: conda-forge,defaults
98+
99+
- name: Download all artifacts
100+
uses: actions/download-artifact@v4
101+
with:
102+
path: packages
103+
104+
- name: Publish to Anaconda
105+
shell: bash -l {0}
106+
env:
107+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
108+
run: |
109+
echo "Found packages:"
110+
ls -R packages
111+
112+
# Upload everything recursively
113+
anaconda upload packages/**/*.tar.bz2

0 commit comments

Comments
 (0)