-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (104 loc) · 2.95 KB
/
scripts.tests.yml
File metadata and controls
117 lines (104 loc) · 2.95 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
109
110
111
112
113
114
115
116
117
# Test the scripts.
name: Test Scripts
on:
pull_request:
branches:
- main
env:
# Allow running run-with-summary command.
PATH: ./src:./bin:./vendor/bin:/usr/local/bin:/usr/bin:/bin
jobs:
run-with-summary:
name: run-with-summary script
runs-on: ubuntu-latest
env:
SUCCESS: "Script run-with-summary succeeded! :white_check_mark:"
ERROR: "run-with-summary Failed! :x:"
SUMMARY: |
- Environment: https://pr${{ github.event.number }}.demo.site
- Pull Request: ${{github.event.pull_request.html_url }}
# Show extra details
DEBUG: yes
steps:
- uses: actions/checkout@v4
- name: run-with-summary success
env:
SUCCESS: "Directory List :white_check_mark:"
run: |
run-with-summary ls -la
- name: run-with-summary hide
env:
HIDE: true
SUCCESS: Processes
SUMMARY: This test should not show the process details table.
run: |
run-with-summary ps -aux
- name: run-with-summary failure
continue-on-error: true
env:
ERROR: "run-with-summary Failed on purpose! :x:"
run: |
echo $GITHUB_STEP_SUMMARY
run-with-summary ping w3.org -c5
wait-for:
name: wait-for script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: wait-for failure
continue-on-error: true
env:
TIMEOUT: 2
run: |
run-with-summary wait-for bad-command
- name: wait-for success
continue-on-error: true
env:
TIMEOUT: 5
run: |
run-with-summary wait-for sleep 2
git-ref:
name: git-ref script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check SHA
run: |
git-ref
git-ref --type
REF=$(git-ref)
TYPE=$(git-ref --type)
echo "Current ref: $REF $TYPE" >> $GITHUB_STEP_SUMMARY
if [[ "$REF" != "${{ github.sha }}" ]]; then
echo "Output of git-ref script ($REF) does not match github.sha (${{ github.sha }})"
exit 1;
fi
if [[ "$TYPE" != "sha" ]]; then
echo "git-ref did not return 'sha'."
fi
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Check branch
run: |
git-ref
git-ref --type
REF=$(git-ref)
TYPE=$(git-ref --type)
echo "Current ref: $REF $TYPE" >> $GITHUB_STEP_SUMMARY
if [[ "$REF" != "${{ github.head_ref }}" ]]; then
echo "Output of git-ref script ($REF) does not match github.head_ref (${{ github.head_ref }})"
exit 1;
fi
if [[ "$TYPE" != "branch" ]]; then
echo "git-ref did not return 'branch'."
fi
get-request:
name: get-request script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jonpugh/goatscripts@main
- run: |
run-with-summary \
./tests/get-request-test