-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (69 loc) · 1.91 KB
/
run_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
name: "Run Tests"
on:
workflow_dispatch:
push:
branches:
- "**"
paths:
[
"**Package.resolved",
"**.swift",
"**.js",
"Tests/package.json",
"Tests/package-lock.json",
".github/workflows/run_tests.yml",
]
jobs:
swift-format:
name: Format Swift
runs-on: ubuntu-latest
outputs:
commitSHA: ${{ steps.output-commit.outputs.commitSHA }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install SwiftFormat
uses: Cyberbeni/install-swift-tool@v2
with:
url: https://github.com/nicklockwood/SwiftFormat
- name: Run SwiftFormat
run: swiftformat .
- uses: EndBug/add-and-commit@v9
with:
author_name: botlockwood
default_author: github_actions
message: "ran swiftformat"
- name: Output Commit ID
id: output-commit
run: |
SHA=$(git rev-parse HEAD)
echo "commitSHA=$SHA" >> $GITHUB_OUTPUT
run-tests:
name: Run Tests on ${{ matrix.os }} with Swift ${{ matrix.swift-version }} Node ${{ matrix.node-version }}
needs: swift-format
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
node-version: ["20"]
swift-version: ["5.9.2"]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: "Tests"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ needs.swift-format.outputs.commitSHA }}
- uses: SwiftyLab/setup-swift@latest
with:
swift-version: ${{ matrix.swift-version }}
- name: Install Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "Tests/package-lock.json"
- name: Test
run: |
npm install
npm test