summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: bc62022825ea39f0722438cc6bf95cd54cbc4c66 (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
69
70
71
72
73
74
75
76
77
78
---
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@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:
    strategy:
      fail-fast: false
      matrix:
        molecule_distro:
          - distro: archlinux
            platform: "linux/amd64"
            runs_on: "ubuntu-latest"
          - distro: ubuntu
            platform: "linux/amd64"
            runs_on: "ubuntu-latest"
          - distro: raspberrypi
            platform: "linux/arm64/v8"
            runs_on: "ubuntu-24.04-arm"
    runs-on: ${{ matrix.molecule_distro.runs_on }}
    steps:
      - uses: actions/checkout@v6
        with:
          repository: "a14m/ansible-distro-install"
          path: "ansible-distro-install"
      - uses: actions/checkout@v6
        with:
          repository: "a14m/ansible-distro-configure"
          path: "ansible-distro-configure"
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"
      - name: Install dependencies
        run: pip3 install ansible-core==2.19.3 molecule==25.9.0 molecule-plugins[docker,podman]==25.8.12
      - name: Copy distro install example files
        run: |
          # Use example files for testing instead of encrypted files
          cd ansible-distro-install &&
          for f in host_vars/*.example; do mv "$f" "$(echo "$f" | sed s/\.example//)"; done
      - name: Copy distro configure example files
        run: |
          # Use example files for testing instead of encrypted files
          cd ansible-distro-configure &&
          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
        env:
          PY_COLORS: 1
          ANSIBLE_FORCE_COLOR: 1
        run: >-
          cd ansible-distro-install &&
          molecule --version &&
          ansible --version &&
          MOLECULE_COMMAND=${{ matrix.molecule_distro.command }}
          MOLECULE_PLATFORM=${{ matrix.molecule_distro.platform }}
          MOLECULE_DISTRO=${{ matrix.molecule_distro.distro }}
          molecule test