Typofixes #1077
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: CI | |
on: [push, pull_request] | |
env: | |
HTTPTOOLKIT_SERVER_DISABLE_AUTOUPDATE: 1 # Don't try to autoupdate during tests etc | |
jobs: | |
build: | |
name: Build & test | |
runs-on: ubuntu-22.04 | |
container: | |
image: httptoolkit/act-build-base:v3.0.0 | |
options: "--privileged" # Required for DIND tests | |
env: | |
DIND_HOST: unix:///tmp/docker.sock | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.11.1 | |
- run: npm install -g npm@^8 | |
- name: Set up JDK 11 for Java testing | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: adopt-hotspot | |
- run: npm ci | |
env: | |
NPM_CONFIG_UNSAFE_PERM: true | |
- run: npm run build:src | |
- name: Prepare test environment | |
run: | | |
# Fix annoying Yarn issue: https://github.com/yarnpkg/yarn/issues/7866 | |
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
# Ditto but for Google: | |
curl -sL https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install -y p7zip-full xterm | |
wget https://downloads.slack-edge.com/linux_releases/slack-desktop-4.12.2-amd64.deb | |
sudo apt install -y ./slack-desktop-4.12.2-amd64.deb | |
sudo cp test/no-sandbox-docker-wrapper.sh /usr/local/bin/google-chrome | |
sudo cp test/no-sandbox-docker-wrapper.sh /usr/local/bin/slack | |
# Fix $HOME perms to make Firefox happy | |
sudo chown $(whoami) $HOME | |
# Start a DIND docker host, running in the background | |
sudo dockerd -H $DIND_HOST & | |
sleep 5 | |
# Pre-pull lots of the Docker images we'll want to use later | |
echo node:14 golang:1.16 openjdk:16-alpine3.13 python:3.9-slim ruby:alpine3.13 php:8.0-apache | | |
DOCKER_HOST=$DIND_HOST xargs -P10 -n1 docker pull | |
- run: DOCKER_HOST=$DIND_HOST xvfb-run npm run test | |
- run: npm run build:release | |
env: | |
SENTRY_AUTH_TOKEN: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && secrets.SENTRY_AUTH_TOKEN) || '' }} | |
SENTRY_ORG: http-toolkit | |
SENTRY_PROJECT: httptoolkit-server | |
NPM_CONFIG_UNSAFE_PERM: true | |
- run: DOCKER_HOST=$DIND_HOST xvfb-run npm run test:integration:release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: distributables | |
path: build/dist/* | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: test-scripts | |
path: test/distributables-test | |
if-no-files-found: error | |
test-distributables: | |
needs: build | |
strategy: | |
matrix: | |
include: | |
- platform: Ubuntu 24.04 | |
os: "ubuntu-24.04" | |
test-script: "./unix.sh linux" | |
- platform: Ubuntu 22.04 | |
os: "ubuntu-22.04" | |
test-script: "./unix.sh linux" | |
- platform: Ubuntu 20.04 | |
os: "ubuntu-20.04" | |
test-script: "./unix.sh linux" | |
- platform: MacOS 14 (M1) | |
os: "macos-14" | |
test-script: "./unix.sh darwin" | |
- platform: MacOS 13 | |
os: "macos-13" | |
test-script: "./unix.sh darwin" | |
- platform: MacOS 12 | |
os: "macos-12" | |
test-script: "./unix.sh darwin" | |
- platform: Windows 2022 | |
os: "windows-2022" | |
test-script: ".\\windows.bat" | |
- platform: Windows 2019 | |
os: "windows-2019" | |
test-script: ".\\windows.bat" | |
fail-fast: false | |
name: Test on ${{ matrix.platform }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Get our distributables | |
uses: actions/download-artifact@v4 | |
with: | |
name: distributables | |
path: distributables | |
- name: Get the test scripts | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-scripts | |
path: . | |
- name: Make the test script executable | |
if: matrix.platform != 'Windows' | |
run: chmod +x unix.sh | |
- name: Test the server build | |
run: ${{ matrix.test-script }} | |
publish: | |
name: Publish a release | |
runs-on: "ubuntu-22.04" | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- build | |
- test-distributables | |
steps: | |
- name: Get our distributables | |
uses: actions/download-artifact@v4 | |
with: | |
name: distributables | |
path: distributables | |
- name: Upload server release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./distributables/*/* | |
file_glob: true | |
tag: ${{ github.ref }} | |
- name: Upload latest manifest | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./distributables/latest-manifest/* | |
file_glob: true | |
tag: latest-manifest | |
overwrite: true |