-
Notifications
You must be signed in to change notification settings - Fork 1
161 lines (137 loc) · 4.39 KB
/
Copy pathtest_and_deploy.yml
File metadata and controls
161 lines (137 loc) · 4.39 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
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
name: Tests, Packaging, and Deployment
on:
workflow_dispatch:
pull_request:
push:
branches: [next, qa, main]
tags: ["v*"]
env:
PKG_NAME: lr_reduction
jobs:
#################
### Run Tests ###
#################
tests:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history for accurate versioning
fetch-tags: true # Fetch tags to ensure versioning works correctly
submodules: recursive
- name: Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
manifest-path: pyproject.toml
- name: Download test data
run: |
git submodule update --init
git submodule foreach --recursive git lfs pull
echo "data repo size: $(du -sh tests/data/liquidsreflectometer-data)"
- name: Test with coverage
run: |
pixi run test-reduction
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
if: github.actor != 'dependabot[bot]'
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build documentation
run: |
pixi run docs-build --environment docs
test -f ./docs/build/html/index.html
##############################
### Package and Deployment ###
##############################
build:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
ref: ${{ github.ref }}
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.9.3
- name: Build conda package
run: |
pixi run conda-build
mkdir -p /tmp/local-channel/noarch
cp *.conda /tmp/local-channel/noarch/
- name: Verify Conda Package
uses: neutrons/conda-verify@v0.1.2
with:
python-version: "3.11"
local-channel: /tmp/local-channel
module-name: ${{ env.PKG_NAME }}
package-name: ${{ env.PKG_NAME }}
extra-channels: neutrons mantid
extra-commands: |
python -c "import lr_reduction"
python -c "import lr_autoreduce"
python -c "import mantid"
- name: upload conda package as artifact
uses: actions/upload-artifact@v6
with:
name: artifact-conda-package
path: ${{ env.PKG_NAME }}-*.conda
publish:
runs-on: ubuntu-24.04
needs: [tests, build]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
ref: ${{ github.ref }}
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.9.3
- name: Download conda package artifact
uses: actions/download-artifact@v7
with:
name: artifact-conda-package
- name: Upload package to anaconda
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
pixi run anaconda upload --label $CONDA_LABEL --user neutrons ${{ env.PKG_NAME }}-*.conda
# Trigger GitLab dev deploy pipeline
deploy-dev:
runs-on: ubuntu-latest
needs: [tests, build]
if: github.ref == 'refs/heads/next'
steps:
- name: Get Environment Name
uses: neutrons/branch-mapper@main
id: env_name
with:
prefix: lr_reduction
- name: Trigger Dev Deploy
# use https://github.com/eic/trigger-gitlab-ci/pull/14 until merged
uses: eic/trigger-gitlab-ci@d984d8d53d871d2fdc1325639d94322da6e8747f
id: trigger
with:
url: https://code.ornl.gov
project_id: 19884
ref_name: main
token: ${{ secrets.GITLAB_DEPLOY_TOKEN }}
- name: Annotate commit
uses: peter-evans/commit-comment@v4
with:
body: |
GitLab pipeline for ${{ steps.env_name.outputs.name }} has been submitted for this commit: ${{ steps.trigger.outputs.web_url }}