Clean up a bit and prepare for other tests #1231
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: Test the tests | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
tags: | |
required: False | |
description: 'Optional. Use a "tag expression" specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)' | |
default: '' | |
jobs: | |
puppeteer-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
env: | |
BASE_URL: ${{ secrets.SERVER_URL }} | |
PLAYGROUND_EMAIL: ${{ secrets.PLAYGROUND_EMAIL }} | |
PLAYGROUND_PASSWORD: ${{ secrets.PLAYGROUND_PASSWORD }} | |
PLAYGROUND_ID: ${{ secrets.PLAYGROUND_ID }} | |
DOCASSEMBLE_DEVELOPER_API_KEY: ${{ secrets.DOCASSEMBLE_DEVELOPER_API_KEY }} | |
USER1_EMAIL: ${{ secrets.USER1_EMAIL }} | |
USER1_PASSWORD: ${{ secrets.USER1_PASSWORD }} | |
SECRET_VAR1: secret-var1-value | |
SECRET_VAR2: secret-var2-value | |
SECRET_FOR_MISSING_FIELD: secret for missing field | |
_ORIGIN: github | |
name: Run Puppeteer tests | |
steps: | |
- name: Set Github-related environment variables | |
run: | | |
echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV | |
echo "BRANCH_PATH=${{ github.ref }}" >> $GITHUB_ENV | |
- name: Set name of artifact folder with date and UTC time | |
# https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/#how-to-format-a-date-in-bash | |
run: | | |
echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV | |
echo "UNIT_TESTS_ARTIFACT_NAME=_alkiln-misc-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV | |
# For the testing repo, the `REPO_URL` is that of a different repo and is created in `env:` | |
- run: echo "Repo address is $REPO_URL" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: npm run setup | |
- run: npm run test ${{ github.event.inputs.tags && format('{0}', github.event.inputs.tags) }} | |
# Artifacts | |
- name: upload unit tests artifacts folder | |
uses: actions/upload-artifact@v3 | |
# This will upload even if a previous step has failed | |
if: ${{ always() }} | |
with: | |
name: ${{ env.UNIT_TESTS_ARTIFACT_NAME }} | |
path: ./_alkiln-* | |
- name: upload integration tests artifacts folder | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ./alkiln-* | |
# Delete Playground Project and project name file | |
- name: Cleanup | |
if: ${{ always() }} | |
run: npm run takedown |