Files
curl-impersonate/.github/workflows/build-and-test-make.yml
T
lwthiker 92a5b8c7ab Add support for impersonating Firefox 100
Add support for impersonating Firefox 100. The TLS signature is identical to
previous versions of Firefox.

In addition, upgrade NSS (Firefox's TLS library) to version 3.77 used by
Firefox 100. This is not strictly necessary as the previous version used
works just fine, but it's better keep up with the newest version.
2022-05-15 20:50:45 +03:00

181 lines
6.3 KiB
YAML

name: Build and test
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main
env:
NSS_VERSION: nss-3.77
BORING_SSL_COMMIT: 3a667d10e94186fd503966f5638e134fe9fb4080
jobs:
build-and-test:
name: Build curl-impersonate and run the tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-11]
include:
- os: ubuntu-20.04
capture_interface: eth0
make: make
release_name: x86_64-linux-gnu
- os: macos-11
capture_interface: en0
make: gmake
release_name: x86_64-macos
steps:
- uses: actions/setup-python@v3
- name: Install Ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install build-essential pkg-config cmake ninja-build curl autoconf automake libtool
# Chrome version dependencies
sudo apt-get install golang-go
# Needed to compile 'minicurl'
sudo apt-get install libcurl4-openssl-dev
# More dependencies for the tests
sudo apt-get install tcpdump nghttp2-server libnss3
- name: Install macOS dependencies
if: matrix.os == 'macos-11'
run: |
brew install pkg-config make cmake ninja autoconf automake libtool
# Chrome version dependencies
# (Go is already installed)
# brew install go
# Needed to compile 'minicurl'
brew install curl
# More dependencies for the tests
brew install tcpdump nghttp2 nss
- name: Install common dependencies
run: |
# Firefox version dependencies
pip3 install gyp-next
- name: Check out the repo
uses: actions/checkout@v2
- name: Install dependencies for the tests script
run: |
pip3 install -r tests/requirements.txt
- name: Run configure script
run: |
autoconf
mkdir ${{ runner.temp }}/install
./configure --prefix=${{ runner.temp }}/install
# Cache the build of BoringSSL, which is the longest part of the build
# We must cache the .zip as well, otherwise the Makefile will
# rebuild BoringSSL. This whole thing is a bit hacky, but necessary to
# reduce the insanely long build times.
- name: Cache BoringSSL source
uses: actions/cache@v3
with:
path: boringssl.zip
key: ${{ runner.os }}-boring-source-${{ env.BORING_SSL_COMMIT }}
- name: Cache BoringSSL build
id: cache-boringssl
uses: actions/cache@v3
with:
path: boringssl/build
key: ${{ runner.os }}-boring-build-${{ env.BORING_SSL_COMMIT }}-${{ hashFiles('chrome/patches/boringssl*.patch') }}
# Trick the Makefile into skipping the BoringSSL build step
# if it was found in the cache. See Makefile.in
- name: Post BoringSSL cache restore
if: ${{ steps.cache-boringssl.outputs.cache-hit != false }}
run: |
touch boringssl.zip
touch boringssl/.patched
find boringssl/build -type f | xargs touch
- name: Build the Chrome version of curl-impersonate
run: |
${{ matrix.make }} chrome-build
${{ matrix.make }} chrome-checkbuild
${{ matrix.make }} chrome-install
# Cache the build of NSS, which is the longest part of the build
# We must cache the .tar.gz as well, otherwise the Makefile will
# rebuild NSS.
- name: Cache NSS source
uses: actions/cache@v3
with:
path: ${{ env.NSS_VERSION }}.tar.gz
key: ${{ runner.os }}-nss-source-${{ env.NSS_VERSION }}
- name: Cache NSS build
id: cache-nss
uses: actions/cache@v3
with:
path: ${{ env.NSS_VERSION }}/dist
key: ${{ runner.os }}-nss-build-${{ env.NSS_VERSION }}
# Trick the Makefile into skipping the NSS build step
# if it was found in the cache.
- name: Post NSS cache restore
if: ${{ steps.cache-nss.outputs.cache-hit != false }}
run: |
touch ${{ env.NSS_VERSION }}.tar.gz
find ${{ env.NSS_VERSION }}/dist -type f | xargs touch
- name: Build the Firefox version of curl-impersonate
run: |
${{ matrix.make }} firefox-build
${{ matrix.make }} firefox-checkbuild
${{ matrix.make }} firefox-install
- name: Prepare the tests
run: |
# Compile 'minicurl' which is used by the tests
gcc -Wall -Werror -o ${{ runner.temp }}/install/bin/minicurl tests/minicurl.c `curl-config --libs`
- name: Run the tests
run: |
cd tests
# sudo is needed for capturing packets
python_bin=$(which python3)
sudo $python_bin -m pytest . --log-cli-level DEBUG --install-dir ${{ runner.temp }}/install --capture-interface ${{ matrix.capture_interface }}
# If it's a tag, create a release and upload the binaries.
# For that we recompile curl-impersonate statically.
- name: Recompile statically for release assets
if: startsWith(github.ref, 'refs/tags/')
run: |
${{ matrix.make }} chrome-clean
${{ matrix.make }} firefox-clean
rm -Rf ${{ runner.temp }}/install
mkdir ${{ runner.temp }}/install
./configure --prefix=${{ runner.temp }}/install --enable-static
${{ matrix.make }} chrome-build
${{ matrix.make }} chrome-checkbuild
${{ matrix.make }} chrome-install-strip
${{ matrix.make }} firefox-build
${{ matrix.make }} firefox-checkbuild
${{ matrix.make }} firefox-install-strip
- name: Create tar release files
if: startsWith(github.ref, 'refs/tags/')
run: |
cd ${{ runner.temp }}/install/bin
tar -c -z -f ${{ runner.temp }}/curl-impersonate-${{ github.ref_name }}.${{ matrix.release_name }}.tar.gz curl-impersonate-ff curl-impersonate-chrome curl_*
echo "release_file=${{ runner.temp }}/curl-impersonate-${{ github.ref_name }}.${{ matrix.release_name }}.tar.gz" >> $GITHUB_ENV
- name: Upload release files
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.release_file }}