mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2026-10-10 19:36:32 +00:00
Use configurable binaries directory in the tests
Locate curl-impersonate and libcurl-impersonate in a directory which is configurable from the command line instead of looking for them in the current directory. '--install-dir' is passed to pytest, where a 'bin' and 'lib' directories are expected with (lib)curl-impersonate. Rename the Actions file for the Docker build to allow the creation of addition Action for native builds.
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
name: Docker images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-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
|
||||
Reference in New Issue
Block a user