Build on macos-14 GitHub runner (Mac M1) in CI #239
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker images | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-docker-and-test: | |
name: Build curl-impersonate Docker images and run the tests | |
runs-on: ubuntu-latest | |
services: | |
# A local registry is needed to push the build images to because we use | |
# the 'docker-container' driver. See | |
# https://github.com/docker/buildx/issues/301 | |
# and | |
# See https://github.com/docker/build-push-action/blob/master/docs/advanced/local-registry.md | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
driver-opts: network=host | |
# Set up Docker caching. See | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: | | |
/tmp/.buildx-cache-ff | |
/tmp/.buildx-cache-ch | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build the Chrome version of curl-impersonate | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: chrome/ | |
tags: localhost:5000/curl-impersonate/chrome | |
cache-from: type=local,src=/tmp/.buildx-cache-ch | |
cache-to: type=local,dest=/tmp/.buildx-cache-ch-new,mode=max | |
- name: Build the Firefox version of curl-impersonate | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: firefox/ | |
tags: localhost:5000/curl-impersonate/ff | |
cache-from: type=local,src=/tmp/.buildx-cache-ff | |
cache-to: type=local,dest=/tmp/.buildx-cache-ff-new,mode=max | |
- name: Build the tests container | |
uses: docker/build-push-action@v2 | |
with: | |
load: true | |
context: tests/ | |
tags: curl-impersonate-tests:latest | |
build-args: | | |
FIREFOX_IMAGE=localhost:5000/curl-impersonate/ff | |
CHROME_IMAGE=localhost:5000/curl-impersonate/chrome | |
- name: Run the tests | |
run: docker run --rm curl-impersonate-tests --log-cli-level DEBUG | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache-ff | |
mv /tmp/.buildx-cache-ff-new /tmp/.buildx-cache-ff | |
rm -rf /tmp/.buildx-cache-ch | |
mv /tmp/.buildx-cache-ch-new /tmp/.buildx-cache-ch |