-
Notifications
You must be signed in to change notification settings - Fork 9
193 lines (187 loc) · 5.95 KB
/
build-and-test.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
182
183
184
185
186
187
188
189
190
191
192
193
name: Build and test installer
on:
push:
# Only build for pushes to branches
branches:
- main
tags-ignore:
- '**'
pull_request:
branches:
- main
schedule:
- cron: '6 2 * * *'
workflow_dispatch:
jobs:
build-installer:
name: Build installer
if: github.repository == 'DIRACGrid/DIRACOS2'
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
target_arch: ["linux-64", "linux-aarch64", "linux-ppc64le", "osx-arm64", "osx-64"]
steps:
- uses: actions/checkout@v3
- id: get-date
run: echo "year-and-week=$(date +"%Y-W%U")" >> $GITHUB_OUTPUT
shell: bash
- name: Keep constructor cache between invocations
# This is big help to avoid needing to transmuting packages every time
id: cache-transmuted-packages
uses: actions/cache@v3
with:
path: ~/.conda/constructor
key: ${{ runner.os }}-${{ matrix.target_arch }}-constructor-${{ steps.get-date.outputs.year-and-week }}
- name: Prepare environment
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: scripts/environment.yml
miniforge-variant: Mambaforge
use-mamba: true
- name: Create installer
run: |
CONDA_SUBDIR=${{ matrix.target_arch }} mamba create --name constructor-${{ matrix.target_arch }} 'micromamba>=0.22'
CONDA_STANDALONE_PATH="$(conda info --envs | grep constructor-${{ matrix.target_arch }} | sed -E 's@([^ ]+ +)@@g')/bin/micromamba"
pip install git+http://github.com/conda/[email protected]
if [ "${{ matrix.target_arch }}" = osx-64 ]; then
export CONDA_OVERRIDE_OSX=10.12
elif [ "${{ matrix.target_arch }}" = linux-64 ]; then
export CONDA_OVERRIDE_GLIBC=2.17
fi
CONDA_SUBDIR=${{ matrix.target_arch }} constructor . --platform="${{ matrix.target_arch }}" --conda-exe="${CONDA_STANDALONE_PATH}"
- name: Upload installer
uses: actions/upload-artifact@v3
with:
name: installer-${{ matrix.target_arch }}
path: DIRACOS-*.sh
get-info:
name: Create environment.yaml
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ubuntu-latest
strategy:
matrix:
target_arch: ["linux-64"]
steps:
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-${{ matrix.target_arch }}
- name: Generate environment.yaml
run: |
bash DIRACOS-*.sh
source diracos/diracosrc
conda env export --file environment.yaml --prefix $DIRACOS
- name: Upload environment.yaml
uses: actions/upload-artifact@v3
with:
name: environment-yaml-${{ matrix.target_arch }}
path: |
environment.yaml
release-notes:
name: Show release notes and diff
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: get-info
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Prepare environment
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: scripts/environment.yml
miniforge-variant: Mambaforge
use-mamba: true
- name: Create release notes
run: |
scripts/make_release.py \
--token="${{ secrets.GITHUB_TOKEN }}" \
--artifacts-dir="${PWD}/artifacts" \
> release-notes.md
cat release-notes.md
- name: Upload release-notes.md
uses: actions/upload-artifact@v3
with:
name: release-notes
path: |
release-notes.md
basic-tests:
name: Basic tests
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker-image:
- "centos:7"
- "centos:8"
steps:
- uses: actions/checkout@v3
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-linux-64
- name: Run tests
run: scripts/run_basic_tests.sh ${{ matrix.docker-image }} DIRACOS-*.sh
macos-tests:
name: macOS tests
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-11, macos-12]
steps:
- uses: actions/checkout@v3
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-osx-64
- name: Run tests
run: |
bash DIRACOS-*.sh
set -x
source diracos/diracosrc
pip install DIRAC
integration-tests-client-and-server:
name: Integration tests (Py3 server)
if: github.repository == 'DIRACGrid/DIRACOS2'
needs: build-installer
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dirac-branch:
- rel-v8r0
- integration
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Download installer
uses: actions/download-artifact@v3
with:
name: installer-linux-64
- name: Prepare environment
run: |
pip install typer pyyaml gitpython packaging
git clone https://github.com/DIRACGrid/DIRAC.git -b "${{ matrix.dirac-branch }}" DIRACRepo
- name: Run tests
run: |
DIRACOS_TARBALL_PATH=$(echo ${PWD}/DIRACOS-*.sh)
echo "DIRACOS_TARBALL_PATH is ${DIRACOS_TARBALL_PATH}"
cd DIRACRepo
./integration_tests.py create \
"DIRACOS_TARBALL_PATH=${DIRACOS_TARBALL_PATH}"