Attempt to get workflow reuse to work #117
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
# Combined cargo check with LLVM installation for the three major platforms. | |
name: Cargo Check | |
on: ["push", "pull_request"] | |
# Cancel in-progress runs for previous commits if there are any that haven't completed yet. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: macos-latest | |
llvm-install-dir: /usr/local/opt/llvm | |
# Temporarily allow mac to fail until the homebrew package for llvm is updated. | |
allow-failure: true | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.allow-failure || false }} | |
steps: | |
- name: Checkout Wright source | |
uses: actions/checkout@v4 | |
# Use stable Rust toolchain | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
# Use MSYS2 on windows to install and check LLVM | |
- uses: msys2/setup-msys2@v2 | |
if: ${{ matrix.os == 'windows-latest' }} | |
with: | |
update: true | |
# Use special mingw LLVM package. | |
# Also install the current stable rust | |
install: >- | |
mingw-w64-x86_64-llvm | |
mingw-w64-x86_64-rust | |
# - name: Install LLVM (Windows Only) | |
# if: ${{ matrix.os == 'windows-latest'}} | |
# run: cargo run --release --bin install-llvm-windows -- ../${{ matrix.llvm-install-dir }} | |
# working-directory: ./ci | |
# - name: Update the Windows PATH (Windows Only) | |
# if: ${{ matrix.os == 'windows-latest' }} | |
# # https://stackoverflow.com/questions/60169752/how-to-update-the-path-in-a-github-action-workflow-file-for-a-windows-latest-hos | |
# shell: pwsh | |
# run: echo ".\${{ matrix.llvm-install-dir }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Install LLVM (Ubuntu Only) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
# See: https://apt.llvm.org/ | |
# Last line: https://gitlab.com/taricorp/llvm-sys.rs/-/issues/13 | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 18 | |
sudo apt install libpolly-18-dev libz-dev | |
- name: Install LLVM 18 (Mac Only) | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: brew install llvm@18 | |
# - name: Get the LLVM version (Windows Only) | |
# if: ${{ matrix.os == 'windows-latest' }} | |
# # Run two commands, the second checks if we get it from the path properly. | |
# run: | | |
# ${{ format('{0}\bin\llvm-config.exe', matrix.llvm-install-dir) }} --version | |
# llvm-config --version | |
# continue-on-error: true | |
- name: Get the LLVM version (Windows Only) | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: msys2 {0} | |
run: llvm-config --version | |
continue-on-error: true | |
- name: Get the LLVM version (Mac Only) | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: ${{ matrix.llvm-install-dir }}/bin/llvm-config --version | |
- name: Get the LLVM version (Ubuntu Only) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: llvm-config --version | |
# For some reason, this seems to error even when the build checks successfully. Leaving it in for now. | |
continue-on-error: true | |
- name: Run cargo check (Mac Only) | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: cargo check | |
env: | |
LLVM_SYS_180_PREFIX: ${{ matrix.llvm-install-dir }} | |
- name: Run cargo check (Ubuntu Only) | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: cargo check | |
- name: Run cargo check (Windows Only) | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: msys2 {0} | |
run: cargo check |