Skip to content

dnsmasq aerickson tweaks #188

dnsmasq aerickson tweaks

dnsmasq aerickson tweaks #188

Workflow file for this run

name: Monopacker Tests
on: [push, pull_request]
env:
PACKER_VERSION: "1.8.6" # or: "latest"
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.5.1"
POETRY_URL: https://install.python-poetry.org
# poetry install steps from:
# https://gist.github.com/gh640/233a6daf68e9e937115371c0ecd39c61
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
id: setup_python
# Poetry cache depends on OS, Python version and Poetry version.
- name: Cache Poetry cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files).
- name: Cache Packages
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }}
- name: Install Poetry ${{ env.POETRY_VERSION }}
run: |
curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }}
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Dependencies
run: poetry install
- name: pip list
run: |
poetry run pip list
- name: Run tests
run: |
poetry run python -m pytest -sxv
- name: Generate coverage report
run: |
poetry run pytest -vv --cov=monopacker --cov-report=term-missing
# poetry-update-check:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Set up Python ${{ env.PYTHON_VERSION }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ env.PYTHON_VERSION }}
# id: setup_python
# # Poetry cache depends on OS, Python version and Poetry version.
# - name: Cache Poetry cache
# uses: actions/cache@v3
# with:
# path: ~/.cache/pypoetry
# key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
# # virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files).
# - name: Cache Packages
# uses: actions/cache@v3
# with:
# path: ~/.local
# key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }}
# - name: Install Poetry ${{ env.POETRY_VERSION }}
# run: |
# curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }}
# echo "$HOME/.local/bin" >> $GITHUB_PATH
# - name: Install Dependencies
# run: poetry install
# - name: pip list
# run: |
# poetry run pip list
# - name: Run tests
# run: |
# poetry run python -m pytest -sxv
# - name: poetry update
# run: |
# poetry update
# - name: check if changes
# run: |
# git status --porcelain
# if ! output=$(git status --porcelain) || [ -n "$output" ]; then
# echo "*** 'poetry update' produced changes to the repository; these changes should be checked in ***";
# git --no-pager diff;
# exit 1;
# fi
monopacker-validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup `packer`
uses: hashicorp/setup-packer@main
id: setup
with:
version: ${{ env.PACKER_VERSION }}
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
id: setup_python
# Poetry cache depends on OS, Python version and Poetry version.
- name: Cache Poetry cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files).
- name: Cache Packages
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-local-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }}
- name: Install Poetry ${{ env.POETRY_VERSION }}
run: |
curl -sSL ${{ env.POETRY_URL }} | python - --version ${{ env.POETRY_VERSION }}
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Dependencies
run: poetry install
- name: monopacker validate
run: |
#set -x
set -e
for file in builders/*.yaml; do
builder_instance=$(echo "$file" | sed 's/.yaml//g' | sed 's/builders\///g')
echo -n "$builder_instance: "
poetry run monopacker validate "$builder_instance"
done
echo ""
echo "ALL VALIDATED"