summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: 0a00ba50742a7d36fb27f83fc68e44bfa5e2f07b (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
---
name: "CI"
'on': ["push", "pull_request"]
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.x"
      - name: Install dependencies
        run: pip3 install yamllint ansible-lint
      - name: Copy example files
        run: |
          # Use example files for testing instead of encrypted files
          for f in host_vars/*.example; do mv "$f" "$(echo "$f" | sed s/\.example//)"; done
      - name: Run
        run: |
          yamllint .
          ansible-lint

  playbook:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        molecule_distro:
          - distro: archlinux
            platform: "linux/amd64"
          - distro: ubuntu
            platform: "linux/amd64"
          - distro: raspberrypi
            platform: "linux/arm64/v8"
    steps:
      - name: Add ARM support
        run: |
          sudo apt-get install -y qemu-user-static binfmt-support
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.x"
      - name: Install dependencies
        run: pip3 install ansible molecule molecule-plugins[docker]
      - name: Copy example files
        run: |
          # Copy host_vars (from the .example files)
          for f in host_vars/*.example; do cp "$f" "$(echo "$f" | sed s/\.example//)"; done
      - name: Run
        env:
          PY_COLORS: 1
          ANSIBLE_FORCE_COLOR: 1
        run: >-
          molecule --version &&
          ansible --version &&
          MOLECULE_COMMAND=${{ matrix.molecule_distro.command }}
          MOLECULE_PLATFORM=${{ matrix.molecule_distro.platform }}
          MOLECULE_DISTRO=${{ matrix.molecule_distro.distro }}
          molecule test