forked from cloudbase/garm
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (79 loc) · 2.78 KB
/
integration-tests.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
name: Integration Tests
on:
workflow_dispatch: {}
schedule:
- cron: "0 0 * * *"
jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Setup LXD
uses: canonical/[email protected]
- name: Install dependencies
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get -qq update && sudo apt-get -qq install -y apg coreutils make
- name: Set up ngrok
id: ngrok
uses: gabriel-samfira/[email protected]
with:
ngrok_authtoken: ${{ secrets.NGROK_AUTH_TOKEN }}
port: 9997
tunnel_type: http
- name: Generate secrets
run: |
GARM_PASSWORD=$(apg -n1 -m32)
REPO_WEBHOOK_SECRET=$(apg -n1 -m32)
ORG_WEBHOOK_SECRET=$(apg -n1 -m32)
echo "::add-mask::$GARM_PASSWORD"
echo "::add-mask::$REPO_WEBHOOK_SECRET"
echo "::add-mask::$ORG_WEBHOOK_SECRET"
echo "GARM_PASSWORD=$GARM_PASSWORD" >> $GITHUB_ENV
echo "REPO_WEBHOOK_SECRET=$REPO_WEBHOOK_SECRET" >> $GITHUB_ENV
echo "ORG_WEBHOOK_SECRET=$ORG_WEBHOOK_SECRET" >> $GITHUB_ENV
echo "GARM_CHECKOUT_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Create logs directory
if: always()
run: sudo mkdir -p /artifacts-logs && sudo chmod 777 /artifacts-logs
- name: Run integration tests
run: |
set -o pipefail
set -o errexit
make integration 2>&1
env:
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
ORG_NAME: gsamfira
REPO_NAME: garm-testing
CREDENTIALS_NAME: test-garm-creds
WORKFLOW_FILE_NAME: test.yml
GH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}
- name: Show GARM logs
if: always()
run: |
sudo systemctl status garm@runner || true
sudo journalctl --no-pager 2>&1 > /artifacts-logs/system.log
sudo journalctl -u garm@runner --no-pager 2>&1 > /artifacts-logs/garm.log
- name: Upload GARM and e2e logs
if: always()
uses: actions/upload-artifact@v3
with:
name: garm-logs
path: /artifacts-logs
- name: Cleanup orphan GARM resources via GitHub API
if: always()
run: |
set -o pipefail
set -o errexit
sudo systemctl stop garm@runner || true
go run ./test/integration/gh_cleanup/main.go || true
env:
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
ORG_NAME: gsamfira
REPO_NAME: garm-testing
GH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}