Molecule CI #302
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: Molecule CI | |
"on": | |
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests | |
push: | |
branches: | |
- main | |
- stable-* | |
- topic/* | |
pull_request: | |
# Run CI on Monday (at 06:00 UTC) | |
# This ensures that even if there haven't been commits that we are still testing against latest changes/packages upstream | |
schedule: | |
- cron: "0 6 * * 1" | |
env: | |
NAMESPACE: mgit_at | |
COLLECTION_NAME: roles | |
concurrency: | |
# Make sure only one of these workflows runs at the same time | |
group: hcloud | |
# Don't cancel running workflows (servers get deleted by cleanup usually, but SSH keys stay around on hcloud) | |
cancel-in-progress: false | |
jobs: | |
### | |
# pre-commit tests (using the pre-commit tool) | |
# | |
pre-commit-molecule: | |
runs-on: ubuntu-latest | |
name: role test (${{ matrix.hook }}) | |
env: | |
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }} | |
strategy: | |
# Run all tests always | |
fail-fast: false | |
matrix: | |
hook: | |
# see .pre-commit-config.yml for hook names | |
- molecule-apt-repo-docker | |
- molecule-apt-repo-helm | |
- molecule-apt-repo-kubernetes | |
- molecule-apt-repo-ubuntu-nginx | |
- molecule-base | |
- molecule-kubeadm-base | |
- molecule-kubeadm-controlplane | |
- molecule-kubeadm-node | |
- molecule-kubernetes-base | |
- molecule-nginx-base | |
- molecule-upgrade-host | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
# with: | |
# path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install pre-commit | |
run: pip install pre-commit | |
# Run the pre-commit hooks | |
- name: Run pre-commit | |
run: pre-commit run --verbose --color always --all-files --hook-stage manual ${{ matrix.hook }} | |
# working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | |
# ^ Not needed for molecule (yet?) | |
# TODO: Proper caching |