Skip to content

Update run_tests.yml #203

Update run_tests.yml

Update run_tests.yml #203

Workflow file for this run

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.10.1"]
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