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