Skip to content

CI

CI #40

Workflow file for this run

---
name: CI
"on":
pull_request:
push:
schedule:
- cron: "11 12 * * 2"
workflow_dispatch:
defaults:
run:
working-directory: metabrainz.zookeeper
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: metabrainz.zookeeper
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: pip3 install yamllint ansible ansible-lint
- name: Run lint
run: |
yamllint .
ansible-lint
test:
name: Test (py${{ matrix.python }} ansible${{ matrix.ansible }} ${{ matrix.distro }})
runs-on: ubuntu-latest
needs:
- lint
strategy:
fail-fast: false
matrix:
python:
- "3.10"
- "3.11"
- "3.12"
ansible:
- 8
- 9
- 10
distro:
- ubuntu2004
- ubuntu2204
- ubuntu2404
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: metabrainz.zookeeper
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Generate test-requirements.txt
run: |
cat <<EOF > test-requirements.txt
ansible==${{ matrix.ansible }}.*
docker
molecule-plugins[docker]
# https://github.com/docker/docker-py/issues/3256
requests==2.31.0
EOF
echo "REQS_HASH=$(sha256sum test-requirements.txt | awk '{ print $1 }')" >> "$GITHUB_ENV"
- name: Cache pip directory
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py${{ matrix.python }}-ansible${{ matrix.ansible }}-${{ env.REQS_HASH }}
- name: Cache local archive directory
uses: actions/cache@v4
with:
path: ~/.cache/ansible/zookeeper
key: zookeeper
- name: Install test dependencies
run: pip3 install -r test-requirements.txt
- name: Run pip freeze
run: pip3 freeze --all
- name: Run tests
run: molecule test
env:
ANSIBLE_FORCE_COLOR: 1
PY_COLORS: 1
MOLECULE_DISTRO: ${{ matrix.distro }}