CI #493
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
schedule: | |
# Run at 3pm on Friday. | |
# REF: https://crontab.guru/#0_3_*_*_5 | |
- cron: "0 3 * * 5" | |
env: | |
# Colors | |
# REF: http://web.archive.org/web/20230608140615/https://www.jeffgeerling.com/blog/2020/getting-colorized-output-molecule-and-ansible-on-github-actions-ci | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
# YAML Output | |
# REF: http://web.archive.org/web/20220707112219/https://www.jeffgeerling.com/blog/2018/use-ansibles-yaml-callback-plugin-better-cli-experience | |
ANSIBLE_STDOUT_CALLBACK: 'yaml' | |
ANSIBLE_LOAD_CALLBACK_PLUGINS: true | |
# SSH Pipelining | |
ANSIBLE_PIPELINING: true | |
ANSIBLE_SSH_CONTROL_PATH: '/tmp/ansible-ssh-%%h-%%p-%%r' | |
# Task Timeout | |
# Requires Ansible 2.10 | |
# REF: https://web.archive.org/web/20230819083945/https://docs.ansible.com/ansible/latest/reference_appendices/config.html#task-timeout | |
ANSIBLE_TASK_TIMEOUT: 300 # seconds | |
defaults: | |
run: | |
working-directory: 'jason_riddle.tailscale' | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
with: | |
path: 'jason_riddle.tailscale' | |
- name: Set up Python 3. | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install test dependencies. | |
run: pip3 install yamllint | |
- name: Lint code. | |
run: | | |
yamllint . | |
molecule: | |
name: Molecule | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
distro: | |
# See: https://www.jeffgeerling.com/blog/2024/newer-versions-ansible-dont-work-rhel-8 | |
# - rockylinux8 | |
# TODO: Unable to install. | |
# - fedora38 | |
# See: https://en.wikipedia.org/wiki/Ubuntu_version_history | |
# - ubuntu2404 # Noble Numbat | |
- ubuntu2204 # Jammy Jellyfish | |
- ubuntu2004 # Focal Fossa | |
# See: https://www.jeffgeerling.com/blog/2024/newer-versions-ansible-dont-work-rhel-8 | |
# - ubuntu1804 # Bionic Beaver | |
# See: https://en.wikipedia.org/wiki/Debian_version_history | |
# - debian13 # Trixie | |
- debian12 # Bookworm | |
# - debian11 # Bullseye | |
# - debian10 # Buster | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
with: | |
path: 'jason_riddle.tailscale' | |
- name: Set up Python 3. | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install test dependencies. | |
run: pip3 install ansible molecule molecule-plugins[docker] docker | |
- name: Print python3 version. | |
run: | | |
python3 --version | |
- name: Print ansible version. | |
run: | | |
ansible --version | |
- name: Set HOSTNAME. | |
run: echo "HOSTNAME=$(cat /etc/hostname)" >> $GITHUB_ENV | |
- name: Run Molecule default test. | |
run: | | |
molecule test --scenario-name default | |
env: | |
MOLECULE_DISTRO: ${{ matrix.distro }} | |
MOLECULE_PLAYBOOK: ${{ matrix.playbook }} | |
- name: Run Molecule up test. | |
run: | | |
molecule test --scenario-name up | |
env: | |
MOLECULE_DISTRO: ${{ matrix.distro }} | |
MOLECULE_PLAYBOOK: ${{ matrix.playbook }} | |
TAILSCALE_AUTHKEY: "${{ secrets.TAILSCALE_AUTHKEY }}" | |
# TODO: Not working.. | |
# - name: Run Molecule up-with-oauth test. | |
# run: | | |
# molecule test --scenario-name up-with-oauth | |
# env: | |
# MOLECULE_DISTRO: ${{ matrix.distro }} | |
# MOLECULE_PLAYBOOK: ${{ matrix.playbook }} | |
# TAILSCALE_OAUTHKEY: "${{ secrets.TAILSCALE_OAUTHKEY }}" | |
# TODO: serve and funnel command line arguments have changed. | |
# See https://tailscale.com/blog/reintroducing-serve-funnel/. | |
# - name: Run Molecule serve test. | |
# run: | | |
# molecule test --scenario-name serve | |
# env: | |
# MOLECULE_DISTRO: ${{ matrix.distro }} | |
# MOLECULE_PLAYBOOK: ${{ matrix.playbook }} | |
# TAILSCALE_AUTHKEY: "${{ secrets.TAILSCALE_AUTHKEY }}" | |
# TODO: serve and funnel command line arguments have changed. | |
# See https://tailscale.com/blog/reintroducing-serve-funnel/. | |
# - name: Run Molecule funnel test. | |
# run: | | |
# molecule test --scenario-name funnel | |
# env: | |
# MOLECULE_DISTRO: ${{ matrix.distro }} | |
# MOLECULE_PLAYBOOK: ${{ matrix.playbook }} | |
# TAILSCALE_AUTHKEY: "${{ secrets.TAILSCALE_AUTHKEY }}" |