54 lines
2.1 KiB
YAML

name: Build and verify web migration
on:
push:
branches: [main, 'codex/**']
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
services:
mongo:
image: mongo:8.0
ports: ['27017:27017']
options: >-
--health-cmd "mongosh --quiet --eval 'db.adminCommand({ping:1}).ok'"
--health-interval 10s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with: { dotnet-version: '10.0.x' }
- uses: actions/setup-node@v4
with: { node-version: '22', cache: npm, cache-dependency-path: web/package-lock.json }
- name: Build services
run: dotnet build src/GuestOps.Worker/GuestOps.Worker.csproj -c Release
- name: Build interface
working-directory: web
run: npm ci && npm run build
- name: Start isolated preview API
run: |
ASPNETCORE_ENVIRONMENT=Development Preview=true dotnet src/GuestOps.Api/bin/Release/net10.0/GuestOps.Api.dll --urls http://127.0.0.1:5180 > /tmp/guestops-api.log 2>&1 &
for i in $(seq 1 30); do curl -fsS http://127.0.0.1:5180/health && exit 0; sleep 1; done
cat /tmp/guestops-api.log
exit 1
- name: Verify MongoDB and HTTP boundaries
env:
MONGO_TEST_URI: mongodb://127.0.0.1:27017
TEST_API_URL: http://127.0.0.1:5180
run: dotnet run --project tests/GuestOps.Tests/GuestOps.Tests.csproj -c Release
- name: Build Linux images
run: |
docker build --target api -t guestops-api:${{ github.sha }} .
docker build --target worker -t guestops-worker:${{ github.sha }} .
- name: Package reviewed images
if: github.event_name != 'pull_request'
run: docker save guestops-api:${{ github.sha }} guestops-worker:${{ github.sha }} | gzip > guestops-images.tar.gz
- uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
with:
name: guestops-linux-${{ github.run_number }}
path: guestops-images.tar.gz
retention-days: 7