Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Merge pull request #5 from telekom/dependabot/pip/jinja2-3.1.3 #76

Merge pull request #5 from telekom/dependabot/pip/jinja2-3.1.3

Merge pull request #5 from telekom/dependabot/pip/jinja2-3.1.3 #76

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python Linting
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
REF_NAME: ${{ github.head_ref || github.ref_name }}
LINUX_AMD64_BINARY: "netplanner-linux-amd64-${{ github.head_ref || github.ref_name }}"
jobs:
validate:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
which strip
python -m pip install --upgrade pip poetry
poetry config virtualenvs.in-project true
poetry --version
poetry install --no-root
- name: Lint with black
run: |
poetry run black -t py310 --check .
- name: Type Lint with mypy
run: |
poetry run mypy -v .
- name: Build package
run: |
poetry build
- name: 'Upload PythonPackage Artifact'
uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'push' }} # only: main and on merge.
with:
name: "netplanner-sdist"
path: dist/*
retention-days: 30
- name: Build dynamically linked binary
if: ${{ github.event_name == 'push' }} # only: main and on merge.
run: |
poetry run pyoxidizer build --release
mkdir -p bin/
cp build/x86_64-unknown-linux-gnu/release/install/netplanner "bin/${LINUX_AMD64_BINARY}"
chmod 0644 "bin/${LINUX_AMD64_BINARY}"
strip "bin/${LINUX_AMD64_BINARY}"
- name: 'Upload dynamic binary Artifact'
uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'push' }} # only: main and on merge.
with:
name: "netplanner-binary"
path: bin/*
retention-days: 30
- name: E2E Tests library
run: |
poetry run netplanner --debug --local --only-networkd --config examples/worker-config-old.yaml --output /run/systemd/networkd/worker-old configure
poetry run netplanner --debug --local --only-networkd --config examples/worker-config-new.yaml --output /run/systemd/networkd/worker-new configure
poetry run netplanner --debug --local --only-networkd --config examples/master-config-old.yaml --output /run/systemd/networkd/master-old configure
poetry run netplanner --debug --local --only-networkd --config examples/master-config-new.yaml --output /run/systemd/networkd/master-new configure
poetry run netplanner --debug --local --only-networkd --config examples/veth-trial.yaml --output /run/systemd/networkd/veth-trial configure
poetry run netplanner --debug --local --only-networkd --config examples/5g-worker --output /run/systemd/networkd/folder/5g-worker configure
poetry run netplanner --debug --local --only-networkd --config examples/5g-worker.yaml --output /run/systemd/networkd/5g-worker configure
# enable the netplan apply command
poetry run netplanner --debug --local --only-networkd --config examples/vm-config --output /run/systemd/networkd/folder/vm-config apply
poetry run netplanner --debug --local --only-networkd --config examples/vm-config.yaml --output /run/systemd/networkd/vm-config apply
poetry run netplanner --debug --local --only-networkd --config examples/vm-config-v6.yaml --output /run/systemd/networkd/vm-config-v6 apply
# this should fail
poetry run netplanner --debug --local --only-networkd --config examples/empty --output /run/systemd/networkd/empty configure || true
- name: E2E Tests dynamic linked library
if: ${{ github.event_name == 'push' }} # only: main and on merge.
run: |
chmod 0755 "bin/${LINUX_AMD64_BINARY}"
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/worker-config-old.yaml --output /run/systemd/networkd/worker-old configure
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/worker-config-new.yaml --output /run/systemd/networkd/worker-new configure
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/master-config-old.yaml --output /run/systemd/networkd/master-old configure
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/master-config-new.yaml --output /run/systemd/networkd/master-new configure
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/veth-trial.yaml --output /run/systemd/networkd/veth-trial configure
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/5g-worker --output /run/systemd/networkd/folder/5g-worker configure
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/5g-worker.yaml --output /run/systemd/networkd/5g-worker configure
# enable the netplan apply command
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/vm-config --output /run/systemd/networkd/folder/vm-config apply
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/vm-config.yaml --output /run/systemd/networkd/vm-config apply
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/vm-config-v6.yaml --output /run/systemd/networkd/vm-config-v6 apply
# this should fail
bin/${LINUX_AMD64_BINARY} --debug --local --only-networkd --config examples/empty --output /run/systemd/networkd/empty configure || true
- name: 'Upload E2E Test Artifacts'
uses: actions/upload-artifact@v3
with:
name: templated-test-config
path: ./run/**
retention-days: 5
- name: Pytest
run: |
echo "This should later run the unit tests."