-
Notifications
You must be signed in to change notification settings - Fork 26
132 lines (119 loc) · 4.66 KB
/
package.yml
File metadata and controls
132 lines (119 loc) · 4.66 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
name: conda-package
on:
push:
branches: [ master ]
tags: ["*"]
pull_request:
branches: [ master ]
jobs:
package:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Linux",
os: ubuntu-latest
}
- {
name: "MacOSX",
os: macos-15-intel
}
- {
name: "Windows",
os: windows-latest
}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install conda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.11
activate-environment: hexrd
auto-activate-base: false
- name: Install build requirements
run: |
# Change default solver to be libmamba, so that it runs much faster
conda install -n base --override-channels -c conda-forge conda-libmamba-solver
conda config --set solver libmamba
conda activate hexrd
conda install --override-channels -c conda-forge anaconda-client conda-build conda
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate
# command works.
shell: bash -l {0}
- name: Build the package (host)
if: ${{ matrix.config.name != 'Linux' }}
env:
CONDA_OVERRIDE_OSX: '11.0'
MACOSX_DEPLOYMENT_TARGET: '11.0'
run: |
conda activate hexrd
# For some reason, we need to set this in the environment as well.
# It seems conda build sometimes needs the solver in the environment
# and sometimes in the base environment. I don't know why.
conda install --override-channels -c conda-forge conda-libmamba-solver
conda config --env --set solver libmamba
conda config --set conda_build.pkg_format 1 # force tar.bz2 files
conda list
mkdir output
# Conda build is ignoring the .condarc for some reason, so we need to
# set this environment variable instead.
# Setting this variable via `env` did not seem to work for some reason.
export CONDA_SOLVER=libmamba
# Retry conda build up to N times to handle transient checksum
# mismatch failures caused by stale cached repodata.
max_attempts=5
for attempt in $(seq 1 $max_attempts); do
echo "conda build attempt $attempt"
conda clean --all -y
if conda build --override-channels -c conda-forge --output-folder output/ conda.recipe/; then
break
fi
if [ "$attempt" -eq "$max_attempts" ]; then
echo "conda build failed after $max_attempts attempts"
exit 1
fi
echo "Attempt $attempt failed, retrying..."
done
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate
# command works.
shell: bash -l {0}
- name: Build the package (container)
if: ${{ matrix.config.name == 'Linux' }}
# AlmaLinux 8 is used for manylinux_2_28 support. This supports glibc
# 2.28 and later, which supports linux OS's starting in August 2018.
# AlmaLinux 8 will be supported with security updates until 2029.
uses: docker://almalinux:8
with:
entrypoint: /github/workspace/.github/workflows/container_build.sh
- name: Upload the package to anaconda channel (tag push to master)
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
conda activate hexrd
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --force --user HEXRD output/**/*.tar.bz2
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate
# command works.
shell: bash -l {0}
- name: Upload the package to anaconda prerelease channel (upload push to master)
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
conda activate hexrd
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --force --user HEXRD --label prerelease output/**/*.tar.bz2
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate
# command works.
shell: bash -l {0}
- name: Get version for the artifact names
run: echo "HEXRD_GIT_DESCRIBE=$(git describe --tag)" >> $GITHUB_ENV
- name: Upload the package to github
uses: actions/upload-artifact@v4
with:
name: HEXRD-${{ matrix.config.name }}-${{ env.HEXRD_GIT_DESCRIBE }}.tar.bz2
path: output/**/*.tar.bz2