This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
103 lines (99 loc) · 4.19 KB
/
integration-tests.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
name: Integration test
on:
pull_request:
branches: [main]
# Run on release PRs only, or changes to this same file
paths: ['CHANGELOG.md', '.github/workflows/integration-tests.yml']
jobs:
integration:
runs-on: ubuntu-latest
steps:
- name: Checking out zip-it-and-ship-it
uses: actions/checkout@v4
with:
path: zip-it-and-ship-it
- name: Checking out test site
uses: actions/checkout@v4
with:
repository: netlify/next-runtime
path: test-site
- name: Checking out netlify-cli
uses: actions/checkout@v4
with:
repository: netlify/cli
path: netlify-cli
- name: Installing Node.js
uses: actions/setup-node@v3
with:
node-version: '*'
cache: 'npm'
# We need to add each of the lockfile paths so that the global npm cache is populated accordingly
cache-dependency-path: |
zip-it-and-ship-it/package-lock.json
test-site/package-lock.json
netlify-cli/package-lock.json
- name: Setup Deno
uses: denoland/setup-deno@v1
- name: Installing netlify-cli
run: npm ci
working-directory: netlify-cli
- name: Installing test site
run: npm install
working-directory: test-site
- name: Symlinking zip-it-and-ship-it (1/2)
run:
rm -rf $GITHUB_WORKSPACE/netlify-cli/node_modules/@netlify/zip-it-and-ship-it && mkdir -p
$GITHUB_WORKSPACE/netlify-cli/node_modules/@netlify && ln -s $GITHUB_WORKSPACE/zip-it-and-ship-it
$GITHUB_WORKSPACE/netlify-cli/node_modules/@netlify/zip-it-and-ship-it
- name: Symlinking zip-it-and-ship-it (2/2)
run:
rm -rf $GITHUB_WORKSPACE/netlify-cli/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it &&
mkdir -p $GITHUB_WORKSPACE/netlify-cli/node_modules/@netlify/build/node_modules/@netlify && ln -s
$GITHUB_WORKSPACE/zip-it-and-ship-it
$GITHUB_WORKSPACE/netlify-cli/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it
- name: Installing zip-it-and-ship-it
run: npm install && npm run build
working-directory: zip-it-and-ship-it
- name: Building and deploying site
run:
$GITHUB_WORKSPACE/netlify-cli/bin/run.js deploy --build --json --site ${{ secrets.NETLIFY_SITE_ID }} --auth
${{ secrets.NETLIFY_TOKEN }} --cwd demos/default --functions .netlify/functions > .netlify-deploy-log.json
working-directory: test-site
- name: Parsing deploy result
run: |
cat ./.netlify-deploy-log.json
node -e "console.log('deploy_log_url=' + require('./.netlify-deploy-log.json').logs)" >> $GITHUB_ENV
node -e "console.log('deploy_url=' + require('./.netlify-deploy-log.json').deploy_url)" >> $GITHUB_ENVrun: node scripts/parse_deploy_result.mjs ./.netlify-deploy-log.json >> $GITHUB_ENV
working-directory: test-site
- name: Cypress run
uses: cypress-io/github-action@v5
with:
working-directory: test-site
browser: chrome
record: true
parallel: true
config-file: cypress/config/ci.config.ts
group: 'ZISI Integration Test - Next'
spec: cypress/e2e/default/*
env:
DEBUG: '@cypress/github-action'
CYPRESS_baseUrl: ${{ env.deploy_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '## Integration Test: netlify/next-runtime'
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Integration Test: netlify/next-runtime
✅ Cypress tests passed
- **Deploy URL**: ${{ env.deploy_url }}
- **Deploy logs**: ${{ env.deploy_log_url }}
edit-mode: replace