58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
quality:
|
|
runs-on: docker
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up environment
|
|
run: make setup
|
|
- name: Lint all
|
|
run: |
|
|
. .venv/bin/activate
|
|
make lint-all
|
|
- name: Unit tests with 100% coverage
|
|
run: |
|
|
. .venv/bin/activate
|
|
make pytest-cov
|
|
- name: Check unit test speed
|
|
run: |
|
|
. .venv/bin/activate
|
|
python3 scripts/check_test_speed.py --max-seconds 10
|
|
|
|
molecule-tests:
|
|
needs: quality
|
|
runs-on: docker
|
|
strategy:
|
|
matrix:
|
|
runner-index: [0, 1, 2]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up environment
|
|
run: make setup
|
|
- name: Discover assigned scenarios
|
|
run: |
|
|
. .venv/bin/activate
|
|
SCENARIOS=$(python3 scripts/distribute_molecule.py --runner-index ${{ matrix.runner-index }} --max-runners 3)
|
|
echo "Assigned scenarios: $SCENARIOS"
|
|
echo "SCENARIOS=$SCENARIOS" >> $GITHUB_ENV
|
|
- name: Run molecule tests
|
|
run: |
|
|
. .venv/bin/activate
|
|
export DOCKER_HOST="unix:///run/user/$(id -u)/docker.sock"
|
|
export ANSIBLE_INJECT_INVOCATION=1
|
|
cd ansible/roles/gitea-runner
|
|
for s in $SCENARIOS; do
|
|
if [ "$s" = "default" ]; then
|
|
ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true molecule test
|
|
else
|
|
ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true molecule test -s "$s"
|
|
fi
|
|
done
|