Don't trigger on Pull Request #49
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Preview-Ui Build | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: Branch name to re-build ? | |
required: true | |
type: string | |
push: | |
jobs: | |
build: | |
env: | |
branch: ${{ inputs.branch || github.ref_name }} | |
stage: ${{ inputs.branch == 'main' && 'latest' || github.ref_name == 'main' && 'latest' || 'next' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
browser: [chromium, chrome] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ env.branch }} | |
token: ${{secrets.DONTCODE_ACTIONS_TOKEN}} | |
- name: Use Node.js version 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: 'npm' | |
- name: Install | |
run: | | |
npm install -g nx | |
npm install --force | |
npm install @dontcode/core@${{env.stage}} @dontcode/plugin-common@${{env.stage}} @dontcode/sandbox@${{env.stage}} | |
- name: Build | |
run: nx run preview-ui:build:production | |
- name: Unit Tests | |
run: | | |
nx run preview-ui:test | |
- name: E2E Tests on ${{matrix.browser}} | |
run: | | |
nx run preview-ui-e2e:e2e --browser ${{matrix.browser}} | |
- uses: actions/upload-artifact@v4 | |
# Test run screenshots only on failure | |
if: failure() | |
with: | |
name: cypress-${{matrix.browser}}-screenshots | |
path: dist/cypress/apps/preview-ui-e2e/screenshots | |
# Test run video was always captured, so this action uses "always()" condition | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cypress-${{matrix.browser}}-videos | |
path: dist/cypress/apps/preview-ui-e2e/videos |