mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00

* Update dependencies * Node 22 is now the new minimum version. * changelog. * Begin porting eslint to new config format. * Make linter happy. * Update reqwest to fix SSL issue? * Fix test types * quick check on ubuntu LTS 24.04 * Change cache key * update rust action * revert mocha due to esminess * Remove the only usage of pqueue * Use babel for TS transformations to get around ESM import bug. * Dependency bundle upgrade * Drop babel, not actually used. * lint * lint * update default config (mostly sections moving around)
166 lines
4.7 KiB
YAML
166 lines
4.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths-ignore:
|
|
- changelog.d/**'
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths-ignore:
|
|
- changelog.d/**'
|
|
|
|
workflow_dispatch:
|
|
merge_group:
|
|
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint-node:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .node-version
|
|
- run: yarn --ignore-scripts
|
|
- run: yarn lint:js
|
|
|
|
lint-rust:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: rustfmt
|
|
- run: cargo fmt --all -- --check
|
|
- run: cargo clippy -- -Dwarnings
|
|
|
|
config:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .node-version
|
|
- run: yarn # Need to build scripts to get rust bindings
|
|
- run: yarn --silent ts-node src/config/Defaults.ts --config | diff config.sample.yml -
|
|
|
|
metrics-docs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .node-version
|
|
- run: yarn # Need to build scripts to get rust bindings
|
|
- run: yarn --silent ts-node ./scripts/build-metrics-docs.ts | diff docs/metrics.md -
|
|
|
|
test:
|
|
# Test on LTS-1
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
matrix:
|
|
node_version: [22, 23]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Use Node.js ${{ matrix.node_version }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node_version }}
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: ubuntu-2204-rust-cache
|
|
- run: yarn
|
|
- run: yarn test:cover
|
|
|
|
build-homerunner:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
homerunnersha: ${{ steps.gitsha.outputs.sha }}
|
|
steps:
|
|
- name: Checkout matrix-org/complement
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: matrix-org/complement
|
|
- name: Get complement git sha
|
|
id: gitsha
|
|
run: echo sha=`git rev-parse --short HEAD` >> "$GITHUB_OUTPUT"
|
|
- name: Cache homerunner
|
|
id: cached
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: homerunner
|
|
key: ${{ runner.os }}-homerunner-${{ steps.gitsha.outputs.sha }}
|
|
- name: "Set Go Version"
|
|
if: ${{ steps.cached.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
echo "$GOROOT_1_18_X64/bin" >> $GITHUB_PATH
|
|
echo "~/go/bin" >> $GITHUB_PATH
|
|
# Build and install homerunner
|
|
- name: Install Complement Dependencies
|
|
if: ${{ steps.cached.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev
|
|
- name: Build homerunner
|
|
if: ${{ steps.cached.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
go build ./cmd/homerunner
|
|
|
|
integration-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
needs:
|
|
- test
|
|
- build-homerunner
|
|
services:
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379:6379
|
|
steps:
|
|
- name: Install Complement Dependencies
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y libolm3
|
|
- name: Load cached homerunner bin
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: homerunner
|
|
key: ${{ runner.os }}-homerunner-${{ needs.build-synapse.outputs.homerunnersha }}
|
|
fail-on-cache-miss: true # Shouldn't happen, we build this in the needs step.
|
|
- name: Checkout matrix-hookshot
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: matrix-hookshot
|
|
# Setup node & run tests
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: matrix-hookshot/.node-version
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: matrix-hookshot
|
|
shared-key: rust-cache
|
|
- name: Run Homerunner tests
|
|
timeout-minutes: 10
|
|
env:
|
|
HOMERUNNER_SPAWN_HS_TIMEOUT_SECS: 100
|
|
HOMERUNNER_IMAGE: ghcr.io/element-hq/synapse/complement-synapse:nightly
|
|
NODE_OPTIONS: --dns-result-order ipv4first
|
|
REDIS_DATABASE_URI: "redis://localhost:6379"
|
|
run: |
|
|
docker pull $HOMERUNNER_IMAGE
|
|
cd matrix-hookshot
|
|
yarn --strict-semver --frozen-lockfile
|
|
../homerunner &
|
|
bash -ic 'yarn test:e2e' |