Skip to content

Add add-to-path input to control whether the toolchain is added to the PATH #163

Add add-to-path input to control whether the toolchain is added to the PATH

Add add-to-path input to control whether the toolchain is added to the PATH #163

Workflow file for this run

name: "units-test"
on:
pull_request:
push:
branches:
- main
- 'releases/*'
jobs:
# unit tests
units:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci
- run: npm test
# test action works running from the graph
test:
strategy:
fail-fast: true
matrix:
include:
- swift-version: wasm-5.7.1-RELEASE
os: ubuntu-20.04
- swift-version: wasm-5.6.0-RELEASE
os: macos-11
- swift-version: wasm-5.8.0-RELEASE
os: ubuntu-latest
container: swift:amazonlinux2
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
- uses: ./
with:
swift-version: ${{ matrix.swift-version }}
- run: swift --version
test-default:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./
- run: swift --version
test-skip-add-to-path:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./
id: setup
with:
add-to-path: false
- name: Ensure that the toolchain is not added to the PATH
shell: node {0}
run: |
const path = require('path');
const core = require('@actions/core');
const toolchainPath = path.join(core.getInput('toolchain-path'), 'usr', 'bin');
const pathEnv = process.env.PATH;
console.log(`Checking if ${toolchainPath} is in the PATH (${pathEnv})`);
const pathCandidates = pathEnv.split(path.delimiter);
if (pathCandidates.includes(toolchainPath)) {
throw new Error(`Toolchain path ${toolchainPath} is in the PATH`);
}
test-nightly:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./nightly
- run: swift --version