internal(CI): pip install provisioner runtime before running plugins … #83
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- '**' # Triggers the workflow on any pull request and on any branch | |
env: | |
# Semantic version range syntax (3.x) or exact version of a Python version | |
POETRY_VERSION: "1.4.1" | |
jobs: | |
build: | |
name: Tests Suite | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: [ '3.10' ] | |
steps: | |
- name: Checkout ZachiNachshon/provisioner | |
uses: actions/checkout@v3 | |
with: | |
repository: 'ZachiNachshon/provisioner' | |
token: ${{ secrets.PROVISIONER_REPO_ACCESS_TOKEN }} | |
- name: Checkout ZachiNachshon/provisioner-plugins | |
uses: actions/checkout@v3 | |
with: | |
path: './plugins' | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Try Load Cached Poetry Installation | |
id: cached-poetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local # Path depends on the OS | |
key: poetry-${{ env.POETRY_VERSION }} # Change to reset cache | |
- name: Maybe Install Poetry | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
- name: Try Load Cache venv - provisioner_examples_plugin | |
id: cached-venv-provisioner-examples-plugin | |
uses: actions/cache@v3 | |
with: | |
path: ./plugins/provisioner_examples_plugin/.venv | |
key: provisioner_examples_plugin-venv-${{ runner.os }}-${{ hashFiles('./plugins/provisioner_examples_plugin/poetry.lock') }} | |
- name: Maybe Install venv - provisioner_examples_plugin | |
if: steps.cached-venv-provisioner-examples-plugin.outputs.cache-hit != 'true' | |
run: | | |
cd plugins/provisioner_examples_plugin | |
poetry install | |
cd .. | |
- name: Try Load Cache venv - provisioner_installers_plugin | |
id: cached-venv-provisioner-installers-plugin | |
uses: actions/cache@v3 | |
with: | |
path: ./plugins/provisioner_installers_plugin/.venv | |
key: provisioner_installers_plugin-venv-${{ runner.os }}-${{ hashFiles('./plugins/provisioner_installers_plugin/poetry.lock') }} | |
- name: Maybe Install venv - provisioner_installers_plugin | |
if: steps.cached-venv-provisioner-installers-plugin.outputs.cache-hit != 'true' | |
run: | | |
cd plugins/provisioner_installers_plugin | |
poetry install | |
cd .. | |
- name: Try Load Cache venv - provisioner_single_board_plugin | |
id: cached-venv-provisioner-single-board-plugin | |
uses: actions/cache@v3 | |
with: | |
path: ./plugins/provisioner_single_board_plugin/.venv | |
key: provisioner_single_board_plugin-venv-${{ runner.os }}-${{ hashFiles('./plugins/provisioner_single_board_plugin/poetry.lock') }} | |
- name: Maybe Install venv - provisioner_single_board_plugin | |
if: steps.cached-venv-provisioner-single-board-plugin.outputs.cache-hit != 'true' | |
run: | | |
cd plugins/provisioner_single_board_plugin | |
poetry install | |
cd .. | |
- name: Install Required pip packages | |
run: | | |
cd provisioner | |
make pip-install | |
pip install coverage | |
- name: Run tests | |
run: make test-coverage-xml-all | |
# Requires CODECOV_TOKEN in GitHub repository secrets | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # Only required for private repositories | |
# file: ./coverage-combined.xml | |
file: ./provisioner/coverage.xml,./plugins/provisioner_features_lib/coverage.xml,./plugins/provisioner_examples_plugin/coverage.xml,./provisioner_installers_plugin/coverage.xml,./plugins/provisioner_single_board_plugin/coverage.xml | |
fail_ci_if_error: true |