From cfb5042ef0a4e96045ac5ce5c8b63542b876732c Mon Sep 17 00:00:00 2001 From: Balduin Landolt <33053745+BalduinLandolt@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:56:21 +0200 Subject: [PATCH] chore(CI): split up test action into several jobs (#553) --- .github/actions/preparation/action.yml | 27 ------- .github/workflows/tests-on-push.yml | 104 +++++++++++++++++-------- 2 files changed, 71 insertions(+), 60 deletions(-) delete mode 100644 .github/actions/preparation/action.yml diff --git a/.github/actions/preparation/action.yml b/.github/actions/preparation/action.yml deleted file mode 100644 index e89675615..000000000 --- a/.github/actions/preparation/action.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: "Preparation" -description: "Preparation steps to run tests" - -runs: - using: "composite" - steps: - - name: Checkout source - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install poetry - shell: bin/bash - run: | - curl -sSL https://install.python-poetry.org | python3 - - poetry self add poetry-exec-plugin - - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: 3.11 - # attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op) - cache: poetry - - - name: Install Python dependencies - shell: bin/bash - run: poetry install diff --git a/.github/workflows/tests-on-push.yml b/.github/workflows/tests-on-push.yml index 17c36ea29..9ad2c6626 100644 --- a/.github/workflows/tests-on-push.yml +++ b/.github/workflows/tests-on-push.yml @@ -10,73 +10,117 @@ on: jobs: - tests-on-push: + build-docs: + name: Build docs runs-on: ubuntu-latest steps: - - # Checkout source, install Python, install dependencies - ###################################################### + # Setup - name: Checkout source uses: actions/checkout@v3 with: submodules: recursive - - name: Install poetry - run: | + run: | curl -sSL https://install.python-poetry.org | python3 - poetry self add poetry-exec-plugin - - name: Set up Python 3.11 uses: actions/setup-python@v4 with: python-version: 3.11 # attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op) cache: poetry - - name: Install Python dependencies run: poetry install - - - # Build and check docs - ###################### + # run tests - name: build docs run: poetry run mkdocs build --strict - - name: check external links in docs run: | npm install -g markdown-link-validator poetry exec check-links - - name: markdownlint run: docker run -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest --config .markdownlint.yml --ignore CHANGELOG.md "**/*.md" - - # Code Linting - ############## + lint: + name: Lint code + runs-on: ubuntu-latest + steps: + # Setup + - name: Checkout source + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Install poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + poetry self add poetry-exec-plugin + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + # attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op) + cache: poetry + - name: Install Python dependencies + run: poetry install + # run tests - name: Linting with Pylint run: poetry run pylint src test - - name: Linting with mypy run: poetry run mypy . - - name: Linting with black run: poetry run black --check . - - name: Linting with isort run: poetry run isort . --check --diff - - name: Linting with darglint run: poetry exec darglint - - # Run unittests - ############### + unittests: + name: Run Unittests + runs-on: ubuntu-latest + steps: + # Setup + - name: Checkout source + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Install poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + poetry self add poetry-exec-plugin + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + # attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op) + cache: poetry + - name: Install Python dependencies + run: poetry install + # run tests - name: unittests run: poetry run pytest test/unittests/ - + e2e-tests: + name: Run E2E/Integration Tests + runs-on: ubuntu-latest + steps: + # Setup + - name: Checkout source + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Install poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + poetry self add poetry-exec-plugin + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + # attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op) + cache: poetry + - name: Install Python dependencies + run: poetry install # Install programs for local processing (fast xmlupload) - ######################################################## - name: Fast xmlupload - Install ffmpeg uses: FedericoCarboni/setup-ffmpeg@v2 @@ -88,19 +132,13 @@ jobs: with: path: ~/bin/magick # AppImage containing all binaries + dependencies key: imagemagick # don't check for a new version, because version checking is fairly complex - - name: Fast xmlupload - ImageMagick - Installation if: ${{ steps.search-cached-imagemagick.outputs.cache-hit != 'true' }} uses: mfinelli/setup-imagemagick@v2 # downloads the "magick" AppImage to ~/bin/magick - - - # Run e2e tests - ############### + # run tests - name: start stack run: poetry run dsp-tools start-stack --no-prune - - name: e2e tests run: poetry run pytest test/e2e/ - - name: stop stack # see if this command can run (it isn't tested anywhere else) run: poetry run dsp-tools stop-stack