Skip to content

CI

CI #428

Workflow file for this run

---
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: 120 # 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:
- rockylinux8
# TODO: Unable to install.
# - fedora38
- ubuntu2004 # Focal Fossa
- ubuntu1804 # Bionic Beaver
- 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: 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: 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 }}"