summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: 88d817dd5fac2be9fb0b880bdda3bc3339937b50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
name: "CI"
'on':
  push:
  pull_request:
  schedule:
    - cron: '0 12 * * 5'
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: "3.13"
      - name: Install dependencies
        run: pip3 install yamllint==1.37.1 ansible-lint==25.9.2
      - name: Copy example files
        run: |
          # Use example files for testing instead of encrypted files
          for f in group_vars/*.example; do mv "$f" "$(echo "$f" | sed s/\.example//)"; done
          for f in host_vars/*.example; do mv "$f" "$(echo "$f" | sed s/\.example//)"; done
      - name: Run
        run: |
          yamllint .
          ansible-lint

  playbook:
    strategy:
      fail-fast: false
      matrix:
        molecule_distro:
          - name: archlinux
            runs_on: "ubuntu-latest"
          - name: archlinux-gnome
            runs_on: "ubuntu-latest"
          - name: ubuntu
            runs_on: "ubuntu-latest"
          - name: debian
            runs_on: "ubuntu-latest"
          - name: raspberrypi
            runs_on: "ubuntu-24.04-arm"
    runs-on: ${{ matrix.molecule_distro.runs_on }}
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v6
        with:
          python-version: "3.13"
      - name: Install dependencies
        run: pip3 install ansible-core==2.20.1 molecule==25.9.0 molecule-plugins[docker,podman]==25.8.12
      - name: Remove encrypted var files
        run: |
          rm host_vars/*.yml
          rm group_vars/*.yml
      - name: Copy group_vars example files
        run: |
          # Use example group_vars files for testing instead of encrypted files
          for f in group_vars/*.example; do mv "$f" "$(echo "$f" | sed s/\.example//)"; done
      - name: Run
        env:
          PY_COLORS: 1
          ANSIBLE_FORCE_COLOR: 1
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: >-
          molecule --version &&
          ansible --version &&
          MOLECULE_COMMAND=${{ matrix.molecule_distro.command }}
          molecule test -s ${{ matrix.molecule_distro.name }}