CheckMK plugins #1
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: Test & Build | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
pull_request: | |
jobs: | |
unittest: | |
name: Unit test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
- name: Install Python dependencies | |
run: pip install -r requirements.txt | |
- name: Run unit tests | |
run: | | |
cd tests | |
python -m unittest discover | |
e2e: | |
name: E2E test (MKP) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
- name: Install Python dependencies | |
run: pip install -r requirements.txt | |
- name: Create mkp package | |
run: python tools/package.py | |
- name: Upload mkp | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mkp | |
path: build/purestorage.mkp | |
if-no-files-found: error | |
- name: Build test container | |
run: docker compose -f docker-compose.mkp.yaml build | |
- name: Install Firefox | |
run: sudo apt update && sudo apt install -y firefox | |
- name: Run behavior tests with MKP | |
env: | |
CONTAINER_UP_COMMAND: "docker compose -f ../docker-compose.mkp.yaml up -d --wait checkmk" | |
CONTAINER_DOWN_COMMAND: "docker compose -f ../docker-compose.mkp.yaml down -t 1" | |
run: cd tests && behave | |
- name: Upload screenshots | |
uses: actions/upload-artifact@v3 | |
if: success() || failure() | |
with: | |
name: screenshots_mkp | |
path: tests/screenshots | |
if-no-files-found: warn | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
- unittest | |
- e2e | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: mkp | |
- name: Create release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: gh release create "${{ github.ref_name }}" --verify-tag *.mkp |