ci: approve on success #397
Workflow file for this run
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: ⚙️ E2E | |
on: | |
pull_request: | |
env: | |
CYPRESS_failOnSnapshotDiff: 0 | |
CYPRESS_SNAPSHOTS_PATH: /projects/demo-cypress/cypress/snapshots | |
jobs: | |
build-demo: | |
name: Build demo | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- uses: taiga-family/ci/actions/run/[email protected] | |
continue-on-error: true | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- name: Building demo-app of git-branch without cache | |
run: npx nx build editor-demo --output-path ${{ env.DIST }} | |
- name: Upload cache / ${{ env.CACHE_DIST_KEY }} | |
uses: actions/cache/[email protected] | |
with: | |
path: dist/demo | |
key: ${{ env.CACHE_DIST_KEY }} | |
cypress: | |
needs: [build-demo] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- name: Download cache / ${{ env.CACHE_DIST_KEY }} | |
uses: actions/cache/[email protected] | |
with: | |
path: dist/demo | |
key: ${{ env.CACHE_DIST_KEY }} | |
- name: Serve ${{ env.DIST }} in background | |
run: npx nx serve-compiled demo --path ${{ env.DIST }} --port ${{ env.NG_SERVER_PORT }} | |
- name: Run screenshot tests on ${{ env.DIST }} | |
run: npx nx e2e editor-demo-cypress | |
- name: Clean up resources | |
run: npx kill-port --port ${{ env.NG_SERVER_PORT }} | |
- name: Download ${{ env.DIST_NEXT }} for serve locally | |
run: | | |
git clone \ | |
--depth 1 \ | |
--branch snapshots/demo/next/${{ github.base_ref }} \ | |
https://github.com/taiga-family/tui-editor.git ${{ env.DIST_NEXT }} | |
- name: Serve ${{ env.DIST_NEXT }} in background | |
run: npx nx serve-compiled demo --path ${{ env.DIST_NEXT }} --port ${{ env.NG_SERVER_PORT }} | |
- name: Run screenshot tests on ${{ env.DIST_NEXT }} | |
continue-on-error: true | |
run: npx nx e2e editor-demo-cypress | |
- name: Clean up resources | |
run: npx kill-port --port ${{ env.NG_SERVER_PORT }} | |
- name: Upload artifacts / ${{ env.CYPRESS_SNAPSHOTS_ARTIFACTS_KEY }} | |
uses: actions/[email protected] | |
with: | |
path: ${{ env.CYPRESS_SNAPSHOTS_PATH }}/**/*.diff.png | |
name: ${{ env.CYPRESS_SNAPSHOTS_ARTIFACTS_KEY }} | |
if-no-files-found: ignore | |
retention-days: 1 | |
result: | |
if: ${{ !contains(github.head_ref , 'release/') }} | |
name: E2E result | |
needs: [cypress] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- uses: taiga-family/ci/actions/setup/[email protected] | |
- name: Download artifacts / ${{ env.SNAPSHOTS_CACHE_KEY }} | |
continue-on-error: true | |
uses: actions/[email protected] | |
with: | |
name: ${{ env.SNAPSHOTS_CACHE_KEY }} | |
path: ${{ env.CYPRESS_SNAPSHOTS_PATH }} | |
- name: Check if diff-output exists | |
id: diff-checker | |
run: | | |
echo "diff_exist=$(find ${{ env.CYPRESS_SNAPSHOTS_PATH }} -regex '.*\.diff\.png$' | wc -l | sed -e 's/^[[:space:]]*//')" >> $GITHUB_OUTPUT | |
- name: Fall with an error if diff-output exists | |
if: ${{ steps.diff-checker.outputs.diff_exist != '0' }} | |
run: | | |
find ${{ env.CYPRESS_SNAPSHOTS_PATH }} -regex '.*\.diff\.png$' -exec echo "{}" \; | |
exit 1 | |
concurrency: | |
group: e2e-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true |