Merge pull request #289 from NTIA/migrate-readme-to-wiki #430
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
run-scos-sensor-tests: | |
name: Test / Py ${{ matrix.py }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
py: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
steps: | |
- name: Set up Python ${{ matrix.py }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py }} | |
- name: Checkout scos-sensor | |
uses: actions/checkout@v4 | |
- name: Install tox-gh | |
run: python -m pip install tox-gh | |
- name: Set up test suite | |
run: tox r --notest -c ./src/tox.ini -e coverage | |
- name: Run test suite | |
run: tox r -c ./src/tox.ini -e coverage | |
env: | |
PYTEST_ADDOPTS: "-vv --durations=0" | |
AUTHENTICATION: TOKEN | |
CALLBACK_AUTHENTICATION: TOKEN | |
SWITCH_CONFIGS_DIR: ../configs/switches | |
run-scos-sensor-docker: | |
name: Run SCOS Sensor / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create localhost certs | |
working-directory: ./scripts | |
run: sh create_localhost_cert.sh | |
- name: Create fake USB device # Required by API container | |
run : | | |
sudo mkdir -p /dev/bus/usb/001 | |
sudo mknod /dev/bus/usb/001/001 c 189 260 | |
- name: Create fake SSD device # Required by API container | |
run: | | |
sudo mknod /dev/nvme0n1 b 259 0 | |
- name: Build and run Docker containers | |
run: | | |
source ./env.template | |
export MOCK_SIGAN=1 | |
export MOCK_SIGAN_RANDOM=1 | |
docker compose build --no-cache | |
docker compose up -d | |
- name: Wait for containers # wait for containers to finish starting | |
run: sleep 45 | |
- name: Check API container | |
run: docker ps | grep api | grep -q healthy |