]> git.openstreetmap.org Git - chef.git/blob - .github/workflows/test-kitchen.yml
Drop testing on ubuntu for recipes no longer used there
[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           - gps-tile
63           - hardware
64           - hot
65           - ideditor
66           - imagery-tiler
67           - irc
68           - letsencrypt
69           - mail
70           - mailman
71           - matomo
72           - memcached
73           - mysql
74           - networking
75           - nginx
76           - nodejs
77           - nominatim
78           - ntp
79           - openssh
80           - osmosis
81           - osqa
82           - otrs
83           - overpass
84           - oxidized
85           - passenger
86           - php
87           - php-apache
88           - php-fpm
89           - planet
90           - planet-aws
91           - planet-current
92           - planet-dump
93           - planet-notes
94           - planet-replication
95           - postgresql
96           - prometheus
97           - prometheus-server
98           - python
99           - rsyncd
100           - serverinfo
101           - snmpd
102           - spamassassin
103           - ssl
104           - stateofthemap-container
105           - stateofthemap-wordpress
106           - subversion
107           - supybot
108           - switch2osm
109           - sysctl
110           - sysfs
111           - taginfo
112           - tile
113           - tilelog
114           - tools
115           - trac
116           - vectortile
117           - web-cgimap
118           - web-frontend
119           - web-rails
120           - wiki
121           - wordpress
122         os:
123           - debian-12
124         exclude:
125           - suite: mailman
126             os: debian-12
127         include:
128           - suite: blog
129             os: ubuntu-2004
130           - suite: mailman
131             os: ubuntu-2004
132           - suite: stateofthemap-wordpress
133             os: ubuntu-2004
134           - suite: wordpress
135             os: ubuntu-2004
136           - suite: accounts
137             os: ubuntu-2204
138           - suite: apache
139             os: ubuntu-2204
140           - suite: apt
141             os: ubuntu-2204
142           - suite: bind
143             os: ubuntu-2204
144           - suite: chef
145             os: ubuntu-2204
146           - suite: db-backup
147             os: ubuntu-2204
148           - suite: db-base
149             os: ubuntu-2204
150           - suite: db-master
151             os: ubuntu-2204
152           - suite: db-slave
153             os: ubuntu-2204
154           - suite: devices
155             os: ubuntu-2204
156           - suite: dhcpd
157             os: ubuntu-2204
158           - suite: exim
159             os: ubuntu-2204
160           - suite: fail2ban
161             os: ubuntu-2204
162           - suite: git
163             os: ubuntu-2204
164           - suite: hardware
165             os: ubuntu-2204
166           - suite: networking
167             os: ubuntu-2204
168           - suite: ntp
169             os: ubuntu-2204
170           - suite: openssh
171             os: ubuntu-2204
172           - suite: postgresql
173             os: ubuntu-2204
174           - suite: prometheus
175             os: ubuntu-2204
176           - suite: python
177             os: ubuntu-2204
178           - suite: rsyncd
179             os: ubuntu-2204
180           - suite: ssl
181             os: ubuntu-2204
182           - suite: sysctl
183             os: ubuntu-2204
184           - suite: sysfs
185             os: ubuntu-2204
186           - suite: tools
187             os: ubuntu-2204
188       fail-fast: false
189     steps:
190     - name: Check out code
191       uses: actions/checkout@v6
192     - name: Extract cinc image details from .kitchen.yml
193       id: cinc-image
194       run: |
195         CINC_IMAGE=$(grep 'chef_image:' .kitchen.yml | head -1 | awk '{print $2}')
196         CINC_VERSION=$(grep 'chef_version:' .kitchen.yml | head -1 | awk '{print $2}')
197         echo "cinc_container_image=${CINC_IMAGE}" >> "$GITHUB_OUTPUT"
198         echo "cinc_container_version=${CINC_VERSION}" >> "$GITHUB_OUTPUT"
199         echo "cinc_container_ref=${CINC_IMAGE}:${CINC_VERSION}" >> "$GITHUB_OUTPUT"
200     - name: Login to GitHub Container Registry
201       uses: docker/login-action@v4
202       with:
203         registry: ghcr.io
204         username: ${{ github.actor }}
205         password: ${{ secrets.GITHUB_TOKEN }}
206     - name: Cache cinc container image
207       id: cache-cinc
208       uses: actions/cache@v5
209       with:
210         path: /tmp/cinc-image.tar
211         key: docker-cinc-${{ steps.cinc-image.outputs.cinc_container_version }}-${{ runner.arch }}
212     - name: Pull and save cinc container image
213       if: steps.cache-cinc.outputs.cache-hit != 'true'
214       run: |
215         docker pull "${{ steps.cinc-image.outputs.cinc_container_ref }}"
216         docker save "${{ steps.cinc-image.outputs.cinc_container_ref }}" -o /tmp/cinc-image.tar
217     - name: Load cinc container image from cache
218       if: steps.cache-cinc.outputs.cache-hit == 'true'
219       run: docker load -i /tmp/cinc-image.tar
220     - name: Setup ruby
221       uses: ruby/setup-ruby@v1
222       with:
223         bundler-cache: true
224     - name: Run kitchen test ${{ matrix.suite }}-${{ matrix.os }}
225       run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}
226     - name: Gather journal output
227       run: |
228         bundle exec kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl --since=yesterday"
229         bundle exec kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "networkctl status --all"
230         bundle exec kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "resolvectl status" || true
231       if: ${{ failure() }}