Linux + iPhone Continuity / iMessage / SMS
build: github workflows to validate distros
Zack Bartel0afdbcf4ed51
diff --git a/.github/workflows/arch.yml b/.github/workflows/arch.ymlnew file mode 100644index 0000000..65313d3--- /dev/null+++ b/.github/workflows/arch.yml@@ -0,0 +1,17 @@+name: Arch Linux++on:+ push:+ branches: [main, develop]+ pull_request:++concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: true++jobs:+ build:+ uses: ./.github/workflows/build.yml+ with:+ image: archlinux:base-devel+ release: truediff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlnew file mode 100644index 0000000..1e996e8--- /dev/null+++ b/.github/workflows/build.yml@@ -0,0 +1,45 @@+name: build++on:+ workflow_call:+ inputs:+ image:+ required: true+ type: string+ release:+ description: Also build the release preset.+ type: boolean+ default: false++jobs:+ build:+ runs-on: ubuntu-latest+ container: ${{ inputs.image }}+ steps:+ - name: bootstrap git+ run: |+ . /etc/os-release+ case ${ID_LIKE:-$ID} in+ *arch*) pacman -Sy --noconfirm --needed git ;;+ *fedora*) dnf install -y git ;;+ *debian*|*ubuntu*) apt-get update && apt-get install -y --no-install-recommends git ca-certificates ;;+ esac++ - uses: actions/checkout@v4++ - name: dependencies+ run: ./scripts/ci-deps.sh++ - name: build (debug)+ run: |+ cmake --preset debug+ cmake --build --preset debug++ - name: unit tests+ run: ctest --test-dir build/debug --output-on-failure++ - name: build (release)+ if: inputs.release+ run: |+ cmake --preset release+ cmake --build --preset releasediff --git a/.github/workflows/debian.yml b/.github/workflows/debian.ymlnew file mode 100644index 0000000..a4d40e6--- /dev/null+++ b/.github/workflows/debian.yml@@ -0,0 +1,16 @@+name: Debian++on:+ push:+ branches: [main, develop]+ pull_request:++concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: true++jobs:+ build:+ uses: ./.github/workflows/build.yml+ with:+ image: debian:unstablediff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.ymlnew file mode 100644index 0000000..1b4dd6a--- /dev/null+++ b/.github/workflows/fedora.yml@@ -0,0 +1,16 @@+name: Fedora++on:+ push:+ branches: [main, develop]+ pull_request:++concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: true++jobs:+ build:+ uses: ./.github/workflows/build.yml+ with:+ image: fedora:latestdiff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.ymlnew file mode 100644index 0000000..ff18db7--- /dev/null+++ b/.github/workflows/ubuntu.yml@@ -0,0 +1,16 @@+name: Ubuntu++on:+ push:+ branches: [main, develop]+ pull_request:++concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: true++jobs:+ build:+ uses: ./.github/workflows/build.yml+ with:+ image: ubuntu:latestdiff --git a/README.md b/README.mdindex 44b6c14..96eda4a 100644--- a/README.md+++ b/README.md@@ -8,6 +8,11 @@[](LICENSE)+[](https://github.com/zackb/tether/actions/workflows/arch.yml)+[](https://github.com/zackb/tether/actions/workflows/fedora.yml)+[](https://github.com/zackb/tether/actions/workflows/debian.yml)+[](https://github.com/zackb/tether/actions/workflows/ubuntu.yml)+[](https://addons.mozilla.org/en-US/firefox/addon/tether-browser-extension/)[](https://addons.thunderbird.net/en-US/thunderbird/addon/tether-mail-extension/)@@ -84,17 +89,19 @@ yay -S tetherOn Debian/Ubuntu:```bash-sudo apt install build-essential cmake pkg-config \+sudo apt install build-essential cmake ninja-build pkg-config git \libwayland-dev libavahi-client-dev libssl-dev \- libglib2.0-dev libgtk-3-dev libgtk-layer-shell-dev libnotify-dev+ libglib2.0-dev libgtk-3-dev libgtk-layer-shell-dev libnotify-dev \+ npm zip```On Fedora:```bash-sudo dnf install gcc-c++ cmake pkgconf-pkg-config \+sudo dnf install gcc-c++ cmake ninja-build pkgconf-pkg-config git \wayland-devel avahi-devel openssl-devel \- glib2-devel gtk3-devel gtk-layer-shell-devel libnotify-devel+ glib2-devel gtk3-devel gtk-layer-shell-devel libnotify-devel \+ npm zip``````bashdiff --git a/extension/build.sh b/extension/build.shindex 7676171..04286b3 100755--- a/extension/build.sh+++ b/extension/build.sh@@ -9,9 +9,10 @@ BROWSER_DIR="$BUILD_DIR/browser"MAIL_DIR="$BUILD_DIR/mail"CHROME_DIR="$BUILD_DIR/chromium"-# esbuild comes from extension/node_modules; without it npx would fetch an-# unpinned copy off the network mid-build-[ -d extension/node_modules ] || npm --prefix extension ci+# ubuntu, tries to add a second esbuild and then rejects the lockfile for not containing it.+[ -d extension/node_modules ] || npm --prefix extension ci --legacy-peer-deps++ESBUILD=extension/node_modules/.bin/esbuildmkdir -p "$BROWSER_DIR/src/background" "$BROWSER_DIR/src/content"mkdir -p "$MAIL_DIR/src/mail"@@ -19,23 +20,23 @@ mkdir -p "$CHROME_DIR/src/background" "$CHROME_DIR/src/content"# Bundle Firefox Browser Extensionecho "Bundling Firefox browser extension..."-npx esbuild extension/src/background/background.js --bundle --outfile="$BROWSER_DIR/src/background/background.js"-npx esbuild extension/src/content/autofill.js --bundle --outfile="$BROWSER_DIR/src/content/autofill.js"+"$ESBUILD" extension/src/background/background.js --bundle --outfile="$BROWSER_DIR/src/background/background.js"+"$ESBUILD" extension/src/content/autofill.js --bundle --outfile="$BROWSER_DIR/src/content/autofill.js"cp extension/manifest-browser.json "$BROWSER_DIR/manifest.json"if [ -d "extension/icons" ]; then cp -R extension/icons "$BROWSER_DIR/"; fi(cd "$BROWSER_DIR" && zip -qr ../tether-browser-extension.zip .)# Bundle Mail Extensionecho "Bundling mail extension..."-npx esbuild extension/src/mail/extractor.js --bundle --outfile="$MAIL_DIR/src/mail/extractor.js"+"$ESBUILD" extension/src/mail/extractor.js --bundle --outfile="$MAIL_DIR/src/mail/extractor.js"cp extension/manifest-mail.json "$MAIL_DIR/manifest.json"if [ -d "extension/icons" ]; then cp -R extension/icons "$MAIL_DIR/"; fi(cd "$MAIL_DIR" && zip -qr ../tether-mail-extension.xpi .)# Bundle Chromium Extension (Web Store upload)echo "Bundling Chromium extension..."-npx esbuild extension/src/background/background.js --bundle --outfile="$CHROME_DIR/src/background/background.js"-npx esbuild extension/src/content/autofill.js --bundle --outfile="$CHROME_DIR/src/content/autofill.js"+"$ESBUILD" extension/src/background/background.js --bundle --outfile="$CHROME_DIR/src/background/background.js"+"$ESBUILD" extension/src/content/autofill.js --bundle --outfile="$CHROME_DIR/src/content/autofill.js"cp extension/manifest-browser.json "$CHROME_DIR/manifest.json"if [ -d "extension/icons" ]; then cp -R extension/icons "$CHROME_DIR/"; fi(cd "$CHROME_DIR" && zip -qr ../tether-chromium-extension.zip .)diff --git a/scripts/ci-deps.sh b/scripts/ci-deps.shnew file mode 100755index 0000000..beac020--- /dev/null+++ b/scripts/ci-deps.sh@@ -0,0 +1,44 @@+#!/bin/bash+# Install everything needed to build and test tether, on Arch, Fedora, Debian or Ubuntu.+#+# ./scripts/ci-deps.sh+#+# This installs system-wide.++set -eu++. /etc/os-release++case ${ID_LIKE:-$ID} in+ *arch*)+ pacman -Syu --noconfirm --needed \+ base-devel cmake ninja git pkgconf \+ wayland avahi openssl glib2 \+ gtk3 gtk-layer-shell libnotify \+ npm zip+ ;;+ *fedora*)+ dnf install -y \+ gcc-c++ cmake ninja-build git pkgconf-pkg-config \+ wayland-devel avahi-devel openssl-devel glib2-devel \+ gtk3-devel gtk-layer-shell-devel libnotify-devel \+ npm zip+ ;;+ *debian*|*ubuntu*)+ export DEBIAN_FRONTEND=noninteractive+ apt-get update+ apt-get install -y --no-install-recommends \+ g++ cmake ninja-build git pkg-config ca-certificates \+ libwayland-dev libavahi-client-dev libssl-dev libglib2.0-dev \+ libgtk-3-dev libgtk-layer-shell-dev libnotify-dev \+ npm zip+ ;;+ *)+ echo "ci-deps: unsupported distro: ${ID:-unknown}" >&2+ exit 1+ ;;+esac++pkg-config --print-errors --exists \+ "wayland-client avahi-client openssl glib-2.0 gio-2.0 gtk+-3.0 gtk-layer-shell-0 libnotify"+echo "==> ready: gtk $(pkg-config --modversion gtk+-3.0), openssl $(pkg-config --modversion openssl)"