]> git.openstreetmap.org Git - chef.git/blob - .github/workflows/test-kitchen.yml
Use volume for nested podman container storage
[chef.git] / .github / workflows / test-kitchen.yml
1 name: Test Kitchen
2
3 on:
4   - push
5   - pull_request
6   - workflow_dispatch
7
8 concurrency:
9   group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
10   cancel-in-progress: true
11
12 jobs:
13   kitchen:
14     name: Test Kitchen
15     runs-on: ubuntu-latest
16     permissions:
17       packages: read
18     strategy:
19       matrix:
20         suite:
21           - accounts
22           - apache
23           - apt
24           - apt-repository
25           - awscli
26           - backup
27           - bind
28           - blog
29           - blogs
30           - chef
31           - civicrm
32           - clamav
33           - community
34           - db-backup
35           - db-base
36           - db-master
37           - db-slave
38           - dev
39           - devices
40           - dhcpd
41           - dmca
42           - dns
43           - docker
44           - elasticsearch
45           - exim
46           - fail2ban
47           - fastly
48           - foundation-birthday
49           - foundation-board
50           - foundation-dwg
51           - foundation-mastodon
52           - foundation-mwg
53           - foundation-owg
54           - foundation-welcome
55           - foundation-wiki
56           - ftp
57           - geodns
58           - geoipupdate
59           - git
60           - git-server
61           - git-web
62           - glitchtip
63           - gps-tile
64           - hardware
65           - hot
66           - ideditor
67           - imagery-tiler
68           - irc
69           - letsencrypt
70           - mail
71           - mailman
72           - matomo
73           - memcached
74           - mysql
75           - networking
76           - nginx
77           - nodejs
78           - nominatim
79           - ntp
80           - openssh
81           - osmosis
82           - osqa
83           - otrs
84           - overpass
85           - oxidized
86           - passenger
87           - php
88           - planet
89           - planet-aws
90           - planet-current
91           - planet-dump
92           - planet-notes
93           - planet-replication
94           - postgresql
95           - prometheus
96           - prometheus-server
97           - python
98           - rsyncd
99           - serverinfo
100           - snmpd
101           - spamassassin
102           - ssl
103           - stateofthemap
104           - subversion
105           - supybot
106           - switch2osm
107           - sysctl
108           - sysfs
109           - taginfo
110           - tile
111           - tilelog
112           - tools
113           - trac
114           - valkey
115           - vectortile
116           - web-cgimap
117           - web-frontend
118           - web-rails
119           - wiki
120           - wordpress
121         os:
122           - debian-13
123         exclude:
124           - suite: mailman
125             os: debian-13
126         include:
127           - suite: blog
128             os: ubuntu-2004
129           - suite: mailman
130             os: ubuntu-2004
131           - suite: wordpress
132             os: ubuntu-2004
133           - suite: accounts
134             os: ubuntu-2204
135           - suite: apt
136             os: ubuntu-2204
137           - suite: chef
138             os: ubuntu-2204
139           - suite: db-backup
140             os: ubuntu-2204
141           - suite: db-base
142             os: ubuntu-2204
143           - suite: db-master
144             os: ubuntu-2204
145           - suite: db-slave
146             os: ubuntu-2204
147           - suite: devices
148             os: ubuntu-2204
149           - suite: exim
150             os: ubuntu-2204
151           - suite: fail2ban
152             os: ubuntu-2204
153           - suite: git
154             os: ubuntu-2204
155           - suite: hardware
156             os: ubuntu-2204
157           - suite: networking
158             os: ubuntu-2204
159           - suite: ntp
160             os: ubuntu-2204
161           - suite: openssh
162             os: ubuntu-2204
163           - suite: postgresql
164             os: ubuntu-2204
165           - suite: prometheus
166             os: ubuntu-2204
167           - suite: rsyncd
168             os: ubuntu-2204
169           - suite: sysctl
170             os: ubuntu-2204
171           - suite: sysfs
172             os: ubuntu-2204
173           - suite: tools
174             os: ubuntu-2204
175       fail-fast: false
176     steps:
177     - name: Check out code
178       uses: actions/checkout@v7
179     - name: Extract cinc image details from .kitchen.yml
180       id: cinc-image
181       run: |
182         CINC_IMAGE=$(grep 'chef_image:' .kitchen.yml | head -1 | awk '{print $2}')
183         CINC_VERSION=$(grep 'chef_version:' .kitchen.yml | head -1 | awk '{print $2}')
184         echo "cinc_container_image=${CINC_IMAGE}" >> "$GITHUB_OUTPUT"
185         echo "cinc_container_version=${CINC_VERSION}" >> "$GITHUB_OUTPUT"
186         echo "cinc_container_ref=${CINC_IMAGE}:${CINC_VERSION}" >> "$GITHUB_OUTPUT"
187     - name: Login to GitHub Container Registry
188       uses: docker/login-action@v4
189       with:
190         registry: ghcr.io
191         username: ${{ github.actor }}
192         password: ${{ secrets.GITHUB_TOKEN }}
193     - name: Cache cinc container image
194       id: cache-cinc
195       uses: actions/cache@v6
196       with:
197         path: /tmp/cinc-image.tar
198         key: docker-cinc-${{ steps.cinc-image.outputs.cinc_container_version }}-${{ runner.arch }}
199     - name: Pull and save cinc container image
200       if: steps.cache-cinc.outputs.cache-hit != 'true'
201       run: |
202         docker pull "${{ steps.cinc-image.outputs.cinc_container_ref }}"
203         docker save "${{ steps.cinc-image.outputs.cinc_container_ref }}" -o /tmp/cinc-image.tar
204     - name: Load cinc container image from cache
205       if: steps.cache-cinc.outputs.cache-hit == 'true'
206       run: docker load -i /tmp/cinc-image.tar
207     - name: Setup ruby
208       uses: ruby/setup-ruby@v1
209       with:
210         bundler-cache: true
211     - name: Run kitchen test ${{ matrix.suite }}-${{ matrix.os }}
212       run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}
213     - name: Gather journal output
214       run: |
215         bundle exec kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl --since=yesterday"
216         bundle exec kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "networkctl status --all"
217         bundle exec kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "resolvectl status" || true
218       if: ${{ failure() }}