Merge pull request #157 from masnax/system-tests #259
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: Tests | |
on: | |
- push | |
- pull_request | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code-tests: | |
name: Code tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.18.x | |
- name: Install dependencies | |
run: | | |
sudo add-apt-repository ppa:dqlite/dev -y --no-update | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends -y libdqlite-dev pkg-config | |
- name: Update gomod | |
working-directory: microcloud | |
run: make update-gomod | |
- name: Run static analysis | |
working-directory: microcloud | |
run: make check-static | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.20.x | |
- name: Install dependencies | |
run: | | |
sudo add-apt-repository ppa:dqlite/dev -y | |
sudo apt-get install -y libdqlite-dev pkg-config | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Run unit tests | |
working-directory: microcloud | |
run: make check-unit | |
system-tests: | |
name: System tests | |
runs-on: ubuntu-22.04 | |
env: | |
SNAPCRAFT_BUILD_ENVIRONMENT: "lxd" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Clear FORWARD firewall rules | |
run: | | |
# Docker can inject rules causing firewall conflicts | |
sudo iptables -P FORWARD ACCEPT || true | |
sudo ip6tables -P FORWARD ACCEPT || true | |
sudo iptables -F FORWARD || true | |
sudo ip6tables -F FORWARD || true | |
- name: Install dependencies | |
run: | | |
sudo snap refresh | |
sudo snap set lxd daemon.group=adm | |
sudo lxd init --auto | |
sudo snap install snapcraft --classic | |
snap list | |
- name: Build snaps | |
run: snapcraft | |
- name: Run system tests | |
run: | | |
set -eux | |
sudo snap install --dangerous microcloud_*.snap | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: snaps | |
path: "*.snap" | |
retention-days: 5 | |
spellcheck: | |
name: Spelling check (documentation) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Aspell | |
run: | | |
sudo apt-get install aspell aspell-en | |
- name: Install the doc framework | |
working-directory: ./doc | |
run: | | |
make install | |
- name: Build docs and run spellchecker | |
working-directory: ./doc | |
run: | | |
make spelling | |
woke: | |
name: Inclusive language check (documentation) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: woke | |
uses: get-woke/woke-action@v0 | |
with: | |
# Cause the check to fail on any broke rules | |
fail-on-error: true | |
workdir: doc | |
woke-args: "*.rst *.md **/*.rst **/*.md -c https://github.com/canonical-web-and-design/Inclusive-naming/raw/main/config.yml" | |
linkcheck: | |
name: Link check (documentation) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install the doc framework | |
working-directory: ./doc | |
run: | | |
make install | |
- name: Run linkchecker | |
working-directory: ./doc | |
run: | | |
make linkcheck |