-
Notifications
You must be signed in to change notification settings - Fork 69
/
action.yml
86 lines (74 loc) · 2.65 KB
/
action.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Setup E2E Environment
description: Install dependencies, build WCPay client & setup the test environment
runs:
using: "composite"
steps:
# Add GH token for authentication
- name: Add GH token for authentication
shell: bash
run: echo -e "machine github.com\n login $E2E_GH_TOKEN" > ~/.netrc
# PHP setup
- name: "Set up PHP"
uses: ./.github/actions/setup-php
# Composer setup
- name: Setup Composer
shell: bash
run: composer self-update
# Use node version from .nvmrc
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
# Cache composer dependencies
- name: Cache composer dependencies
id: composer-cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}-${{ hashFiles('composer.lock') }}
# Cache node dependencies
- name: Cache node dependencies
id: node-cache
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
# Install composer dependencies if not present on cache
- name: Install composer dependencies
if: ${{ steps.composer-cache.outputs.cache-hit == false }}
shell: bash
run: composer install --no-progress
# Install node dependencies if not present on cache
- name: Install node dependencies
if: ${{ steps.node-cache.outputs.cache-hit == false }}
shell: bash
run: npm ci
# Build WCPay client
- name: Build WCPay Client
if: ${{ ! env.WCPAY_USE_BUILD_ARTIFACT }}
shell: bash
run: |
echo "::group::Build WCPay client"
npm run build:client
echo "::endgroup::"
# Kill process running on port 8084
- name: Kill mono-xsp4.service
shell: bash
run : |
echo "::group::Kill webserver running on port 8084"
sudo fuser -k -n tcp 8084 || true
echo "::endgroup::"
# Prepare test environment
- name: Prepare test environment
shell: bash
run: |
echo "::group::Setup E2E test environment"
npm run test:e2e-setup
echo "::endgroup::"
# Disable restrictions that prevent chromium from running properly. See: https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor User Namespace Restrictions
shell: bash
run: |
echo "::group::Disable AppArmor User Namespace Restrictions"
sudo sysctl --ignore --write kernel.apparmor_restrict_unprivileged_userns=0
echo "::endgroup::"