2022-03-24 06:52:51 -05:00
|
|
|
name: Dendrite
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-03-24 07:40:44 -05:00
|
|
|
branches:
|
|
|
|
- main
|
2022-03-24 06:52:51 -05:00
|
|
|
pull_request:
|
2022-03-24 07:40:44 -05:00
|
|
|
release:
|
|
|
|
types: [published]
|
2022-08-18 07:50:58 -05:00
|
|
|
workflow_dispatch:
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
wasm:
|
|
|
|
name: WASM build test
|
|
|
|
timeout-minutes: 5
|
|
|
|
runs-on: ubuntu-latest
|
2022-07-01 03:50:06 -05:00
|
|
|
if: ${{ false }} # disable for now
|
2022-03-24 06:52:51 -05:00
|
|
|
steps:
|
2022-08-12 03:12:05 -05:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
- name: Install Go
|
2022-08-12 03:12:05 -05:00
|
|
|
uses: actions/setup-go@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
with:
|
2022-07-11 08:31:31 -05:00
|
|
|
go-version: 1.18
|
2022-11-14 06:06:41 -06:00
|
|
|
cache: true
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
- name: Install Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 14
|
|
|
|
|
2022-11-14 06:06:41 -06:00
|
|
|
- uses: actions/cache@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
with:
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-node-
|
|
|
|
|
|
|
|
- name: Reconfigure Git to use HTTPS auth for repo packages
|
|
|
|
run: >
|
|
|
|
git config --global url."https://github.com/".insteadOf
|
|
|
|
ssh://git@github.com/
|
|
|
|
|
|
|
|
- name: Install test dependencies
|
|
|
|
working-directory: ./test/wasm
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: ./test-dendritejs.sh
|
|
|
|
|
|
|
|
# Run golangci-lint
|
|
|
|
lint:
|
|
|
|
timeout-minutes: 5
|
|
|
|
name: Linting
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-08-12 03:12:05 -05:00
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: 1.18
|
2022-03-24 06:52:51 -05:00
|
|
|
- name: golangci-lint
|
2022-08-11 11:40:57 -05:00
|
|
|
uses: golangci/golangci-lint-action@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
# run go test with different go versions
|
|
|
|
test:
|
2022-12-02 04:44:20 -06:00
|
|
|
timeout-minutes: 10
|
2022-03-24 06:52:51 -05:00
|
|
|
name: Unit tests (Go ${{ matrix.go }})
|
|
|
|
runs-on: ubuntu-latest
|
2022-04-08 04:12:30 -05:00
|
|
|
# Service containers to run with `container-job`
|
|
|
|
services:
|
|
|
|
# Label used to access the service container
|
|
|
|
postgres:
|
|
|
|
# Docker Hub image
|
|
|
|
image: postgres:13-alpine
|
|
|
|
# Provide the password for postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: dendrite
|
|
|
|
ports:
|
|
|
|
# Maps tcp port 5432 on service container to the host
|
|
|
|
- 5432:5432
|
|
|
|
# Set health checks to wait until postgres has started
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
2022-03-24 06:52:51 -05:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-12-02 04:44:20 -06:00
|
|
|
go: ["1.19"]
|
2022-03-24 06:52:51 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup go
|
2022-08-12 03:12:05 -05:00
|
|
|
uses: actions/setup-go@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
2022-12-02 04:44:20 -06:00
|
|
|
- uses: actions/cache@v3
|
|
|
|
# manually set up caches, as they otherwise clash with different steps using setup-go with cache=true
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go${{ matrix.go }}-unit-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go${{ matrix.go }}-unit-
|
2022-10-25 06:28:34 -05:00
|
|
|
- name: Set up gotestfmt
|
|
|
|
uses: gotesttools/gotestfmt-action@v2
|
|
|
|
with:
|
|
|
|
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- run: go test -json -v ./... 2>&1 | gotestfmt
|
2022-04-08 04:12:30 -05:00
|
|
|
env:
|
|
|
|
POSTGRES_HOST: localhost
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: dendrite
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
# build Dendrite for linux with different architectures and go versions
|
|
|
|
build:
|
|
|
|
name: Build for Linux
|
|
|
|
timeout-minutes: 10
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-02-10 11:36:59 -06:00
|
|
|
go: ["1.18", "1.19", "1.20.0"]
|
2022-03-25 05:08:13 -05:00
|
|
|
goos: ["linux"]
|
|
|
|
goarch: ["amd64", "386"]
|
2022-03-24 06:52:51 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup go
|
2022-08-12 03:12:05 -05:00
|
|
|
uses: actions/setup-go@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
2022-11-14 06:06:41 -06:00
|
|
|
key: ${{ runner.os }}-go${{ matrix.go }}${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }}
|
2022-03-24 06:52:51 -05:00
|
|
|
restore-keys: |
|
2022-11-14 06:06:41 -06:00
|
|
|
key: ${{ runner.os }}-go${{ matrix.go }}${{ matrix.goos }}-${{ matrix.goarch }}-
|
|
|
|
- name: Install dependencies x86
|
|
|
|
if: ${{ matrix.goarch == '386' }}
|
|
|
|
run: sudo apt update && sudo apt-get install -y gcc-multilib
|
2022-03-24 06:52:51 -05:00
|
|
|
- env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
CGO_ENABLED: 1
|
2022-08-03 04:50:45 -05:00
|
|
|
CGO_CFLAGS: -fno-stack-protector
|
2022-03-24 06:52:51 -05:00
|
|
|
run: go build -trimpath -v -o "bin/" ./cmd/...
|
|
|
|
|
|
|
|
# build for Windows 64-bit
|
|
|
|
build_windows:
|
|
|
|
name: Build for Windows
|
|
|
|
timeout-minutes: 10
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-02-10 11:36:59 -06:00
|
|
|
go: ["1.18", "1.19", "1.20.0"]
|
2022-03-25 05:08:13 -05:00
|
|
|
goos: ["windows"]
|
|
|
|
goarch: ["amd64"]
|
2022-03-24 06:52:51 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Go ${{ matrix.go }}
|
2022-08-12 03:12:05 -05:00
|
|
|
uses: actions/setup-go@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
2022-11-14 06:06:41 -06:00
|
|
|
key: ${{ runner.os }}-go${{ matrix.go }}${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }}
|
2022-03-24 06:52:51 -05:00
|
|
|
restore-keys: |
|
2022-11-14 06:06:41 -06:00
|
|
|
key: ${{ runner.os }}-go${{ matrix.go }}${{ matrix.goos }}-${{ matrix.goarch }}-
|
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo apt update && sudo apt install -y gcc-mingw-w64-x86-64 # install required gcc
|
2022-03-24 06:52:51 -05:00
|
|
|
- env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
CGO_ENABLED: 1
|
|
|
|
CC: "/usr/bin/x86_64-w64-mingw32-gcc"
|
|
|
|
run: go build -trimpath -v -o "bin/" ./cmd/...
|
|
|
|
|
|
|
|
# Dummy step to gate other tests on without repeating the whole list
|
|
|
|
initial-tests-done:
|
2022-03-24 07:14:35 -05:00
|
|
|
name: Initial tests passed
|
2022-03-25 05:08:13 -05:00
|
|
|
needs: [lint, test, build, build_windows]
|
2022-03-24 07:14:35 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: ${{ !cancelled() }} # Run this even if prior jobs were skipped
|
|
|
|
steps:
|
|
|
|
- name: Check initial tests passed
|
|
|
|
uses: re-actors/alls-green@release/v1
|
|
|
|
with:
|
|
|
|
jobs: ${{ toJSON(needs) }}
|
2022-03-24 06:52:51 -05:00
|
|
|
|
2022-12-02 04:44:20 -06:00
|
|
|
# run go test with different go versions
|
|
|
|
integration:
|
|
|
|
timeout-minutes: 20
|
|
|
|
needs: initial-tests-done
|
|
|
|
name: Integration tests (Go ${{ matrix.go }})
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# Service containers to run with `container-job`
|
|
|
|
services:
|
|
|
|
# Label used to access the service container
|
|
|
|
postgres:
|
|
|
|
# Docker Hub image
|
|
|
|
image: postgres:13-alpine
|
|
|
|
# Provide the password for postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: dendrite
|
|
|
|
ports:
|
|
|
|
# Maps tcp port 5432 on service container to the host
|
|
|
|
- 5432:5432
|
|
|
|
# Set health checks to wait until postgres has started
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
go: ["1.19"]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Set up gotestfmt
|
|
|
|
uses: gotesttools/gotestfmt-action@v2
|
|
|
|
with:
|
|
|
|
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go${{ matrix.go }}-test-race-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go${{ matrix.go }}-test-race-
|
|
|
|
- run: go test -race -json -v -coverpkg=./... -coverprofile=cover.out $(go list ./... | grep -v /cmd/dendrite*) 2>&1 | gotestfmt
|
|
|
|
env:
|
|
|
|
POSTGRES_HOST: localhost
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: dendrite
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
flags: unittests
|
|
|
|
|
2022-03-24 06:52:51 -05:00
|
|
|
# run database upgrade tests
|
|
|
|
upgrade_test:
|
|
|
|
name: Upgrade tests
|
|
|
|
timeout-minutes: 20
|
|
|
|
needs: initial-tests-done
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup go
|
2022-08-12 03:12:05 -05:00
|
|
|
uses: actions/setup-go@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
with:
|
2022-07-11 08:31:31 -05:00
|
|
|
go-version: "1.18"
|
2022-11-14 06:06:41 -06:00
|
|
|
cache: true
|
2022-03-24 06:52:51 -05:00
|
|
|
- name: Build upgrade-tests
|
|
|
|
run: go build ./cmd/dendrite-upgrade-tests
|
2022-11-11 05:21:16 -06:00
|
|
|
- name: Test upgrade (PostgreSQL)
|
2022-03-24 06:52:51 -05:00
|
|
|
run: ./dendrite-upgrade-tests --head .
|
2022-11-11 05:21:16 -06:00
|
|
|
- name: Test upgrade (SQLite)
|
|
|
|
run: ./dendrite-upgrade-tests --sqlite --head .
|
2022-03-24 06:52:51 -05:00
|
|
|
|
2022-07-25 04:39:22 -05:00
|
|
|
# run database upgrade tests, skipping over one version
|
|
|
|
upgrade_test_direct:
|
|
|
|
name: Upgrade tests from HEAD-2
|
|
|
|
timeout-minutes: 20
|
|
|
|
needs: initial-tests-done
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup go
|
2022-08-12 03:12:05 -05:00
|
|
|
uses: actions/setup-go@v3
|
2022-07-25 04:39:22 -05:00
|
|
|
with:
|
|
|
|
go-version: "1.18"
|
2022-11-14 06:06:41 -06:00
|
|
|
cache: true
|
2022-07-25 04:39:22 -05:00
|
|
|
- name: Build upgrade-tests
|
|
|
|
run: go build ./cmd/dendrite-upgrade-tests
|
2022-11-11 05:21:16 -06:00
|
|
|
- name: Test upgrade (PostgreSQL)
|
|
|
|
run: ./dendrite-upgrade-tests -direct -from HEAD-2 --head .
|
|
|
|
- name: Test upgrade (SQLite)
|
2022-07-25 04:39:22 -05:00
|
|
|
run: ./dendrite-upgrade-tests -direct -from HEAD-2 --head .
|
|
|
|
|
2022-03-24 06:52:51 -05:00
|
|
|
# run Sytest in different variations
|
|
|
|
sytest:
|
|
|
|
timeout-minutes: 20
|
|
|
|
needs: initial-tests-done
|
|
|
|
name: "Sytest (${{ matrix.label }})"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2022-11-02 08:20:10 -05:00
|
|
|
- label: SQLite native
|
2022-03-24 06:52:51 -05:00
|
|
|
|
2022-11-02 08:20:10 -05:00
|
|
|
- label: SQLite Cgo
|
|
|
|
cgo: 1
|
|
|
|
|
|
|
|
- label: SQLite native, full HTTP APIs
|
|
|
|
api: full-http
|
|
|
|
|
|
|
|
- label: SQLite Cgo, full HTTP APIs
|
2022-03-24 06:52:51 -05:00
|
|
|
api: full-http
|
2022-11-02 08:20:10 -05:00
|
|
|
cgo: 1
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
- label: PostgreSQL
|
|
|
|
postgres: postgres
|
|
|
|
|
|
|
|
- label: PostgreSQL, full HTTP APIs
|
|
|
|
postgres: postgres
|
|
|
|
api: full-http
|
|
|
|
container:
|
2022-12-23 07:11:11 -06:00
|
|
|
image: matrixdotorg/sytest-dendrite
|
2022-03-24 06:52:51 -05:00
|
|
|
volumes:
|
|
|
|
- ${{ github.workspace }}:/src
|
2022-11-14 06:06:41 -06:00
|
|
|
- /root/.cache/go-build:/github/home/.cache/go-build
|
|
|
|
- /root/.cache/go-mod:/gopath/pkg/mod
|
2022-03-24 06:52:51 -05:00
|
|
|
env:
|
|
|
|
POSTGRES: ${{ matrix.postgres && 1}}
|
|
|
|
API: ${{ matrix.api && 1 }}
|
2022-04-26 01:07:27 -05:00
|
|
|
SYTEST_BRANCH: ${{ github.head_ref }}
|
2022-11-02 08:20:10 -05:00
|
|
|
CGO_ENABLED: ${{ matrix.cgo && 1 }}
|
2022-03-24 06:52:51 -05:00
|
|
|
steps:
|
2022-11-02 09:04:08 -05:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-14 06:06:41 -06:00
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
/gopath/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-sytest-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-sytest-
|
2022-03-24 06:52:51 -05:00
|
|
|
- name: Run Sytest
|
|
|
|
run: /bootstrap.sh dendrite
|
|
|
|
working-directory: /src
|
|
|
|
- name: Summarise results.tap
|
|
|
|
if: ${{ always() }}
|
2022-03-25 05:08:13 -05:00
|
|
|
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
|
2022-04-05 08:32:30 -05:00
|
|
|
- name: Sytest List Maintenance
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: /src/show-expected-fail-tests.sh /logs/results.tap /src/sytest-whitelist /src/sytest-blacklist
|
|
|
|
continue-on-error: true # not fatal
|
|
|
|
- name: Are We Synapse Yet?
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: /src/are-we-synapse-yet.py /logs/results.tap -v
|
|
|
|
continue-on-error: true # not fatal
|
2022-03-24 06:52:51 -05:00
|
|
|
- name: Upload Sytest logs
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
|
|
|
name: Sytest Logs - ${{ job.status }} - (Dendrite, ${{ join(matrix.*, ', ') }})
|
|
|
|
path: |
|
|
|
|
/logs/results.tap
|
|
|
|
/logs/**/*.log*
|
|
|
|
|
|
|
|
# run Complement
|
|
|
|
complement:
|
|
|
|
name: "Complement (${{ matrix.label }})"
|
|
|
|
timeout-minutes: 20
|
|
|
|
needs: initial-tests-done
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2022-11-02 08:20:10 -05:00
|
|
|
- label: SQLite native
|
2022-11-14 06:06:41 -06:00
|
|
|
cgo: 0
|
2022-11-02 08:20:10 -05:00
|
|
|
|
|
|
|
- label: SQLite Cgo
|
|
|
|
cgo: 1
|
|
|
|
|
|
|
|
- label: SQLite native, full HTTP APIs
|
|
|
|
api: full-http
|
2022-11-14 06:06:41 -06:00
|
|
|
cgo: 0
|
2022-03-24 06:52:51 -05:00
|
|
|
|
2022-11-02 08:20:10 -05:00
|
|
|
- label: SQLite Cgo, full HTTP APIs
|
2022-03-24 06:52:51 -05:00
|
|
|
api: full-http
|
2022-11-02 08:20:10 -05:00
|
|
|
cgo: 1
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
- label: PostgreSQL
|
|
|
|
postgres: Postgres
|
2022-11-14 06:06:41 -06:00
|
|
|
cgo: 0
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
- label: PostgreSQL, full HTTP APIs
|
|
|
|
postgres: Postgres
|
|
|
|
api: full-http
|
2022-11-14 06:06:41 -06:00
|
|
|
cgo: 0
|
2022-03-24 06:52:51 -05:00
|
|
|
steps:
|
|
|
|
# Env vars are set file a file given by $GITHUB_PATH. We need both Go 1.17 and GOPATH on env to run Complement.
|
|
|
|
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
|
|
|
|
- name: "Set Go Version"
|
|
|
|
run: |
|
|
|
|
echo "$GOROOT_1_17_X64/bin" >> $GITHUB_PATH
|
|
|
|
echo "~/go/bin" >> $GITHUB_PATH
|
|
|
|
- name: "Install Complement Dependencies"
|
|
|
|
# We don't need to install Go because it is included on the Ubuntu 20.04 image:
|
|
|
|
# See https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md specifically GOROOT_1_17_X64
|
|
|
|
run: |
|
|
|
|
sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev
|
2022-10-10 08:49:56 -05:00
|
|
|
go get -v github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
|
2022-11-02 09:04:08 -05:00
|
|
|
- name: Run actions/checkout@v3 for dendrite
|
|
|
|
uses: actions/checkout@v3
|
2022-03-24 06:52:51 -05:00
|
|
|
with:
|
|
|
|
path: dendrite
|
|
|
|
|
|
|
|
# Attempt to check out the same branch of Complement as the PR. If it
|
|
|
|
# doesn't exist, fallback to main.
|
|
|
|
- name: Checkout complement
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p complement
|
|
|
|
# Attempt to use the version of complement which best matches the current
|
|
|
|
# build. Depending on whether this is a PR or release, etc. we need to
|
|
|
|
# use different fallbacks.
|
|
|
|
#
|
|
|
|
# 1. First check if there's a similarly named branch (GITHUB_HEAD_REF
|
|
|
|
# for pull requests, otherwise GITHUB_REF).
|
|
|
|
# 2. Attempt to use the base branch, e.g. when merging into release-vX.Y
|
|
|
|
# (GITHUB_BASE_REF for pull requests).
|
|
|
|
# 3. Use the default complement branch ("master").
|
|
|
|
for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "master"; do
|
|
|
|
# Skip empty branch names and merge commits.
|
|
|
|
if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
(wget -O - "https://github.com/matrix-org/complement/archive/$BRANCH_NAME.tar.gz" | tar -xz --strip-components=1 -C complement) && break
|
|
|
|
done
|
|
|
|
# Build initial Dendrite image
|
2022-11-14 06:06:41 -06:00
|
|
|
- run: docker build --build-arg=CGO=${{ matrix.cgo }} -t complement-dendrite:${{ matrix.postgres }}${{ matrix.api }}${{ matrix.cgo }} -f build/scripts/Complement${{ matrix.postgres }}.Dockerfile .
|
2022-03-24 06:52:51 -05:00
|
|
|
working-directory: dendrite
|
2022-08-23 06:10:29 -05:00
|
|
|
env:
|
|
|
|
DOCKER_BUILDKIT: 1
|
2022-03-24 06:52:51 -05:00
|
|
|
|
|
|
|
# Run Complement
|
|
|
|
- run: |
|
|
|
|
set -o pipefail &&
|
|
|
|
go test -v -json -tags dendrite_blacklist ./tests/... 2>&1 | gotestfmt
|
|
|
|
shell: bash
|
|
|
|
name: Run Complement Tests
|
|
|
|
env:
|
2022-11-14 06:06:41 -06:00
|
|
|
COMPLEMENT_BASE_IMAGE: complement-dendrite:${{ matrix.postgres }}${{ matrix.api }}${{ matrix.cgo }}
|
2023-02-03 06:42:35 -06:00
|
|
|
COMPLEMENT_DENDRITE_API: ${{ matrix.api && 1 }}
|
|
|
|
COMPLEMENT_SHARE_ENV_PREFIX: COMPLEMENT_DENDRITE_
|
2022-03-24 06:52:51 -05:00
|
|
|
working-directory: complement
|
2022-03-25 05:08:13 -05:00
|
|
|
|
2022-03-25 08:28:20 -05:00
|
|
|
integration-tests-done:
|
|
|
|
name: Integration tests passed
|
2022-08-03 04:35:57 -05:00
|
|
|
needs:
|
|
|
|
[
|
|
|
|
initial-tests-done,
|
|
|
|
upgrade_test,
|
|
|
|
upgrade_test_direct,
|
|
|
|
sytest,
|
|
|
|
complement,
|
2022-12-02 04:44:20 -06:00
|
|
|
integration
|
2022-08-03 04:35:57 -05:00
|
|
|
]
|
2022-03-25 05:08:13 -05:00
|
|
|
runs-on: ubuntu-latest
|
2022-03-25 08:41:28 -05:00
|
|
|
if: ${{ !cancelled() }} # Run this even if prior jobs were skipped
|
2022-03-25 05:08:13 -05:00
|
|
|
steps:
|
|
|
|
- name: Check integration tests passed
|
|
|
|
uses: re-actors/alls-green@release/v1
|
|
|
|
with:
|
|
|
|
jobs: ${{ toJSON(needs) }}
|
2022-03-25 08:28:20 -05:00
|
|
|
|
|
|
|
update-docker-images:
|
|
|
|
name: Update Docker images
|
2022-03-25 08:31:41 -05:00
|
|
|
permissions:
|
|
|
|
packages: write
|
|
|
|
contents: read
|
2022-11-11 05:21:16 -06:00
|
|
|
security-events: write # To upload Trivy sarif files
|
2022-03-25 08:28:20 -05:00
|
|
|
if: github.repository == 'matrix-org/dendrite' && github.ref_name == 'main'
|
|
|
|
needs: [integration-tests-done]
|
2022-03-25 08:29:09 -05:00
|
|
|
uses: matrix-org/dendrite/.github/workflows/docker.yml@main
|
2022-03-25 09:27:41 -05:00
|
|
|
secrets:
|
|
|
|
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|