-
Notifications
You must be signed in to change notification settings - Fork 32
115 lines (97 loc) · 4.26 KB
/
integration_test_astro.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Integration test
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # end of each day (UTC)
pull_request:
env:
ASTRO_FOLDER: astro-test
jobs:
test:
if: ${{ github.repository == 'primer/brand' }}
name: Astro - React starter
runs-on:
labels: ubuntu-latest-16-cores
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Caching dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Restore the previous NPM modules and Cypress binary archives.
# Any updated archives will be saved automatically after the entire
# workflow successfully finishes.
# See https://github.com/actions/cache
- name: Cache Cypress binary
uses: actions/cache@v1
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('**/package.json') }}
restore-keys: |
cypress-${{ runner.os }}-cypress-
- name: Installing dependencies
run: npm ci --legacy-peer-deps && cd apps/docs && npm ci --legacy-peer-deps
- name: install dependencies and verify Cypress
env:
# make sure every Cypress install prints minimal information
CI: 1
# print Cypress and OS info
run: |
npx cypress install --force
npx cypress verify
npx cypress info
npx cypress version
npx cypress version --component package
npx cypress version --component binary
npx cypress version --component electron
npx cypress version --component node
- name: Build
run: npm run build:lib
- name: Bundling output
run: cd packages/react/ && npm pack
- name: Configuring Astro React / TypeScript project
# lock version to 1.1.0 due to non-tty support removed in 1.2.0
# TODO: review Astro updates regularly to using @latest
run: npm create [email protected] ${{env.ASTRO_FOLDER}} -- --template framework-react
- name: Retrieving package version
id: package-version
uses: martinbeentjes/npm-get-version-action@7aa1d82604bb2dbe377a64ca35e692e6fe333c9c
with:
path: packages/repo-configs
- name: Installing local build
run: |
cd ${{env.ASTRO_FOLDER}}
cp ../packages/react/primer-react-brand-${{ steps.package-version.outputs.current-version}}.tgz ./
npm install primer-react-brand-${{ steps.package-version.outputs.current-version}}.tgz
- name: Prefer CommonJS imports
run: |
mv packages/e2e/integration-tests/fixtures/index.cjs.ts packages/e2e/integration-tests/fixtures/index.ts
rm packages/e2e/integration-tests/fixtures/index.esm.ts
- name: Copying required files
run: |
cp packages/e2e/integration-tests/astro/index.astro ./${{env.ASTRO_FOLDER}}/src/pages
cp packages/e2e/cypress.config.js ./${{env.ASTRO_FOLDER}}/cypress.config.cjs
cp -r packages/e2e/integration-tests/fixtures ./${{env.ASTRO_FOLDER}}/src
mkdir ${{env.ASTRO_FOLDER}}/integration-tests
cp -r packages/e2e/integration-tests/fixtures ./${{env.ASTRO_FOLDER}}/integration-tests
cp -r packages/e2e/integration-tests/tests ./${{env.ASTRO_FOLDER}}/integration-tests
- name: Testing compile-time build
run: cd ${{env.ASTRO_FOLDER}} && npm run build
# Cypress is not able to run tests in the Astro project due to bundler errors
# Local tsconfig compilerOptions are not respected
# FIXME: When there is a workaround in both Cypress and Astro
# See https://github.com/cypress-io/cypress/issues/28052
- name: Remove base tsconfig due to bundler error
run: npx json -I -f ${{env.ASTRO_FOLDER}}/tsconfig.json -e 'delete this.extends'
- name: Test runtime for errors and warnings
run: cd ${{env.ASTRO_FOLDER}} && npx start-server-and-test 'npx http-server ./dist -p 3000' 3000 'npx cypress run --spec "./integration-tests/tests/*" --config video=false'