mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-12-06 03:14:09 +00:00
155 lines
5.8 KiB
YAML
155 lines
5.8 KiB
YAML
name: Companion source tests
|
|
|
|
on:
|
|
pull_request:
|
|
paths: &companion_paths
|
|
- '.github/workflows/companion-tests.yml'
|
|
- '.gitmodules'
|
|
- 'third_party/corescope'
|
|
- 'third_party/beacon-server'
|
|
- 'third_party/beacon-web'
|
|
- 'scripts/companion-dev/build.sh'
|
|
- 'scripts/companion-dev/build-corescope.sh'
|
|
- 'scripts/companion-dev/compose.yml'
|
|
- 'scripts/companion-dev/source-hash.py'
|
|
- 'Dockerfile.corescope'
|
|
- 'Dockerfile.beacon-server'
|
|
- 'Dockerfile.beacon-web'
|
|
push:
|
|
branches: [ukmesh-dev]
|
|
paths: *companion_paths
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: companion-tests-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
corescope:
|
|
name: CoreScope source tests
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
services:
|
|
postgres:
|
|
image: postgres@sha256:a49f7438ba03589f9b1ca062f2da82e899b48ea1dc50d2449fa09a70be83ebca # 16-bookworm
|
|
env:
|
|
POSTGRES_PASSWORD: corescope-test-password
|
|
ports:
|
|
- 5432/tcp
|
|
options: >-
|
|
--shm-size=1g
|
|
--health-cmd "pg_isready -U postgres"
|
|
--health-interval 5s
|
|
--health-timeout 3s
|
|
--health-retries 10
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
- name: Check out the CoreScope release input
|
|
run: git submodule update --init --depth 1 -- third_party/corescope
|
|
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
|
with:
|
|
go-version: '1.27'
|
|
cache-dependency-path: third_party/corescope/**/go.sum
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
|
|
with:
|
|
node-version-file: .nvmrc
|
|
- name: Test the Go modules in the pinned checkout
|
|
env:
|
|
TEST_CORE_DATABASE_URL: postgresql://postgres:corescope-test-password@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?sslmode=disable
|
|
working-directory: third_party/corescope
|
|
shell: bash
|
|
run: |
|
|
test -f cmd/server/go.mod && test -f cmd/ingestor/go.mod
|
|
git ls-files -z -- 'go.mod' '*/go.mod' | while IFS= read -r -d '' manifest; do
|
|
module_dir="$(dirname "$manifest")"
|
|
(cd "$module_dir" && go test -race -count=1 -timeout 20m ./...)
|
|
done
|
|
- name: Test server features built with the end-to-end tag
|
|
working-directory: third_party/corescope/cmd/server
|
|
run: go test -tags e2etest -count=1 -run E2E .
|
|
- name: Test the public JavaScript
|
|
working-directory: third_party/corescope
|
|
run: |
|
|
npm ci
|
|
sh test-all.sh
|
|
|
|
corescope-build:
|
|
name: CoreScope qualification binaries
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
- name: Check out and build the pinned CoreScope source
|
|
shell: bash
|
|
run: |
|
|
git submodule update --init --depth 1 -- third_party/corescope
|
|
pin=$(git rev-parse HEAD:third_party/corescope)
|
|
test "$pin" = "$(git -C third_party/corescope rev-parse HEAD)"
|
|
out=plans/companion-dev/runtime/bin
|
|
mkdir -p "$out" plans/companion-dev/{go-mod,go-cache}
|
|
export COMPANION_UID="$(id -u)" COMPANION_GID="$(id -g)"
|
|
export COMPANION_CORESCOPE_COMMIT="$(git -C third_party/corescope rev-parse --short HEAD)"
|
|
docker compose --env-file /dev/null -f scripts/companion-dev/compose.yml run --rm --no-deps -T build corescope
|
|
test -x "$out/corescope-server" && test -x "$out/corescope-ingestor"
|
|
python3 scripts/companion-dev/source-hash.py corescope > "$out/source"
|
|
echo "$pin" > "$out/commit"
|
|
(cd "$out" && sha256sum corescope-server corescope-ingestor > SHA256SUMS)
|
|
- name: Retain the source-bound Linux qualification build
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
|
|
with:
|
|
name: corescope-qualification-linux-amd64
|
|
path: plans/companion-dev/runtime/bin/
|
|
if-no-files-found: error
|
|
retention-days: 3
|
|
|
|
beacon-server:
|
|
name: Beacon Server source tests
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
- name: Check out the Beacon Server release input
|
|
run: git submodule update --init --depth 1 -- third_party/beacon-server
|
|
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
|
|
with:
|
|
go-version-file: third_party/beacon-server/go.mod
|
|
cache-dependency-path: third_party/beacon-server/go.sum
|
|
- name: Build and test the server
|
|
working-directory: third_party/beacon-server
|
|
run: |
|
|
go build ./...
|
|
go vet ./...
|
|
go test -count=1 ./...
|
|
|
|
beacon-web:
|
|
name: Beacon Web source tests
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
persist-credentials: false
|
|
- name: Check out the Beacon Web release input
|
|
run: git submodule update --init --depth 1 -- third_party/beacon-web
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: npm
|
|
cache-dependency-path: third_party/beacon-web/package-lock.json
|
|
- name: Build, lint and test the web app
|
|
working-directory: third_party/beacon-web
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
npm run lint
|
|
npm test
|