name: Build and test on: push: branches: - main pull_request: branches: - main 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 - os: macos-11 capture_interface: en0 make: gmake steps: - uses: actions/setup-python@v3 - name: Install Ubuntu dependencies if: matrix.os == 'ubuntu-20.04' run: | sudo apt install build-essential pkg-config cmake ninja-build curl autoconf automake libtool # Chrome version dependencies sudo apt install golang-go # Needed to compile 'minicurl' sudo apt install libcurl4-openssl-dev # More dependencies for the tests sudo apt 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 - name: Build the Chrome version of curl-impersonate run: | ${{ matrix.make }} chrome-build ${{ matrix.make }} chrome-checkbuild ${{ matrix.make }} chrome-install - 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 }}