-
Notifications
You must be signed in to change notification settings - Fork 1
166 lines (159 loc) · 5.37 KB
/
actions.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
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: [main, qa, next]
tags: ['v*']
jobs:
tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up MicroMamaba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '1.5.10-0'
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- default
- mantid/label/nightly
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: Apt install deps
run: |
sudo apt update
sudo apt-get install xvfb
- name: Start xvfb daemon
run: |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16
- name: Test with pytest
run: |
xvfb-run --server-args="-screen 0 1280x1024x16" -a python -m pytest --cov=src --cov-report=xml --cov-report=term -m "not integration"
- name: Upload coverage reports
uses: codecov/codecov-action@v5
if:
github.actor != 'dependabot[bot]'
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # required
# - name: mypy checks
# shell: bash -l {0}
# run: |
# python -m mypy --config-file=$(pwd)/pyproject.toml $(pwd)
- name: Gui tests
run: |
python -m pip install -e . # install the application in editable mode
env=tests/resources/headcheck.yml xvfb-run --server-args="-screen 0 1280x1024x16" --auto-servernum snapred --headcheck
integration-tests:
runs-on: snapred-builder
defaults:
run:
shell: bash -l {0}
steps:
- name: Cleanup MicroMamba
run: |
sudo rm -rf /home/cloud/micromamba-bin/micromamba
- uses: actions/checkout@v4
with:
submodules: true
lfs: true
- name: Set up MicroMamaba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '1.5.10-0'
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- default
- mantid/label/nightly
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
post-cleanup: all
- name: DNF install deps
run: |
sudo dnf makecache --refresh
sudo yum -y install xorg-x11-server-Xvfb
- name: Test with pytest
run: |
env=tests/resources/integration_test xvfb-run --server-args="-screen 0 1280x1024x16" -a python -m pytest -m "datarepo and integration" --cov=src --cov-report=xml --cov-report=term
- name: Upload coverage reports
uses: codecov/codecov-action@v5
if:
github.actor != 'dependabot[bot]'
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # required
conda-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up MicroMamaba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '1.5.10-0'
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- default
- mantid/label/nightly
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: Build conda libraray
shell: bash -l {0}
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
VERSION=$(versioningit ../) conda mambabuild --channel conda-forge --output-folder . .
conda verify noarch/snapred*.tar.bz2
- name: Deploy to Anaconda
shell: bash -l {0}
if: startsWith(github.ref, 'refs/tags/v')
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
IS_RC: ${{ contains(github.ref, 'rc') }}
run: |
# label is main or rc depending on the tag-name
CONDA_LABEL="main"
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
echo pushing ${{ github.ref }} with label $CONDA_LABEL
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/snapred*.tar.bz2
trigger-deploy:
runs-on: ubuntu-latest
needs: [tests, conda-build]
# only trigger deploys from protected branches and tags
if: ${{github.ref_protected || github.ref_type == 'tag' }}
steps:
- name: Determine Environment
uses: neutrons/branch-mapper@v2
id: conda_env_name
with:
prefix: snapred
- name: Trigger deploy
id: trigger
uses: eic/trigger-gitlab-ci@v3
with:
url: https://code.ornl.gov
token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
ref_name: main
project_id: 7835
variables: |
PLAY="update"
CONDA_ENV="${{ steps.conda_env_name.outputs.name }}"