265 lines
8.5 KiB
YAML
265 lines
8.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.sha }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
secret-scan:
|
|
name: Secret Scan
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch Ziran packages
|
|
uses: ./.github/actions/ziran-packages
|
|
with:
|
|
save-toolchain: 'false'
|
|
|
|
- name: Check Version Consistency
|
|
run: |
|
|
python3 scripts/check-version.py
|
|
python3 tests/version_test.py
|
|
|
|
- name: Scan Tracked Files and History
|
|
run: |
|
|
set -euo pipefail
|
|
python3 scripts/check-secrets.py --working-tree
|
|
python3 scripts/check-secrets.py --history
|
|
|
|
# The pre-commit hook runs the same check on staged files.
|
|
- name: Refuse new files over 1 MB
|
|
env:
|
|
BEFORE: ${{ github.event.before }}
|
|
BASE_REF: ${{ github.base_ref }}
|
|
run: |
|
|
set -eu
|
|
if [ -n "$BASE_REF" ]; then
|
|
base=$(git merge-base "origin/$BASE_REF" HEAD)
|
|
elif [ -n "$BEFORE" ] && git cat-file -e "$BEFORE^{commit}" 2>/dev/null; then
|
|
base=$BEFORE
|
|
else
|
|
base=HEAD~1
|
|
fi
|
|
python3 scripts/check-file-size.py --since "$base"
|
|
|
|
google-free:
|
|
name: Google libraries only in the gplay edition
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
# The normal and F-Droid builds read no Google library or plugin; only
|
|
# gplay-scoped configurations and gplay files may name one.
|
|
- name: Keep Google libraries out of the normal and F-Droid build files
|
|
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
|
|
|
guard-package-urls:
|
|
name: Package URLs are public HTTPS
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Plain checkout on purpose: the guard must not depend on fetching
|
|
# the packages it validates (an SSH URL would break that fetch).
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Reject submodules and non-HTTPS package URLs
|
|
run: |
|
|
set -eu
|
|
if [ -f .gitmodules ]; then
|
|
echo "::error::Dependencies are Ziran packages in ziran.toml, not submodules"
|
|
exit 1
|
|
fi
|
|
bad=$(grep -nE '^[[:space:]]*git[[:space:]]*=' ziran.toml \
|
|
| grep -vE '^[0-9]+:[[:space:]]*git[[:space:]]*=[[:space:]]*"https://' || true)
|
|
if [ -n "$bad" ]; then
|
|
echo "::error::Non-HTTPS package URL(s) break fresh clones and CI:$bad"
|
|
exit 1
|
|
fi
|
|
echo "all package URLs HTTPS - ok"
|
|
|
|
test:
|
|
# make test split across runners; each shard is a third of its targets.
|
|
name: Test (${{ matrix.shard }}/3)
|
|
runs-on: ubuntu-latest
|
|
# Secret Scan runs beside the tests; nothing here publishes, so it need not gate them.
|
|
needs:
|
|
- guard-package-urls
|
|
timeout-minutes: 60
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [0, 1, 2]
|
|
env:
|
|
APT_CACHE_DIR: /tmp/apt-cache
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
lfs: true
|
|
|
|
- name: Fetch Ziran packages
|
|
uses: ./.github/actions/ziran-packages
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '21'
|
|
|
|
- name: Cache Test apt packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.APT_CACHE_DIR }}
|
|
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
|
|
restore-keys: |
|
|
test-apt-${{ runner.os }}-${{ runner.arch }}-
|
|
|
|
- name: Install Test Dependencies
|
|
timeout-minutes: 15
|
|
run: .github/scripts/install-apt-packages.sh .github/apt/test-packages.txt
|
|
|
|
- name: Run Tests
|
|
run: sh scripts/test-shard.sh ${{ matrix.shard }} 3
|
|
|
|
- name: Read sync test server revision
|
|
if: matrix.shard == 0
|
|
id: sync-test-server
|
|
run: echo "revision=$(cat .github/sync-test-server-commit)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Check out sync test server
|
|
if: matrix.shard == 0
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: kryonlabs/daochi
|
|
# Includes signed photo copies (blobs) and the private Lumi
|
|
# collection used for shared account activity.
|
|
ref: ${{ steps.sync-test-server.outputs.revision }}
|
|
path: .test-server
|
|
submodules: recursive
|
|
|
|
- name: Set up Go for sync test server
|
|
if: matrix.shard == 0
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: .test-server/go.mod
|
|
cache-dependency-path: .test-server/go.sum
|
|
|
|
- name: Verify sync and recovery
|
|
if: matrix.shard == 0
|
|
run: |
|
|
# The server generates its Go with Ziran, Breeze's own toolchain.
|
|
make "$GITHUB_WORKSPACE/build/ziran-toolchain/bin/zi2c"
|
|
make -C .test-server build ZIRAN="$GITHUB_WORKSPACE/build/ziran-toolchain/bin/ziran"
|
|
make sync-server-test DAOCHI_BIN="$GITHUB_WORKSPACE/.test-server/daochi"
|
|
|
|
browser-addons:
|
|
# Builds the web app once, packages it for Chrome and Firefox, and runs
|
|
# the smoke test in both browsers. It runs beside the tests; a failure in
|
|
# either still fails the run.
|
|
name: Build Browser Add-ons
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
needs:
|
|
- guard-package-urls
|
|
env:
|
|
APT_CACHE_DIR: /tmp/apt-cache
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
lfs: true
|
|
|
|
- name: Fetch Ziran packages
|
|
uses: ./.github/actions/ziran-packages
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Cache Web apt packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.APT_CACHE_DIR }}
|
|
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
|
|
restore-keys: |
|
|
web-apt-${{ runner.os }}-${{ runner.arch }}-
|
|
|
|
- name: Install Web Dependencies
|
|
timeout-minutes: 15
|
|
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt python3-pil
|
|
|
|
- name: Set up Emscripten
|
|
uses: ./.github/actions/emscripten
|
|
|
|
- name: Build Chrome and Firefox ZIPs
|
|
run: |
|
|
set -euo pipefail
|
|
export PATH="$INBE_NODE_BIN:$PATH"
|
|
node --version
|
|
make package-unpackaged-assets
|
|
make chrome-web-store
|
|
test -f build/dist/inbe-chrome-web-store.zip
|
|
make firefox-addons
|
|
test -f build/dist/inbe-firefox-addons.zip
|
|
make firefox-addons-lint
|
|
|
|
# The web build renders on canvas, so this is also the canvas smoke
|
|
# test.
|
|
- name: Run Web Smoke Test (Chrome)
|
|
run: |
|
|
set -euo pipefail
|
|
export PATH="$INBE_NODE_BIN:$PATH"
|
|
make web-smoke-test
|
|
|
|
- name: Install Firefox (Mozilla build)
|
|
timeout-minutes: 15
|
|
run: |
|
|
set -euo pipefail
|
|
.github/scripts/install-apt-packages.sh .github/apt/empty-packages.txt \
|
|
xvfb libgl1-mesa-dri libgl1 libegl1 mesa-utils || true
|
|
.github/scripts/install-apt-packages.sh .github/apt/empty-packages.txt \
|
|
libgtk-3-0t64 libx11-xcb1 libxcb-shm0 libasound2t64 libdbus-glib-1-2 \
|
|
libxt6t64 libxtst6 libpci3 || \
|
|
.github/scripts/install-apt-packages.sh .github/apt/empty-packages.txt \
|
|
libgtk-3-0 libx11-xcb1 libxcb-shm0 libasound2 libdbus-glib-1-2 libxt6 libxtst6 libpci3
|
|
curl -sL "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US" \
|
|
-o "$HOME/firefox.tar.xz"
|
|
tar -xJf "$HOME/firefox.tar.xz" -C "$HOME"
|
|
test -x "$HOME/firefox/firefox"
|
|
echo "$HOME/firefox" >> "$GITHUB_PATH"
|
|
|
|
- name: Run Web Smoke Test (Firefox)
|
|
env:
|
|
LIBGL_ALWAYS_SOFTWARE: '1'
|
|
run: |
|
|
set -euo pipefail
|
|
export PATH="$INBE_NODE_BIN:$PATH"
|
|
xvfb-run -a --server-args="-screen 0 1280x1024x24" make web-smoke-test-firefox
|