-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (83 loc) · 3 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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: ["19.1.0"]
swift-version: ["5.9"]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: "Tests"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ needs.swift-format.outputs.commitSHA }}
- name: Install Swift ${{ matrix.swift-version }} on macOS/Linux
if: ${{ runner.os != 'Windows' }}
uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift-version }}
- name: Install Swift ${{ matrix.swift-version }} on Windows
if: ${{ runner.os == 'Windows' }}
run: |
Install-Binary -Url "https://download.swift.org/swift-${{ matrix.swift-version }}-release/windows10/swift-${{ matrix.swift-version }}-RELEASE/swift-${{ matrix.swift-version }}-RELEASE-windows10.exe" -Name "installer.exe" -ArgumentList ("-q")
Add-Content $env:GITHUB_PATH "C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin"
Add-Content $env:GITHUB_PATH "C:\Program Files\swift\runtime-development\usr\bin"
Add-Content $env:GITHUB_PATH "C:\Program Files\swift\icu-69.1\usr\bin"
Add-Content $env:GITHUB_ENV "SDKROOT=C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk"
Add-Content $env:GITHUB_ENV "DEVELOPER_DIR=C:\Library\Developer"
- name: Enable MS Developer Command Prompt
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
- 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