Merge pull request #100 from fnordahl/fix-doc-build #368
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 | |
jobs: | |
lint: | |
name: lint | |
runs-on: [self-hosted, linux, X64, jammy, large] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt install shellcheck | |
- name: Lint | |
run: | | |
make check-lint | |
build: | |
name: build | |
needs: | |
- lint | |
runs-on: [self-hosted, linux, X64, jammy, large] | |
env: | |
MICROOVN_SNAP: microovn.snap | |
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 | |
- name: Build snap | |
run: make $MICROOVN_SNAP | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: snaps | |
path: ${{ env.MICROOVN_SNAP }} | |
retention-days: 5 | |
metadata: | |
name: Generate matrix | |
needs: | |
- build | |
runs-on: [self-hosted, linux, X64, jammy, large] | |
outputs: | |
matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Generate matrix | |
id: generate-matrix | |
run: | | |
MATRIX_JSON="{\"test-file\": [" | |
TEST_FILES=( $(cd tests; ls -1 *.bats) ) | |
for (( i=0 ; i < "${#TEST_FILES[@]}"; i++ )); do | |
if [ $i -gt 0 ]; then | |
MATRIX_JSON+="," | |
fi | |
MATRIX_JSON+="\"${TEST_FILES[$i]}\"" | |
done | |
MATRIX_JSON+="]}" | |
echo matrix=${MATRIX_JSON} | tee -a ${GITHUB_OUTPUT} | |
system-tests: | |
name: System tests | |
needs: | |
- metadata | |
runs-on: [self-hosted, linux, X64, jammy, large] | |
env: | |
MICROOVN_SNAP_PATH: ${{ github.workspace }}/microovn.snap | |
MICROOVN_SNAP_CHANNEL: 22.03/stable | |
strategy: | |
matrix: ${{ fromJson(needs.metadata.outputs.matrix) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Download built snap | |
uses: actions/download-artifact@v3 | |
with: | |
name: snaps | |
- 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 | |
snap list | |
- name: Run system tests | |
run: .bats/bats-core/bin/bats tests/${{ matrix.test-file }} |