将 test.yml 的 check job 从单平台 ubuntu 改为 ubuntu/macos/windows 三平台并行, Linux 额外安装 libayatana-appindicator3-dev 以支持 systray CGo 编译。
117 lines
2.5 KiB
YAML
117 lines
2.5 KiB
YAML
name: Test (Full)
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
full:
|
|
description: "Run full test suite including MySQL and E2E"
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check:
|
|
name: Check (${{ matrix.os }})
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Install Linux system dependencies
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt-get update && sudo apt-get install -y libayatana-appindicator3-dev
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: go.work
|
|
cache-dependency-path: |
|
|
backend/go.sum
|
|
versionctl/go.sum
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Lint
|
|
run: make lint
|
|
|
|
- name: Test
|
|
run: make test
|
|
|
|
mysql:
|
|
name: MySQL Tests
|
|
if: inputs.full
|
|
needs: check
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:8.0
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: testpass
|
|
MYSQL_DATABASE: nex_test
|
|
MYSQL_USER: nex_test
|
|
MYSQL_PASSWORD: testpass
|
|
ports:
|
|
- 13306:3306
|
|
options: >-
|
|
--health-cmd="mysqladmin ping -h localhost -u root -ptestpass"
|
|
--health-interval=3s
|
|
--health-timeout=5s
|
|
--health-retries=10
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: go.work
|
|
cache-dependency-path: |
|
|
backend/go.sum
|
|
versionctl/go.sum
|
|
|
|
- name: MySQL tests
|
|
run: cd backend && go test -tags=mysql ./tests/mysql/... -v -count=1
|
|
|
|
e2e:
|
|
name: E2E Tests
|
|
if: inputs.full
|
|
needs: check
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: go.work
|
|
cache-dependency-path: |
|
|
backend/go.sum
|
|
versionctl/go.sum
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install Playwright browsers
|
|
run: cd frontend && bunx playwright install --with-deps chromium
|
|
|
|
- name: E2E tests
|
|
run: cd frontend && bun run test:e2e
|