Testing #924
This file contains 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: Testing | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
useRealFrontend: | |
description: If true, visit the front-end that is available in ibis-ladybug | |
type: boolean | |
default: false | |
required: true | |
mergeMasterToBranch: | |
description: If true, the checkout-out backend is merged with the backend master | |
type: boolean | |
default: false | |
required: true | |
frontendCommitToCheckout: | |
description: Tag or branch of ladybug-frontend to check out | |
required: false | |
backendCommitToCheckout: | |
description: Tag or branch of the backend to test against | |
required: false | |
jobs: | |
testing: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Echo inputs | |
run: echo "useRealFrontend=${{ github.event.inputs.useRealFrontend}}, mergeMasterToBranch=${{ github.event.inputs.mergeMasterToBranch}}, frontendCommitToCheckout=${{ github.event.inputs.frontendCommitToCheckout}}, backendCommitToCheckout=${{ github.event.inputs.backendCommitToCheckout }}" | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
path: ladybug-frontend | |
- name: Fetch all tags | |
if: ${{ github.event.inputs.frontendCommitToCheckout }} | |
run: git fetch --all --tags | |
working-directory: 'ladybug-frontend' | |
- name: Checkout required version | |
if: ${{ github.event.inputs.frontendCommitToCheckout }} | |
run: git checkout ${{ github.event.inputs.frontendCommitToCheckout }} | |
working-directory: 'ladybug-frontend' | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
- name: 'change version' | |
uses: reedyuk/[email protected] | |
with: | |
version: '8.1.2' | |
package: 'ladybug-frontend' | |
- name: Update yarn | |
run: corepack enable | |
working-directory: 'ladybug-frontend' | |
- name: Show npm version | |
run: npm -v | |
working-directory: 'ladybug-frontend' | |
- name: Show node version | |
run: node -v | |
working-directory: 'ladybug-frontend' | |
- name: Show yarn version | |
run: yarn -v | |
working-directory: 'ladybug-frontend' | |
- name: Install packages | |
run: yarn install --immutable | |
working-directory: ladybug-frontend | |
- name: Set Cypress environment variables | |
run: cp cypress.env.json.cicd cypress.env.json | |
working-directory: ladybug-frontend | |
- name: Build project | |
run: yarn run build | |
working-directory: ladybug-frontend | |
- name: Run linter | |
run: yarn run lint | |
working-directory: ladybug-frontend | |
- name: Run unit tests | |
run: yarn run test-headless | |
working-directory: ladybug-frontend | |
continue-on-error: false | |
- name: Checkout frank-runner | |
uses: actions/checkout@v2 | |
with: | |
repository: ibissource/frank-runner | |
path: frank-runner | |
- name: Set property to skip backend unit tests | |
run: echo "maven.skip.tests=true" > frank-runner/specials/ibis-ladybug/build.properties | |
- name: Set properties to skip backend Javadoc | |
run: echo "maven.skip.javadoc=true" >> frank-runner/specials/ibis-ladybug/build.properties | |
- name: Set property to skip checking licenses | |
run: echo "maven.skip.copyright=true" >> frank-runner/specials/ibis-ladybug/build.properties | |
- name: Set property to skip replace check | |
run: echo "skip.replace.check=true" >> frank-runner/specials/ibis-ladybug/build.properties | |
- name: Set port where ibis-ladybug-test-webapp is served | |
run: echo "tomcat.connector.port=8090" > frank-runner/build.properties | |
- name: Make script executable that starts backend | |
run: chmod a+x frank-runner/specials/ibis-ladybug/restart.sh | |
- name: Checkout ibis-ladybug | |
uses: actions/checkout@v2 | |
with: | |
repository: ibissource/ibis-ladybug | |
path: ibis-ladybug | |
- name: Fetch all tags of ibis-ladybug | |
if: ${{ github.event.inputs.backendCommitToCheckout }} | |
run: git fetch --all --tags | |
working-directory: 'ibis-ladybug' | |
- name: Checkout required version of ibis-ladybug | |
if: ${{ github.event.inputs.backendCommitToCheckout }} | |
run: git checkout ${{ github.event.inputs.backendCommitToCheckout }} | |
working-directory: 'ibis-ladybug' | |
- name: Merge backend with its master | |
if: ${{ github.event.inputs.mergeMasterToBranch == 'true' }} | |
run: git merge master | |
working-directory: 'ibis-ladybug' | |
- name: Checkout ibis-ladybug-test-webapp | |
uses: actions/checkout@v2 | |
with: | |
repository: ibissource/ibis-ladybug-test-webapp | |
path: ibis-ladybug-test-webapp | |
- name: Cache Frank!Runner dependencies - build | |
uses: actions/cache@v3 | |
with: | |
path: frank-runner/build | |
key: ${{ runner.os }}-frank-runner-build | |
restore-keys: | | |
${{ runner.os }}-frank-runner-build | |
- name: Cache Frank!Runner dependencies - download | |
uses: actions/cache@v3 | |
with: | |
path: frank-runner/download | |
key: ${{ runner.os }}-frank-runner-download | |
restore-keys: | | |
${{ runner.os }}-frank-runner-download | |
- name: Cache Maven downloads | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository/ | |
key: ${{ runner.os }}-maven | |
restore-keys: | | |
${{ runner.os }}-maven | |
- name: Show current time, allows you to check that logs are not old | |
run: date | |
- name: Remove old catalina.out | |
run: rm -rf frank-runner/build/apache-tomcat-9.0.56/logs/catalina.out | |
- name: Let Frank!Runner do its downloads | |
run: yarn run installFrankRunnerEnv | |
working-directory: ladybug-frontend | |
- name: Start server using Frank!Runner in background | |
run: yarn run startServer & | |
working-directory: ladybug-frontend | |
- name: Run cypress with chrome browser | |
if: ${{ github.event.inputs.useRealFrontend != 'true' }} | |
uses: cypress-io/[email protected] | |
with: | |
working-directory: ladybug-frontend | |
start: | | |
yarn run startCicd | |
wait-on: 'http://localhost:8090, http://localhost:4200' | |
wait-on-timeout: 240 | |
browser: chrome | |
# - name: Run cypress with firefox browser | |
# if: ${{ github.event.inputs.useRealFrontend != 'true' }} | |
# uses: cypress-io/[email protected] | |
# with: | |
# working-directory: ladybug-frontend | |
# start: | | |
# yarn run startCicd | |
# wait-on: 'http://localhost:8090, http://localhost:4200' | |
# wait-on-timeout: 240 | |
# browser: firefox | |
# config: screenshotsFolder=cypress/firefox/screenshots,videosFolder=cypress/firefox/videos | |
- name: Run cypress with chrome browser - real frontend | |
if: ${{ github.event.inputs.useRealFrontend == 'true' }} | |
uses: cypress-io/[email protected] | |
with: | |
working-directory: ladybug-frontend | |
wait-on: 'http://localhost:8090' | |
wait-on-timeout: 240 | |
browser: chrome | |
config: baseUrl=http://localhost:8090/ladybug/ | |
# - name: Run cypress with firefox browser - real frontend | |
# if: ${{ github.event.inputs.useRealFrontend == 'true' }} | |
# uses: cypress-io/[email protected] | |
# with: | |
# working-directory: ladybug-frontend | |
# wait-on: 'http://localhost:8090' | |
# wait-on-timeout: 240 | |
# browser: firefox | |
# config: baseUrl=http://localhost:8090/ladybug/,screenshotsFolder=cypress/firefox/screenshots,videosFolder=cypress/firefox/videos | |
- name: Show files | |
run: tree -d -L 5 . | |
if: always() | |
- name: Store log of Frank!Runner downloads | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: installFrankRunnerEnv.log | |
path: frank-runner/installFrankRunnerEnv.log | |
- name: Store log of starting the server with the Frank!Runner | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: serverStartLog.log | |
path: frank-runner/specials/ibis-ladybug/serverStartLog.log | |
- name: Store build.properties | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: specials_build.properties | |
path: frank-runner/specials/ibis-ladybug/build.properties | |
- name: Store Apache Tomcat log | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: logs | |
path: frank-runner/build/*/logs/* | |
- name: Store Cypress screenshots | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: screenshots | |
path: ladybug-frontend/cypress/screenshots/ | |
- name: Store Cypress videos | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: videos | |
path: ladybug-frontend/cypress/videos/ | |
- name: Store Cypress screenshots for Firefox | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: Firefix screenshots | |
path: ladybug-frontend/cypress/firefox/screenshots/ | |
- name: Store Cypress videos for Firefox | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: Firefox videos | |
path: ladybug-frontend/cypress/firefox/videos/ |