Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/steps/run-test-services/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run Test Services
description: Imports built Docker images, starts docker-compose-test, and migrates database
inputs:
image-from-artifacts:
description: If true, download images from GHA artifacts
docker-tag:
description: Docker tag of Server/Jobrunner
runs:
using: composite
steps:
- name: Download built images
if: ${{ inputs.image-from-artifacts == 'true' }}
uses: actions/download-artifact@v4
with:
pattern: docker-*
path: /tmp
merge-multiple: true

- name: Import images
if: ${{ inputs.image-from-artifacts == 'true' }}
run: for f in /tmp/*.tar; do docker load -i $f; done
shell: bash

- name: Set ref in docker-compose
run: sed -i "s/__RC_REF__/${{ inputs.docker-tag }}/g" docker-compose-test.yml
shell: bash

- name: Docker Compose
uses: hoverkraft-tech/[email protected]
with:
compose-file: |
docker-compose.yml
docker-compose-test.yml

- name: Migrate database
run: |
yarn prisma:migrateProd
shell: bash

- name: Restart services
run: |
docker compose -f docker-compose.yml -f docker-compose-test.yml restart server jobrunner
shell: bash
34 changes: 30 additions & 4 deletions .github/workflows/build_shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
type: string
required: true
description: Version to build, also the docker tag
build:
type: string
default: desktop,server,jobrunner
description: Comma-separated list of builds to run
strip_rc:
type: boolean
description: Strip -rc suffix from version number
Expand All @@ -20,13 +24,19 @@ on:
type: boolean
default: false
description: Build multi-arch docker images
export_artifacts:
type: boolean
default: true
# https://docs.docker.com/build/ci/github-actions/share-image-jobs/
description: Export images to GitHub Actions artifacts

permissions:
contents: read
packages: write

jobs:
build-desktop-windows:
if: ${{ contains(inputs.build, 'desktop') }}
runs-on: windows-latest
strategy:
matrix:
Expand Down Expand Up @@ -75,7 +85,7 @@ jobs:

build-docker-server:
runs-on: ubuntu-latest
if: ${{ inputs.push_docker == true }}
if: ${{ contains(inputs.build, 'server') }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -110,17 +120,25 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ inputs.push_docker }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ inputs.multi_arch && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: ${{ inputs.export_artifacts && 'type=docker,dest=/tmp/server.tar' || '' }}
Copy link

Copilot AI Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key 'outputs' should be 'output' in the docker/build-push-action step.

Suggested change
outputs: ${{ inputs.export_artifacts && 'type=docker,dest=/tmp/server.tar' || '' }}
output: ${{ inputs.export_artifacts && 'type=docker,dest=/tmp/server.tar' || '' }}

Copilot uses AI. Check for mistakes.
file: Dockerfile.server

- name: Upload to artifacts
if: ${{ inputs.export_artifacts }}
uses: actions/upload-artifact@v4
with:
name: docker-server
path: /tmp/server.tar

build-docker-jobrunner:
runs-on: ubuntu-latest
if: ${{ inputs.push_docker == true }}
if: ${{ contains(inputs.build, 'jobrunner') }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -154,10 +172,18 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ inputs.push_docker }}
tags: ${{ steps.jr_meta.outputs.tags }}
labels: ${{ steps.jr_meta.outputs.labels }}
platforms: ${{ inputs.multi_arch && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: ${{ inputs.export_artifacts && 'type=docker,dest=/tmp/jobrunner.tar' || '' }}
Copy link

Copilot AI Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key 'outputs' should be 'output' in the docker/build-push-action step.

Suggested change
outputs: ${{ inputs.export_artifacts && 'type=docker,dest=/tmp/jobrunner.tar' || '' }}
output: ${{ inputs.export_artifacts && 'type=docker,dest=/tmp/jobrunner.tar' || '' }}

Copilot uses AI. Check for mistakes.
file: Dockerfile.jobrunner

- name: Upload to artifacts
if: ${{ inputs.export_artifacts }}
uses: actions/upload-artifact@v4
with:
name: docker-jobrunner
path: /tmp/jobrunner.tar
18 changes: 3 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,14 @@ jobs:
cache: "yarn"
cache-dependency-path: "yarn.lock"

- name: Set ref in docker-compose
run: sed -i "s/__RC_REF__/${{ github.ref_name }}/g" docker-compose-rc-test.yml

- name: Start services
run: docker compose -f docker-compose.yml -f docker-compose-rc-test.yml up -d

- run: yarn install --immutable --inline-builds
- uses: ./.github/steps/run-test-services
with:
docker-tag: ${{ github.ref_name }}

- uses: ./.github/steps/setup-playwright
with:
working-directory: ./server

- name: Migrate database
run: |
yarn prisma:migrateProd

- name: Retart services
run: |
docker compose -f docker-compose.yml -f docker-compose-rc-test.yml restart server jobrunner

- name: Run Playwright tests
run: yarn ${{ runner.debug && 'test:e2e:debug' || 'test:e2e' }}
working-directory: ./server
Expand Down
72 changes: 19 additions & 53 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,20 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./server/coverage/coverage-final.json,./jobrunner/coverage/coverage-final.json

build:
uses: ./.github/workflows/build_shared.yml
with:
ref: ${{ github.ref }}
tag: test
build: server,jobrunner
multi_arch: false
push_docker: false
export_artifacts: true

test-e2e-server:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [build]
env:
NODE_ENV: test
E2E_TEST: "true"
Expand All @@ -144,33 +155,18 @@ jobs:
cache: "yarn"
cache-dependency-path: "yarn.lock"

- name: Docker Compose
uses: hoverkraft-tech/[email protected]

- name: Install dependencies
run: yarn install --immutable --inline-builds

- name: Build server
run: |
yarn build
cp -r public .next/standalone/server/public
mkdir -p .next/standalone/server/.next
cp -r .next/static .next/standalone/server/.next/static
working-directory: ./server

- name: Build Jobrunner
run: |
yarn build
cp ../utility/prisma/schema.prisma .
working-directory: ./jobrunner
- uses: ./.github/steps/run-test-services
with:
image-from-artifacts: "true"
docker-tag: test

- uses: ./.github/steps/setup-playwright
with:
working-directory: ./server

- name: Migrate database
run: yarn prisma:migrateProd

- name: Run Playwright tests
run: yarn ${{ runner.debug && 'test:e2e:debug' || 'test:e2e' }}
working-directory: ./server
Expand Down Expand Up @@ -231,6 +227,7 @@ jobs:
test-e2e-desktop-complete:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [build]
env:
NODE_ENV: test
E2E_TEST: "true"
Expand All @@ -245,52 +242,21 @@ jobs:
cache: "yarn"
cache-dependency-path: "yarn.lock"

- name: Docker Compose
uses: hoverkraft-tech/[email protected]

- name: Install dependencies
run: yarn install --immutable --inline-builds

- uses: FedericoCarboni/setup-ffmpeg@v3
- uses: ./.github/steps/run-test-services
with:
ffmpeg-version: "release"

- name: Build server
run: |
yarn build
cp -r public .next/standalone/server/public
mkdir -p .next/standalone/server/.next
cp -r .next/static .next/standalone/server/.next/static
working-directory: ./server

- name: Build Jobrunner
run: |
yarn build
cp ../utility/prisma/schema.prisma .
working-directory: ./jobrunner
image-from-artifacts: "true"
docker-tag: test

- name: Build desktop
run: yarn build
working-directory: ./desktop

- name: Migrate database
run: yarn prisma:migrateProd

- name: Make logs folder
run: mkdir -p ${{ runner.temp }}/logs

- name: Start Jobrunner
run: |
node --enable-source-maps dist/index.cjs --watch --pidFile ${{ runner.temp }}/jobrunner.pid > ${{ runner.temp }}/logs/jobrunner.log 2>&1 &
npx -y wait-on file:/${{ runner.temp }}/jobrunner.pid
working-directory: ./jobrunner

- name: Start server
run: |
HOSTNAME=localhost node server/server.js > ${{ runner.temp }}/logs/server.log 2>&1 &
npx -y wait-on -v -t 120000 http://localhost:3000/api/healthz
working-directory: ./server/.next/standalone

- name: Run Playwright tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn ${{ runner.debug && 'test:e2e:debug' || 'test:e2e' }} --project complete
working-directory: ./desktop
Expand Down
10 changes: 8 additions & 2 deletions desktop/e2e/complete/vmix.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,17 @@ test("load assets into vMix", async ({ app: [app, page], testMediaPath }) => {
}, `${testMediaPath}/smpte_bars_15s (#${updated.rundowns[0].assets[0].media.id}).mp4`);

await page
.getByRole("button", { name: "Download All Media in Test Category" })
.getByRole("button", {
name: "Download All Media in Test Category",
exact: true,
})
.click();
await page.getByRole("button", { name: "Expand Test Category" }).click();
await page
.getByRole("button", { name: "Load All Media in Test Category" })
.getByRole("button", {
name: "Load All Media in Test Category",
exact: true,
})
.click();
await page.getByRole("menuitem", { name: "In List" }).click();

Expand Down
File renamed without changes.
Loading