-
-
Notifications
You must be signed in to change notification settings - Fork 6
108 lines (103 loc) · 3.59 KB
/
run-integration-test.yml
File metadata and controls
108 lines (103 loc) · 3.59 KB
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
# Summary:
# Test the GitHub Action using an integration test.
# Makes sure the GitHub Action works properly when running on a clean machine, without building anything (integration test).
#
# See https://github.com/actions/checkout https://github.com/actions/checkout/releases/tag/v3
name: 'GitHub Action integration test'
on:
pull_request:
push:
jobs:
run-integration-test1:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: yarn # Install all dependencies
- uses: ./
id: store-variables
with:
variables: |
URL=https://github.com
# Next step: verify that the variable has been saved in the ENV.
- run: |
if [ -z "$URL" ]; then
echo "Error: github-action-store-variable lib did not save 'URL' to ENV as expected. The library is not working as intended."
exit 1
fi
echo "Exported variable URL is: $URL"
env:
URL: ${{ env.URL }}
run-integration-test2:
runs-on: ubuntu-22.04
needs: run-integration-test1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: yarn # Install all dependencies
- uses: ./
with:
variables: |
URL
SECOND_URL=https://github.com/UnlyEd
# Next step: verify that both URL and SECOND_URL were propagated.
- run: |
if [ -z "$URL" ]; then
echo "Error: github-action-store-variable lib did not propagate 'URL' to the environment as expected. The library is not working as intended."
exit 1
fi
if [ -z "$SECOND_URL" ]; then
echo "Error: github-action-store-variable lib did not save 'SECOND_URL' to ENV as expected. The library is not working as intended."
exit 1
fi
echo "Found from previous job, URL is: $URL"
echo "Exported variable SECOND_URL is: $SECOND_URL"
env:
URL: ${{ env.URL }}
SECOND_URL: ${{ env.SECOND_URL }}
run-integration-test3:
runs-on: ubuntu-22.04
needs: run-integration-test2
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: yarn # Install all dependencies
- uses: ./
with:
variables: |
URL
SECOND_URL
# Next step: verify that URL and SECOND_URL are available.
- run: |
if [ -z "$URL" ]; then
echo "Error: github-action-store-variable lib did not propagate 'URL' to the environment as expected. The library is not working as intended."
exit 1
fi
if [ -z "$SECOND_URL" ]; then
echo "Error: github-action-store-variable lib did not propagate 'SECOND_URL' to the environment as expected. The library is not working as intended."
exit 1
fi
echo "Found from previous job, URL is: $URL"
echo "Found from previous job, SECOND_URL is: $SECOND_URL"
env:
URL: ${{ env.URL }}
SECOND_URL: ${{ env.SECOND_URL }}
should-not-fail-on-retrieving-UNKNOWN_VAR:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: yarn # Install all dependencies
- uses: ./
with:
variables: |
UNKNOWN_VAR
failIfNotFound: false # Default is false, so missing UNKNOWN_VAR is allowed.