forked from regro/cf-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (183 loc) · 6.65 KB
/
test-integration.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Integration Tests
on:
push:
branches:
- master
pull_request: null
merge_group: null
# Integration tests interact with GitHub resources in the integration test infrastructure and therefore
# cannot run concurrently with other integration tests.
concurrency:
group: cf-scripts-integration-tests
cancel-in-progress: false
defaults:
run:
shell: bash -leo pipefail {0}
env:
# Test Instrumentation
# Note: This passes secrets to steps that don't need them.
# We would not do this in a production setting.
GH_TOKEN_STAGING_CONDA_FORGE: ${{ secrets.GH_TOKEN_STAGING_CONDA_FORGE }}
GH_TOKEN_STAGING_BOT_USER: ${{ secrets.GH_TOKEN_STAGING_BOT_USER }}
GH_TOKEN_STAGING_REGRO: ${{ secrets.GH_TOKEN_STAGING_REGRO }}
# Bot
CF_TICK_OVERRIDE_CONDA_FORGE_ORG: conda-forge-bot-staging
CF_TICK_GRAPH_DATA_BACKENDS: file
CF_TICK_CONTAINER_NAME: conda-forge-tick
CF_TICK_CONTAINER_TAG: test
# Deploy to GitHub step
DEPLOY_REPO: regro-staging/cf-graph-countyfair
RUN_URL: "https://github.com/regro/cf-scripts/actions/runs/${{ github.run_id }}"
# Install Bot Code step
CF_GRAPH_REMOTE: https://github.com/regro-staging/cf-graph-countyfair.git
CF_PINNING_REMOTE: https://github.com/conda-forge-bot-staging/conda-forge-pinning-feedstock.git
PRUNE_DOCKER: false
PULL_DOCKER: false
UPDATE_PINNINGS: false
jobs:
setup-repositories:
name: Set up Integration Tests
runs-on: ubuntu-latest
outputs:
scenario_ids: ${{ steps.setup_repositories.outputs.scenario_ids }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
path: cf-scripts
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3
- name: Build Docker Image
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6
with:
context: cf-scripts
push: false
load: true
tags: conda-forge-tick:test
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker,dest=/tmp/image.tar
- name: Upload Docker Image
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4
with:
name: conda-forge-tick
path: /tmp/image.tar
- name: setup-micromamba
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1
with:
environment-file: cf-scripts/conda-lock.yml
environment-name: cf-scripts
condarc-file: cf-scripts/autotick-bot/condarc
- name: Set up Integration Test Repositories
id: setup_repositories
run: |
pushd cf-scripts
python -m tests_integration.setup_repositories
run-test-scenario:
name: Run Scenarios
runs-on: ubuntu-latest
needs: setup-repositories
strategy:
matrix:
scenario_id: ${{ fromJson(needs.setup-repositories.outputs.scenario_ids) }}
max-parallel: 1
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
path: cf-scripts
- name: Download Docker Image
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: conda-forge-tick
path: /tmp
- name: Load Docker Image
run: |
docker load --input /tmp/image.tar
docker image ls -a
- name: setup-micromamba
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1
with:
environment-file: cf-scripts/conda-lock.yml
environment-name: cf-scripts
condarc-file: cf-scripts/autotick-bot/condarc
- name: Prepare Scenario
run: |
pushd cf-scripts
python -m tests_integration.step_prepare
env:
SCENARIO_ID: ${{ matrix.scenario_id }}
- name: Start HTTP Proxy
run: |
pushd cf-scripts
./tests_integration/mock_proxy_start.sh &
sleep 10
# Install CA Certificate
sudo wget -e use_proxy=yes -e http_proxy=127.0.0.1:8080 -O /usr/local/share/ca-certificates/mitmproxy.crt \
http://mitm.it/cert/pem
sudo update-ca-certificates
env:
SCENARIO_ID: ${{ matrix.scenario_id }}
PYTHONPATH: ${{ github.workspace }}/cf-scripts
- name: Install Bot Code
run: |
source cf-scripts/autotick-bot/install_bot_code.sh
env:
# This is the first install, so we need to update the pinnings
UPDATE_PINNINGS: true
- name: "[Test] Gather all Feedstocks"
run: |
pushd cf-graph
conda-forge-tick --debug gather-all-feedstocks
env:
BOT_TOKEN: ${{ secrets.GH_TOKEN_STAGING_BOT_USER }}
- name: "[Test] Deploy to GitHub"
run: |
pushd cf-graph
conda-forge-tick --debug deploy-to-github
env:
# note that we need the token scoped for regro-staging
BOT_TOKEN: ${{ secrets.GH_TOKEN_STAGING_REGRO }}
- name: Reinstall Bot Code
run: |
source cf-scripts/tests_integration/clear_runner.sh
source cf-scripts/autotick-bot/install_bot_code.sh
- name: "[Test] Make Graph (Nodes and Edges)"
run: |
pushd cf-graph
conda-forge-tick --debug make-graph --update-nodes-and-edges
- name: "[Test] Deploy to GitHub"
run: |
pushd cf-graph
conda-forge-tick --debug deploy-to-github
env:
BOT_TOKEN: ${{ secrets.GH_TOKEN_STAGING_REGRO }}
- name: Reinstall Bot Code
run: |
source cf-scripts/tests_integration/clear_runner.sh
source cf-scripts/autotick-bot/install_bot_code.sh
- name: "[Test] Make Graph (Node Attributes)"
run: |
pushd cf-graph
conda-forge-tick --debug make-graph
- name: "[Test] Deploy to GitHub"
run: |
pushd cf-graph
conda-forge-tick --debug deploy-to-github
env:
BOT_TOKEN: ${{ secrets.GH_TOKEN_STAGING_REGRO }}
- name: Reinstall Bot Code
run: |
source cf-scripts/tests_integration/clear_runner.sh
source cf-scripts/autotick-bot/install_bot_code.sh
- name: "[Test] update_upstream_versions"
run: |
pushd cf-graph
conda-forge-tick --debug update-upstream-versions
- name: "[Test] Deploy to GitHub"
run: |
pushd cf-graph
conda-forge-tick --debug deploy-to-github
env:
BOT_TOKEN: ${{ secrets.GH_TOKEN_STAGING_REGRO }}