👷 优化 CI 支持自动同步编译产物至 release/cas 分支 #80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [master] | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.32.1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build:packages | |
| - run: pnpm lint | |
| server-tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| TEST_DATABASE_URL: postgres://cqut_auth:cqut_auth_test@127.0.0.1:5432/cqut_auth_test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Start PostgreSQL with pg_cron | |
| run: | | |
| docker build --tag cqut-auth-postgres-ci --file docker/postgres/Dockerfile . | |
| docker run --detach --name cqut-auth-postgres-ci \ | |
| --env POSTGRES_USER=cqut_auth \ | |
| --env POSTGRES_PASSWORD=cqut_auth_test \ | |
| --env POSTGRES_DB=cqut_auth_test \ | |
| --publish 5432:5432 \ | |
| cqut-auth-postgres-ci \ | |
| postgres \ | |
| -c shared_preload_libraries=pg_cron \ | |
| -c cron.database_name=cqut_auth_test | |
| for attempt in {1..30}; do | |
| if docker exec cqut-auth-postgres-ci pg_isready -U cqut_auth -d cqut_auth_test; then | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| docker logs cqut-auth-postgres-ci | |
| exit 1 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.32.1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build:packages | |
| - run: pnpm test:server | |
| - name: Stop PostgreSQL | |
| if: always() | |
| run: docker rm --force cqut-auth-postgres-ci || true | |
| ui-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.32.1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build:packages | |
| - run: pnpm test:ui | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.32.1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build | |
| docker-build: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: false |