GRM-26: fix: CI pipeline for rootless Docker runners
This commit was merged in pull request #5.
This commit is contained in:
+37
-23
@@ -2,42 +2,56 @@ name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
quality:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -e ".[dev]"
|
||||
.venv/bin/ansible-galaxy collection install -r ansible/requirements.yml
|
||||
- name: Set up environment
|
||||
run: make setup
|
||||
- name: Lint all
|
||||
run: make lint-all
|
||||
|
||||
unit-tests:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -e ".[dev]"
|
||||
. .venv/bin/activate
|
||||
make lint-all
|
||||
- name: Unit tests with 100% coverage
|
||||
run: make pytest-cov
|
||||
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: Install dependencies
|
||||
- name: Set up environment
|
||||
run: make setup
|
||||
- name: Discover assigned scenarios
|
||||
run: |
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -e ".[dev]"
|
||||
.venv/bin/ansible-galaxy collection install -r ansible/requirements.yml
|
||||
- name: Molecule tests (all 7 scenarios)
|
||||
run: make molecule
|
||||
. .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
|
||||
|
||||
Reference in New Issue
Block a user