fork/static-web-server

git clone https://git.julia.blue/fork/static-web-server

Jose Quintanarefactor: update github ci workflows (#514)1c4929d

allow-symlink
7.3 KiB249 linesraw
1name: devel-docker
2on:
3  merge_group:
4    branches:
5      - master
6  pull_request:
7    paths:
8      - docker/**/Dockerfile
9      - scripts/ci/**/*.sh
10      - .github/workflows/devel.docker.yml
11  push:
12    branches:
13      - master
14    paths:
15      - docker/**/Dockerfile
16      - scripts/ci/**/*.sh
17      - .github/workflows/devel.docker.yml
18
19env:
20  DOCKER_IMAGE: localhost:5000/github.com/static-web-server/static-web-server
21
22jobs:
23  docker-alpine:
24    name: Docker test (alpine)
25    strategy:
26      matrix:
27        arch:
28          - linux/amd64
29          - linux/386
30          - linux/arm64
31          - linux/arm/v7
32          - linux/arm/v6
33    runs-on: ubuntu-22.04
34    services:
35      registry:
36        image: registry:2
37        ports:
38          - 5000:5000
39    steps:
40      -
41        name: Dependencies
42        run: |
43          sudo apt-get install jq
44      -
45        name: Checkout
46        uses: actions/checkout@v4
47        with:
48          fetch-depth: 1
49      -
50        name: Cache Docker layers
51        uses: actions/cache@v4
52        with:
53          path: /tmp/.buildx-cache
54          key: static-web-server-${{ matrix.arch }}-alpine-buildx-${{ github.sha }}
55          restore-keys: |
56            static-web-server-${{ matrix.arch }}-alpine-buildx-
57      -
58        name: Set up QEMU
59        uses: docker/setup-qemu-action@v3
60      -
61        name: Docker meta alpine
62        id: meta_alpine
63        uses: docker/metadata-action@v5
64        with:
65          images: ${{ env.DOCKER_IMAGE }}
66          flavor: |
67            latest=false
68            suffix=-alpine
69          tags: |
70            type=schedule
71            type=ref,event=branch
72            type=ref,event=pr
73            type=semver,pattern={{version}}
74            type=semver,pattern={{major}}.{{minor}}
75            type=semver,pattern={{major}}
76            type=sha
77      -
78        name: Set up Docker Buildx
79        uses: docker/setup-buildx-action@v3
80        with:
81          driver-opts: network=host
82      -
83        name: Prepare Docker envs
84        shell: bash
85        env:
86          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87        run: |
88          scripts/ci/get_latest_release.sh
89          cat /tmp/version >> $GITHUB_ENV
90          cat /tmp/version
91          echo "SERVER_DOCKERFILE=./docker/alpine/Dockerfile" >> $GITHUB_ENV
92      -
93        name: Build and export to Docker client
94        uses: docker/build-push-action@v6
95        with:
96          context: .
97          platforms: ${{ matrix.arch }}
98          file: ${{ env.SERVER_DOCKERFILE }}
99          load: true
100          tags: ${{ steps.meta_alpine.outputs.tags }}
101          labels: ${{ steps.meta_alpine.outputs.labels }}
102          build-args: |
103            SERVER_VERSION=${{ env.SERVER_VERSION }}
104      -
105        name: Build and push to local registry
106        uses: docker/build-push-action@v6
107        with:
108          context: .
109          platforms: ${{ matrix.arch }}
110          file: ${{ env.SERVER_DOCKERFILE }}
111          push: ${{ github.event_name != 'pull_request' }}
112          tags: ${{ steps.meta_alpine.outputs.tags }}
113          labels: ${{ steps.meta_alpine.outputs.labels }}
114          build-args: |
115            SERVER_VERSION=${{ env.SERVER_VERSION }}
116          cache-from: type=local,src=/tmp/.buildx-cache
117          cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
118      -
119        name: Inspect image
120        run: |
121          docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_alpine.outputs.version }}
122      -
123        name: Check manifest
124        if: github.event_name != 'pull_request'
125        run: |
126          docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_alpine.outputs.version }}
127      -
128        # Temp fix
129        # https://github.com/docker/build-push-action/issues/252
130        # https://github.com/moby/buildkit/issues/1896
131        name: Move cache
132        run: |
133          rm -rf /tmp/.buildx-cache
134          mv /tmp/.buildx-cache-new /tmp/.buildx-cache
135
136  docker-debian:
137    name: Docker test (debian)
138    strategy:
139      matrix:
140        arch:
141          - linux/amd64
142          - linux/386
143          - linux/arm64
144          - linux/arm/v7
145          - linux/arm/v6
146          - linux/ppc64le
147          - linux/s390x
148    runs-on: ubuntu-22.04
149    services:
150      registry:
151        image: registry:2
152        ports:
153          - 5000:5000
154    steps:
155      -
156        name: Dependencies
157        run: |
158          sudo apt-get install jq
159      -
160        name: Checkout
161        uses: actions/checkout@v4
162        with:
163          fetch-depth: 1
164      -
165        name: Cache Docker layers
166        uses: actions/cache@v4
167        with:
168          path: /tmp/.buildx-cache
169          key: static-web-server-${{ matrix.arch }}-debian-buildx-${{ github.sha }}
170          restore-keys: |
171            static-web-server-${{ matrix.arch }}-debian-buildx-
172      -
173        name: Set up QEMU
174        uses: docker/setup-qemu-action@v3
175      -
176        name: Docker meta debian
177        id: meta_debian
178        uses: docker/metadata-action@v5
179        with:
180          images: ${{ env.DOCKER_IMAGE }}
181          flavor: |
182            latest=false
183            suffix=-debian
184          tags: |
185            type=schedule
186            type=ref,event=branch
187            type=ref,event=pr
188            type=semver,pattern={{version}}
189            type=semver,pattern={{major}}.{{minor}}
190            type=semver,pattern={{major}}
191            type=sha
192      -
193        name: Set up Docker Buildx
194        uses: docker/setup-buildx-action@v3
195        with:
196          driver-opts: network=host
197      -
198        name: Prepare Docker envs
199        shell: bash
200        env:
201          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
202        run: |
203          scripts/ci/get_latest_release.sh
204          cat /tmp/version >> $GITHUB_ENV
205          cat /tmp/version
206          echo "SERVER_DOCKERFILE=./docker/debian/Dockerfile" >> $GITHUB_ENV
207      -
208        name: Build and export to Docker client
209        uses: docker/build-push-action@v6
210        with:
211          context: .
212          platforms: ${{ matrix.arch }}
213          file: ${{ env.SERVER_DOCKERFILE }}
214          load: true
215          tags: ${{ steps.meta_debian.outputs.tags }}
216          labels: ${{ steps.meta_debian.outputs.labels }}
217          build-args: |
218            SERVER_VERSION=${{ env.SERVER_VERSION }}
219      -
220        name: Build and push to local registry
221        uses: docker/build-push-action@v6
222        with:
223          context: .
224          platforms: ${{ matrix.arch }}
225          file: ${{ env.SERVER_DOCKERFILE }}
226          push: ${{ github.event_name != 'pull_request' }}
227          tags: ${{ steps.meta_debian.outputs.tags }}
228          labels: ${{ steps.meta_debian.outputs.labels }}
229          build-args: |
230            SERVER_VERSION=${{ env.SERVER_VERSION }}
231          cache-from: type=local,src=/tmp/.buildx-cache
232          cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
233      -
234        name: Inspect image
235        run: |
236          docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_debian.outputs.version }}
237      -
238        name: Check manifest
239        if: github.event_name != 'pull_request'
240        run: |
241          docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta_debian.outputs.version }}
242      -
243        # Temp fix
244        # https://github.com/docker/build-push-action/issues/252
245        # https://github.com/moby/buildkit/issues/1896
246        name: Move cache
247        run: |
248          rm -rf /tmp/.buildx-cache
249          mv /tmp/.buildx-cache-new /tmp/.buildx-cache