Skip to content

chore: CI check that licenses of all dependencies are at least permissive #10

chore: CI check that licenses of all dependencies are at least permissive

chore: CI check that licenses of all dependencies are at least permissive #10

name: Test and Publish
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_call:
inputs:
quick_test:
description: 'Run only random mode with all-features and both flows'
required: false
type: boolean
default: true
data-models_ref:
required: false
type: string
data-model-validator_ref:
required: false
type: string
rpde-validator_ref:
required: false
type: string
openactive-test-suite_ref:
required: false
type: string
default: 'refs/heads/master'
jobs:
tests:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
mode: ${{ inputs.quick_test == true && fromJson('["random"]') || fromJson('["random","controlled"]') }}
profile: ${{ inputs.quick_test == true && fromJson('["all-features"]') || fromJson('["all-features","single-seller","no-payment-reconciliation","no-auth","no-tax-calculation","prepayment-always-required","facilityuse-has-slots"]') }}
flow: ${{ inputs.quick_test == true && fromJson('["both"]') || fromJson('["simple","approval"]') }}
include: ${{ inputs.quick_test == true && fromJson('[]') || fromJson('[{"mode":"random","profile":"all-features","flow":"both"},{"mode":"controlled","profile":"all-features","flow":"both"}]') }}
concurrency:
group: openactive-test-suite--${{ github.head_ref }}--${{ matrix.mode }}.${{ matrix.profile }}.${{ matrix.flow }}
cancel-in-progress: true
steps:
- name: Checkout OpenActive Test Suite
uses: actions/checkout@v4
with:
path: tests
repository: openactive/openactive-test-suite
# If this is being called from another workflow, then the openactive-test-suite_ref will be provided or defaulted; otherwise we can assume a different trigger
ref: ${{ inputs.openactive-test-suite_ref || github.ref }}
- name: Use matching coverage/* branch ${{ github.head_ref }} in OpenActive.Server.NET
if: ${{ github.repository == 'openactive/openactive-test-suite' && startsWith(github.head_ref, 'coverage/') }}
id: refs
run: echo "::set-output name=mirror_ref::${{ github.head_ref }}"
- name: Checkout OpenActive.Server.NET ${{ steps.refs.outputs.mirror_ref }}
uses: actions/checkout@v4
with:
repository: openactive/OpenActive.Server.NET
ref: ${{ steps.refs.outputs.mirror_ref }}
path: server
- name: Setup .NET Core SDK 3.1.419
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.419
- name: Setup Node.js 18.17.1
uses: actions/setup-node@v4
with:
node-version: 18.17.1
- name: Install OpenActive.Server.NET dependencies
run: dotnet restore ./server/
- name: Build .NET Core Authentication Authority Reference Implementation
run: dotnet build ./server/Examples/BookingSystem.AspNetCore.IdentityServer/BookingSystem.AspNetCore.IdentityServer.csproj --configuration Release --no-restore
- name: Start .NET Core Authentication Authority Reference Implementation
run: |
dotnet run --no-launch-profile --project ./server/Examples/BookingSystem.AspNetCore.IdentityServer/BookingSystem.AspNetCore.IdentityServer.csproj --configuration Release --no-build &
- name: Build .NET Core Booking Server Reference Implementation
run: dotnet build ./server/Examples/BookingSystem.AspNetCore/BookingSystem.AspNetCore.csproj --configuration Release --no-restore
- name: Start .NET Core Booking Server Reference Implementation
run: |
dotnet run --no-launch-profile --project ./server/Examples/BookingSystem.AspNetCore/BookingSystem.AspNetCore.csproj --configuration Release --no-build &
env:
ASPNETCORE_ENVIRONMENT: ${{ matrix.profile }}
- name: Install OpenActive Test Suite
run: |
npm install
working-directory: tests
- name: Install specific version of data-models ${{ inputs.data-models_ref }}
if: ${{ inputs.data-models_ref }}
run: |
cd packages/openactive-broker-microservice && npm install github:openactive/data-models#${{ inputs.data-models_ref }}
cd packages/openactive-integration-tests && npm install github:openactive/data-models#${{ inputs.data-models_ref }}
working-directory: tests
- name: Install specific version of data-model-validator ${{ inputs.data-model-validator_ref }}
if: ${{ inputs.data-model-validator_ref }}
run: |
cd packages/openactive-broker-microservice && npm install github:openactive/data-model-validator#${{ inputs.data-model-validator_ref }}
cd packages/openactive-integration-tests && npm install github:openactive/data-model-validator#${{ inputs.data-model-validator_ref }}
working-directory: tests
- name: Install specific version of rpde-validator ${{ inputs.rpde-validator_ref }}
if: ${{ inputs.rpde-validator_ref }}
run: |
cd packages/openactive-broker-microservice && npm install github:openactive/rpde-validator#${{ inputs.rpde-validator_ref }}
working-directory: tests
- name: Run Checks on the Code (Test the Tests!)
run: npm test
working-directory: tests
- name: Run OpenActive Integration Tests in ${{ matrix.mode }} mode
run: npm start
env:
FORCE_COLOR: 1
NODE_CONFIG: |
{"broker": {"outputPath": "../../output/"}, "integrationTests": {"outputPath": "../../output/", "useRandomOpportunities": ${{ matrix.mode == 'random' }}, "implementedFeatures": { "minimal-proposal": ${{ matrix.flow == 'approval' || matrix.flow == 'both' }}, "proposal-amendment": ${{ matrix.flow == 'approval' || matrix.flow == 'both' }} }, "bookingFlowsInScope": { "OpenBookingSimpleFlow": ${{ matrix.flow == 'simple' || matrix.flow == 'both' }}, "OpenBookingApprovalFlow": ${{ matrix.flow == 'approval' || matrix.flow == 'both' }} } }}
NODE_ENV: .example.${{ matrix.profile }}
NODE_APP_INSTANCE: ci
working-directory: tests
# Two purposes to uploading the output from these tests:
# 1. So that the `deploy-output` job can use this output in order to publish it, as examples, to gh-pages
# 2. Make the artifact downloadable from GitHub to a developer so that they can debug
- name: Upload test output for ${{ matrix.mode }} mode as artifact
uses: actions/upload-artifact@v4
if: ${{ success() || failure() }}
with:
name: ${{ matrix.mode }}.${{ matrix.profile }}.${{ matrix.flow }}
path: ./tests/output/
deploy-output:
needs: tests
# Master branch only
if: ${{ github.repository == 'openactive/openactive-test-suite' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-22.04
steps:
# Checkout the repo to seed the contents of ./tests/publish/
- name: Checkout OpenActive Test Suite
uses: actions/checkout@v4
with:
path: tests
- name: Download test output for Random Mode
uses: actions/download-artifact@v4
with:
name: random.all-features.both
path: ./tests/publish/example-output/random/
- name: Download test output for Controlled Mode
uses: actions/download-artifact@v4
with:
name: controlled.all-features.both
path: ./tests/publish/example-output/controlled/
- name: Deploy test output to GitHub Pages (master branch on ubuntu only)
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./tests/publish
force_orphan: true
enable_jekyll: true
# Publish to GitHub Container Registry
build-and-push-docker-image:
# Master branch only - extra checks
if: ${{ github.repository == 'openactive/openactive-test-suite' && github.ref == 'refs/heads/master' }}
needs: tests
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for OpenActive Test Suite
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/openactive/test-suite
labels: |
org.opencontainers.image.title=OpenActive Test Suite
org.opencontainers.image.description=Test suite for OpenActive data publishing and Open Booking API implementations
org.opencontainers.image.vendor=OpenActive
tags: |
latest
- name: Build and push Docker image for OpenActive Test Suite
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}