forked from mendix/widgets-resources
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (66 loc) · 3.37 KB
/
WebAutomatedTests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Run automated end-to-end tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
name: "Automated tests"
runs-on: ubuntu-latest
steps:
- name: "Checking changed files"
id: files
uses: softprops/diffset@v1
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
with:
global_files: |
!{packages/**/*,configs/e2e/*.json}
not_atlas_native_files: |
!packages/theming/atlas/src/**/native/**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Checking-out code"
uses: actions/checkout@v2
with:
submodules: false
- name: "Fetching master to compare"
if: github.event_name == 'pull_request' && steps.files.outputs.global_files == ''
run:
git fetch --no-tags --prune --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
- name: "Defining environment variables"
id: variables
run:
echo "::set-output name=arg::$(if [ "${{ steps.files.outputs.global_files }}" = "" ] && ${{ github.event_name == 'pull_request' }}; then echo '--since origin/${{ github.base_ref }}'; else echo ''; fi)"
- name: "Defining cache"
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: "Installing dependencies"
run: npm install
- name: "Building package in production mode"
run: npm run release -- ${{ steps.variables.outputs.arg }}
- name: "Executing E2E tests"
if: github.event_name != 'pull_request' || steps.files.outputs.not_atlas_native_files != ''
run: npm run test:e2e -- ${{ steps.variables.outputs.arg }}
- name: "Fixing files permissions"
if: failure()
run: |
sudo find ${{ github.workspace}}/packages/pluggableWidgets -type d -exec chmod 755 {} \;
sudo find ${{ github.workspace}}/packages/theming -type d -exec chmod 755 {} \;
sudo find ${{ github.workspace}}/packages/pluggableWidgets -type f -exec chmod 644 {} \;
sudo find ${{ github.workspace}}/packages/theming -type f -exec chmod 644 {} \;
- name: "Archive test screenshot diff results"
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-screenshot-results
path: |
${{ github.workspace}}/packages/pluggableWidgets/**/tests/e2e/screenshot-results/diff/*.png
${{ github.workspace}}/packages/pluggableWidgets/**/tests/e2e/screenshot-results/TESTFAIL_*.png
${{ github.workspace}}/packages/theming/**/tests/e2e/screenshot-results/diff/*.png
${{ github.workspace}}/packages/theming/**/tests/e2e/screenshot-results/TESTFAIL_*.png
if-no-files-found: error