Skip to content

feat: Docker with package upgrades #1963

feat: Docker with package upgrades

feat: Docker with package upgrades #1963

name: Reference Implementation
on:
push:
branches: [ feature/docker-and-package-upgrades ]
pull_request:
branches: [ master ]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mode: ['random', 'controlled']
profile: ['all-features', 'single-seller', 'no-payment-reconciliation', 'no-auth', 'no-tax-calculation', 'prepayment-always-required', 'facilityuse-has-slots']
flow: ['simple', 'approval']
include:
- 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@v2
with:
path: tests
- name: Use matching coverage/* branch ${{ github.head_ref }} in OpenActive.Server.NET
if: ${{ 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@v2
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@v1
with:
dotnet-version: 3.1.419
- name: Setup Node.js 18.17.1
uses: actions/setup-node@v1
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: 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@v2
if: ${{ success() || failure() }}
with:
name: ${{ matrix.mode }}.${{ matrix.profile }}.${{ matrix.flow }}
path: ./tests/output/
deploy-output:
needs: tests
# Master branch only
# if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
# Checkout the repo to seed the contents of ./tests/publish/
- name: Checkout OpenActive Test Suite
uses: actions/checkout@v2
with:
path: tests
- name: Download test output for Random Mode
uses: actions/download-artifact@v2
with:
name: random.all-features.both
path: ./tests/publish/example-output/random/
- name: Download test output for Controlled Mode
uses: actions/download-artifact@v2
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
build-and-push-docker-image:
# Publish to GitHub Container Registry
# Master branch only
# if: ${{ github.ref == 'refs/heads/master' }}
# needs:
# - tests
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
steps:
- name: Checkout
uses: actions/checkout@v3
- 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 }}