Skip to content

Merge pull request #915 from vrc-get/dependabot/npm_and_yarn/vrc-get-… #2205

Merge pull request #915 from vrc-get/dependabot/npm_and_yarn/vrc-get-…

Merge pull request #915 from vrc-get/dependabot/npm_and_yarn/vrc-get-… #2205

Workflow file for this run

name: CI (Build)
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- run-test: true
- static-linked: true
- triple: x86_64-unknown-linux-musl
on: ubuntu-latest
setup: |
sudo apt update && sudo apt install -y lld
sudo ln -s "/usr/bin/ld.lld" /usr/local/x86_64-linux-musl/bin/ld.lld
/usr/local/x86_64-linux-musl/bin/ld.lld --version
rustflags: "-C link-arg=-fuse-ld=lld -C target-feature=+crt-static"
- triple: aarch64-unknown-linux-musl
on: ubuntu-latest
setup: |
sudo apt update && sudo apt install -y lld
sudo ln -s "/usr/bin/ld.lld" /usr/local/aarch64-linux-musl/bin/ld.lld
/usr/local/aarch64-linux-musl/bin/ld.lld --version
rustflags: "-C link-arg=-fuse-ld=lld -C default-linker-libraries=y -C target-feature=+crt-static"
- triple: x86_64-unknown-linux-gnu
on: ubuntu-latest
setup: |
sudo apt update && sudo apt install -y lld
ld.lld --version
rustflags: "-C link-arg=-fuse-ld=lld"
static-linked: false
- triple: aarch64-unknown-linux-gnu
on: ubuntu-latest
setup: |
sudo apt update && sudo apt install -y lld
sudo ln -s "/usr/bin/ld.lld" /usr/aarch64-linux-gnu/bin/ld.lld
/usr/aarch64-linux-gnu/bin/ld.lld --version
rustflags: "-C link-arg=-fuse-ld=lld"
static-linked: false
- triple: x86_64-pc-windows-msvc
on: windows-latest
rustflags: "-C target-feature=+crt-static"
- triple: aarch64-pc-windows-msvc
on: windows-latest
rustflags: "-C target-feature=+crt-static"
run-test: false
- triple: x86_64-apple-darwin
on: macos-latest
# Arm64 runner on macOS is not available for open source repositories with macos-14!
# https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/
- triple: aarch64-apple-darwin
on: macos-14
triple:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
runs-on: ${{ matrix.on }}
env:
RUSTFLAGS: ${{ matrix.rustflags }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.triple }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.triple }}
- uses: Swatinem/rust-cache@v2
with:
key: ci-build-${{ matrix.triple }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.2xx
- name: Setup
run: ${{ matrix.setup }}
- name: add commit hash to version name
shell: bash
run: |
cp vrc-get/Cargo.toml vrc-get/Cargo.toml.bak
sed -E "/^version = \"[^0]/s/\"$/+$(git rev-parse --short HEAD)\"/" < vrc-get/Cargo.toml.bak > vrc-get/Cargo.toml
- name: Build
run: cargo build --verbose --target ${{ matrix.triple }}
- name: Upload built binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.triple }}
path: |
target/${{ matrix.triple }}/debug/vrc-get*
target/${{ matrix.triple }}/debug/libvrc-get*
- name: Build tests
run: cargo build --tests --target ${{ matrix.triple }}
- name: Run tests
if: ${{ matrix.run-test }}
run: cargo test --verbose --target ${{ matrix.triple }}
- name: Check binary is statically linked
shell: bash
if: ${{ matrix.static-linked }}
run: |
# https://github.com/taiki-e/setup-cross-toolchain-action/issues/18
unset CARGO_BUILD_TARGET
cargo run -p build-check-static-link target/${{ matrix.triple }}/debug/vrc-get*
conclude:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [ build ]
steps:
- name: Conclude Tests
env: { NEEDS: "${{ toJSON(needs) }}" }
run: |
echo "$NEEDS" | jq -c '. | to_entries[] | [.key, .value.result]'
echo "$NEEDS" | jq -e '. | all(.result == "success")' > /dev/null