-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (95 loc) · 2.68 KB
/
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
name: tests
on:
pull_request:
push:
branches:
- "**"
tags:
- "!**"
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run lint
- name: Verify no unstaged changes
shell: bash
run: |
if [[ "$(git status --porcelain)" != "" ]]; then
echo ----------------------------------------
echo git status
echo ----------------------------------------
git status
echo ----------------------------------------
echo git diff
echo ----------------------------------------
git diff
echo ----------------------------------------
echo Troubleshooting
echo ----------------------------------------
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run format && npm run build"
exit 1
fi
testing:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Test same hash
uses: ./
with:
head-ref: ${{ github.sha }}
base-ref: ${{ github.sha }}
- name: Test versus main
uses: ./
with:
head-ref: ${{ github.sha }}
base-ref: "main"
- name: Test default head-ref fallback
uses: ./
with:
head-ref: ""
base-ref: ${{ github.sha }}
- name: Test default base-ref fallback
uses: ./
with:
head-ref: ${{ github.sha }}
base-ref: ""
- name: Get refspecs
id: get-refspecs
shell: bash
run: |
echo head-ref=$(git rev-parse HEAD) >> $GITHUB_OUTPUT
echo base-ref=$(git rev-parse HEAD~10) >> $GITHUB_OUTPUT
- name: Test `fail-after` is not triggered
uses: ./
with:
head-ref: ${{ steps.get-refspecs.outputs.head-ref }}
base-ref: ${{ steps.get-refspecs.outputs.base-ref }}
deepen-length: 1
fail-after: 6
- name: Test `fail-after` is triggered
id: test_fail-after
uses: ./
continue-on-error: true
with:
head-ref: ${{ steps.get-refspecs.outputs.head-ref }}
base-ref: ${{ steps.get-refspecs.outputs.base-ref }}
deepen-length: 1
fail-after: 5
- name: Check failures
shell: bash
run: |
if [[ ${{ steps.test_fail-after.outcome }} != "failure" ]]; then
echo "Test fail-after failed";
exit 1;
fi