CI #108
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: CI | |
on: | |
workflow_dispatch: | |
defaults: | |
run: | |
working-directory: .tests | |
shell: bash | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Define env name | |
id: define-environment-name | |
run: | | |
echo "env-name=ci-$(date +%s%N)" >> $GITHUB_OUTPUT | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright browsers | |
run: | | |
npx playwright install --with-deps | |
- name: Start test environment | |
id: start-test-environment | |
run: | | |
RESULT=$(curl --location --request POST 'https://api.clearscape.teradata.com/environments' \ | |
--header "Authorization: Bearer $CSAE_TOKEN" \ | |
--header 'Content-Type: application/json' \ | |
--data-raw "{ | |
\"name\": \"$CSAE_ENV_NAME\", | |
\"region\": \"us-central\", | |
\"password\": \"$CSAE_ENV_PASSWORD\" | |
}") | |
# replace with jq | |
JUPYTER_ENV=$(echo $RESULT | grep url | head -n 1 | cut -d"\"" -f 4) | |
echo "jupyter-env-url=$JUPYTER_ENV" >> $GITHUB_OUTPUT | |
env: | |
CSAE_TOKEN: '${{ secrets.CSAE_TOKEN }}' | |
CSAE_ENV_PASSWORD: '${{ secrets.CSAE_ENV_PASSWORD }}' | |
CSAE_ENV_NAME: '${{ steps.define-environment-name.outputs.env-name}}' | |
- name: Run Playwright tests | |
run: | | |
npx playwright test | |
env: | |
ENVIRONMENT: ${{ steps.start-test-environment.outputs.jupyter-env-url }} | |
CSAE_ENV_PASSWORD: '${{ secrets.CSAE_ENV_PASSWORD }}' | |
- name: Delete test environment | |
if: always() | |
run: | | |
curl --location --request DELETE "https://api.clearscape.teradata.com/environments/$CSAE_ENV_NAME" \ | |
--header "Authorization: Bearer $CSAE_TOKEN" | |
env: | |
CSAE_TOKEN: '${{ secrets.CSAE_TOKEN }}' | |
CSAE_ENV_NAME: '${{ steps.define-environment-name.outputs.env-name}}' | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: .tests/playwright-report/ | |
retention-days: 30 |