forked from CanonicalLtd/prometheus-node-exporter-charm
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (80 loc) · 2.56 KB
/
ci.yaml
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
name: ci
on:
push:
branches: master
pull_request:
branches: master
jobs:
lint:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- run: pip install tox
- name: Run linter
run: make lint
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7.x'
- run: pip install tox
- name: Build charm
run: make build
- name: Upload charm artifact
uses: actions/upload-artifact@v1
with:
name: charm
path: /tmp/charm-builds/prometheus-node-exporter
test:
runs-on: ubuntu-18.04
needs: build
strategy:
fail-fast: false
matrix:
juju_channel:
- 2.7/stable
- 2.8/stable
test_bundles:
- xenial-bundle
- bionic-bundle
- focal-bundle
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.7.x'
- run: pip install tox
- name: Download charm artifact
uses: actions/download-artifact@v1
with:
name: charm
path: /tmp/charm-builds/prometheus-node-exporter
# Workarounds for https://github.com/actions/upload-artifact/issues/38
- run: chmod +x -R /tmp/charm-builds/prometheus-node-exporter/bin
- run: chmod +x -R /tmp/charm-builds/prometheus-node-exporter/hooks
- name: Set up LXD
run: |
sudo usermod --append --groups lxd $(whoami)
sudo su $(whoami) -c 'lxd init --auto'
sudo su $(whoami) -c 'lxc network set lxdbr0 ipv6.address none'
- name: Set up juju
run: |
sudo snap install juju --classic --channel=${{ matrix.juju_channel }}
sudo su $(whoami) -c 'juju bootstrap localhost --no-gui'
- name: Fetch node_exporter
run: |
wget -O node_exporter.tar.gz \
"https://github.com/prometheus/node_exporter/releases/download/v1.1.2/node_exporter-1.1.2.linux-amd64.tar.gz"
tar --extract --file=node_exporter.tar.gz node_exporter-1.1.2.linux-amd64/node_exporter
mv node_exporter-1.1.2.linux-amd64/node_exporter /tmp/node_exporter
rm -rf node_exporter-1.1.2.linux-amd64 node_exporter.tar.gz
- name: Run tests
run: make test-${{ matrix.test_bundles }}
- name: Display juju debug log on failure
run: juju debug-log --lines 100
if: failure()