Files
curl-impersonate/.github/workflows/build-and-test.yml
lwthiker 867f23fb58 Use local Docker registry in GitHub Action
The tests container copies files from the build containers. In order for
this to work in the GitHub actions workflow, the build images need to be
uploaded to a local Docker registry first.
2022-03-05 10:20:07 +02:00

57 lines
1.6 KiB
YAML

name: Build and test
on:
pull_request:
branches:
- main
jobs:
build-and-test:
name: Build curl-impersonate 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
- 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
- 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
- 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