-
Notifications
You must be signed in to change notification settings - Fork 5
181 lines (179 loc) · 6.49 KB
/
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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
name: Conda Packages
on:
workflow_dispatch:
inputs:
release-channel:
type: choice
default: khiops-dev
options: [khiops-dev, khiops]
description: Anaconda channel to release
push:
tags: ['*']
pull_request:
paths:
- packaging/conda/**
- '!packaging/conda/README.md'
- .github/workflows/conda.yml
defaults:
run:
shell: bash -el {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref
}}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
os-family: linux
- os: windows-2022
os-family: windows
- os: macos-13
os-family: macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest
python-version: '3.12'
- name: Install Dependency Requirements for Building Conda Packages
run: conda install conda-build conda-verify
- name: Put the Khiops Conda version in the environment
shell: bash
run: |
# Obtain the Khiops version
if [[ "${{ github.ref_type }}" == "tag" ]]
then
KHIOPS_RAW_VERSION="${{ github.ref_name }}"
else
KHIOPS_RAW_VERSION="$(./scripts/khiops-version)"
fi
# The conda version cannot have '-' as a character so we eliminate it
echo "KHIOPS_VERSION=$(echo $KHIOPS_RAW_VERSION | sed 's/-//')" >> "$GITHUB_ENV"
- name: Build conda packages (Windows)
if: runner.os == 'Windows'
run: conda build --output-folder khiops-conda ./packaging/conda
# In Linux/macOS we need the conda-forge channel to install their pinned versions
- name: Build conda packages (Linux/macOS)
if: runner.os != 'Windows'
run: conda build --channel conda-forge --output-folder khiops-conda ./packaging/conda
- name: Upload conda packages artifact
uses: actions/upload-artifact@v4
with:
name: khiops-conda-${{ matrix.os-family }}
path: ./khiops-conda
retention-days: 7
# Test Conda package on brand new environments
test:
needs: build
strategy:
fail-fast: false
matrix:
env:
- {os: ubuntu-20.04, os-family: linux}
- {os: ubuntu-22.04, os-family: linux}
- {os: windows-2019, os-family: windows}
- {os: windows-2022, os-family: windows}
- {os: macos-11, os-family: macos}
- {os: macos-12, os-family: macos}
- {os: macos-13, os-family: macos}
runs-on: ${{ matrix.env.os }}
steps:
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest # needed for macOS 13
python-version: ${{ matrix.python-version }}
- name: Download Conda Package Artifact
uses: actions/download-artifact@v4
with:
name: khiops-conda-${{ matrix.env.os-family }}
path: khiops-conda
- name: Install the Conda package (Windows)
if: runner.os == 'Windows'
run: conda install -c ./khiops-conda/ khiops-core
# In Linux/macOS we need the conda-forge channel to install their pinned versions
- name: Install the Conda package (Linux/macOS)
if: runner.os != 'Windows'
run: conda install -c conda-forge -c ./khiops-conda/ khiops-core
- name: Test that the executables are installed
run: |
MODL -v
MODL_Coclustering -v
# Release is only executed on tags
# Note: For this job to work the secrets variables KHIOPS_ANACONDA_CHANNEL_TOKEN and
# KHIOPS_DEV_ANACONDA_CHANNEL_TOKEN must be set with valid anaconda.org access tokens
release:
if: github.ref_type == 'tag'
needs: test
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
# See the upload-artifact step in the build job for the explanation of this pattern
path: ./khiops-conda
pattern: khiops-conda-*
merge-multiple: true
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest
python-version: '3.12'
- name: Install requirement packages
run: conda install -y anaconda-client conda-index
- name: Reindex the package directory
run: python -m conda_index ./khiops-conda
- name: Upload the packages to anaconda.org
run: |
# Set the anaconda.org channel
ANACONDA_CHANNEL="${{ inputs.release-channel || 'khiops-dev' }}"
# For the release channel: upload without forcing
if [[ "$ANACONDA_CHANNEL" == "khiops" ]]
then
anaconda --token "${{ secrets.KHIOPS_ANACONDA_CHANNEL_TOKEN }}" upload \
--user "$ANACONDA_CHANNEL" ./khiops-conda/*/*.tar.bz2
# For the dev channel: upload with forcing
else
anaconda --token "${{ secrets.KHIOPS_DEV_ANACONDA_CHANNEL_TOKEN }}" upload \
--user "$ANACONDA_CHANNEL" --force ./khiops-conda/*/*.tar.bz2
fi
- name: Extract package version
run: |
PKG_VERSION=$(\
conda search --override-channels --channel ./khiops-conda/ khiops-core \
| awk '!/#|channels/ {print $2}' \
| sort -u \
)
echo "PKG_VERSION=$PKG_VERSION" >> "$GITHUB_ENV"
- name: Create the release zip archive
uses: thedoctor0/[email protected]
with:
type: zip
path: ./khiops-conda/
filename: khiops-${{ env.PKG_VERSION }}-conda.zip
- name: Upload conda package artifacts for all platforms
uses: actions/upload-artifact@v4
with:
name: khiops-conda-all
path: ./khiops-${{ env.PKG_VERSION }}-conda.zip
- name: Release the zip archive
uses: ncipollo/release-action@v1
with:
allowUpdates: true
body: |
**This release is for testing purporses only and there is no support for it.**
**Go to https://khiops.org to install the latest supported version.**
draft: false
makeLatest: false
prerelease: true
updateOnlyUnreleased: true