fix target relation #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |