Fix capture detection #2885
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
# README: | |
# | |
# The semantics for running shell commands in GitHub actions is non-obvious. Please read | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell | |
# before modifying this file. Our strategy is to rely on the built-in (unspecified) shell, and | |
# explicitly set the shell settings we want (with `set -eo pipefail`) at the beginning of any | |
# bash script. For more information on these settings, see `man bash`. | |
# | |
# GitHub Actions files can be difficult to modify with confidence, because testing changes often | |
# requires pushing to a branch and running CI remotely. To make this process easier, consider | |
# the following: | |
# | |
# 1) Use Visual Studio Code with the GitHub Actions Extension (github.vscode-github-actions). | |
# This allows you to check the validity of your action schema and syntax without pushing to a | |
# branch. | |
# 2) Use https://github.com/nektos/act to run your CI steps locally. Note this will only work with | |
# steps run on Linux platforms, as `act` is implemented with Docker containers. | |
on: | |
push: | |
branches: [ main, rewrite ] | |
paths-ignore: | |
- "Docs/**" | |
- "**.md" | |
- "README.md" | |
- "LICENSE" | |
- ".gitignore" | |
tags: | |
- v* | |
pull_request: | |
branches: [ "**" ] | |
paths-ignore: | |
- "Docs/**" | |
- "**.md" | |
- "README.md" | |
- "LICENSE" | |
- ".gitignore" | |
jobs: | |
determine-version: | |
name: "Determine compiler version from git tag" | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-tag.outputs.version }} | |
steps: | |
- id: get-tag | |
run: | | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
version=${GITHUB_REF#refs/tags/} | |
else | |
version="" | |
fi | |
echo "version=$version" >> $GITHUB_OUTPUT | |
build-devcontainer: | |
needs: determine-version | |
name: "Devcontainer: ${{ matrix.host.os }}/${{ matrix.configuration }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
host: [ | |
{ type: linux, os: ubuntu-latest, | |
build-options: "--build-tests -Xswiftc -enable-testing --explicit-target-dependency-import-check error", | |
test-options: "--enable-code-coverage --explicit-target-dependency-import-check error", | |
} | |
] | |
configuration: [ "debug", "release" ] | |
include: | |
- configuration: "debug" | |
parallel-test: "--parallel" | |
# See https://github.com/apple/swift-package-manager/issues/7069 | |
- configuration: "release" | |
parallel-test: "" | |
runs-on: ${{ matrix.host.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
show-progress: false | |
- name: Set compiler version | |
run: ./Tools/set-hc-version.sh ${{ needs.determine-version.outputs.version }} | |
- name: Build and Test | |
uses: devcontainers/[email protected] | |
with: | |
runCmd: | | |
set -eo pipefail | |
swift package resolve | |
.build/checkouts/Swifty-LLVM/Tools/make-pkgconfig.sh llvm.pc | |
export PKG_CONFIG_PATH=$PWD | |
swift build -c ${{ matrix.configuration }} ${{ matrix.host.build-options }} | |
swift test -c ${{ matrix.configuration }} ${{ matrix.host.test-options }} ${{ matrix.parallel-test }} | | |
tee testoutput.txt && ( | |
(grep -q "[.']EndToEndTests[/. ]test_" testoutput.txt && grep -q "[.']HyloTests[/. ]test_" testoutput.txt) || | |
(echo "error: generated tests failed to run; see | |
https://github.com/apple/swift-package-manager/issues/6595" && false) ) | |
.build/${{ matrix.configuration }}/hc --version | |
- name: Check code coverage | |
uses: mattpolzin/[email protected] | |
with: | |
SORT_ORDER: +cov | |
MINIMUM_COVERAGE: 84 | |
CODECOV_JSON: .build/${{ matrix.configuration }}/codecov/*.json | |
build-native-macos: | |
needs: determine-version | |
name: "Native: ${{ matrix.host.os }}/${{ matrix.configuration }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
host: [ | |
{ | |
type: macos, os: macos-13, | |
build-options: "--build-tests -Xswiftc -enable-testing --explicit-target-dependency-import-check error", | |
# No coverage support on MacOS | |
test-options: "--parallel" | |
} | |
] | |
swift: [ | |
{ version: "5.9" } | |
] | |
configuration: [ "debug", "release" ] | |
runs-on: ${{ matrix.host.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
show-progress: false | |
- name: Set compiler version | |
run: ./Tools/set-hc-version.sh ${{ needs.determine-version.outputs.version }} | |
- name: Setup swift | |
uses: swift-actions/setup-swift@v1 | |
with: | |
swift-version: ${{ matrix.swift.version }} | |
- run: swift --version | |
- name: Setup LLVM | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "15.0" | |
- run: llvm-config --version | |
- name: Generate LLVM pkgconfig file | |
run: | | |
set -eo pipefail | |
swift package resolve | |
.build/checkouts/Swifty-LLVM/Tools/make-pkgconfig.sh llvm.pc | |
cat llvm.pc | |
- name: Build (${{ matrix.configuration }}) | |
run: | | |
set -eo pipefail | |
export PKG_CONFIG_PATH=$PWD | |
swift build -c ${{ matrix.configuration }} ${{ matrix.host.build-options }} | |
- name: Test (${{ matrix.configuration }}) | |
run: | | |
set -eo pipefail | |
export PKG_CONFIG_PATH=$PWD | |
swift test -c ${{ matrix.configuration }} ${{ matrix.host.test-options }} | | |
tee testoutput.txt && ( | |
(grep -q "[.']EndToEndTests[/. ]test_" testoutput.txt && grep -q "[.']HyloTests[/. ]test_" testoutput.txt) || | |
(echo "error: generated tests failed to run; see | |
https://github.com/apple/swift-package-manager/issues/6595" && false) ) | |
- name: Output compiler version | |
run: .build/${{ matrix.configuration }}/hc --version | |
build-native-windows: | |
needs: determine-version | |
name: "Native: windows-latest, debug" | |
strategy: | |
fail-fast: false | |
runs-on: windows-latest | |
steps: | |
- name: Setup swift | |
uses: compnerd/[email protected] | |
with: | |
github-repo: thebrowsercompany/swift-build | |
release-asset-name: installer-amd64.exe | |
release-tag-name: 20231130.2 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
show-progress: false | |
- name: Set compiler version | |
run: | | |
& "C:\Program Files\Git\bin\bash.exe" Tools/set-hc-version.sh ${{ needs.determine-version.outputs.version }} | |
- name: Swift version | |
run: swift --version | |
- name: Set up LLVM 15.0.6 | |
run: | | |
curl.exe -L -O -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}"https://github.com/c3lang/win-llvm/releases/download/llvm_15_0_6/llvm-15.0.6-windows-x86-msvc17-msvcrt.7z | |
7z x llvm-15.0.6-windows-x86-msvc17-msvcrt.7z -oC:\ | |
Add-Content $env:GITHUB_PATH 'C:\llvm-15.0.6-windows-x86-msvc17-msvcrt\bin' | |
- run: llvm-config --version | |
- name: Generate LLVM pkgconfig file | |
run: | | |
swift package resolve | |
& "C:\Program Files\Git\bin\bash.exe" .build/checkouts/Swifty-LLVM/Tools/make-pkgconfig.sh llvm.pc | |
type llvm.pc | |
- name: Build support library | |
run: clang -c ./StandardLibrary/Sources/LibC.c -o HyloLibC.lib | |
- name: Prevent reentrant builds for speed | |
run: echo 'SPM_BUILD_TOOL_SUPPORT_NO_REENTRANT_BUILD=1' >> $env:GITHUB_ENV | |
- name: Build the dependencies of build tools for non-reentrant build | |
run: swift build --explicit-target-dependency-import-check=error --pkg-config-path . --target BuildToolDependencies | |
- name: Build tests | |
run: swift build --explicit-target-dependency-import-check error --build-tests --pkg-config-path . | |
- name: Test | |
run: swift test --parallel --skip-build --pkg-config-path . | |
- name: Output compiler version | |
run: .build/debug/hc --version |