[NO-MERGE, KEEP-ALIVE] chore: Add example for Rust Rover (RUST-14319) #8291
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
# GitHub Actions workflow: CI for sic | |
# Originally based on `bstr` crate ci, which can be found at: | |
# https://github.com/BurntSushi/bstr/blob/master/.github/workflows/ci.yml | |
# `bstr` is licensed under Apache License, Version 2.0 or MIT license | |
# Installation of NASM with msvc toolchain has been copied from `rav1e`, used under the BSD 2-Clause license, | |
# reproduced below. The original source can be found at: | |
# https://github.com/xiph/rav1e/blob/eab1cd61c1c6a7d65d49726df62a99bd0a97b8fd/.github/workflows/rav1e.yml | |
# | |
# | |
# BSD 2-Clause License | |
# | |
# Copyright (c) 2017-2020, the rav1e contributors | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# | |
# * Redistributions of source code must retain the above copyright notice, this | |
# list of conditions and the following disclaimer. | |
# | |
# * Redistributions in binary form must reproduce the above copyright notice, | |
# this list of conditions and the following disclaimer in the documentation | |
# and/or other materials provided with the distribution. | |
# | |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
name: "sic_ci" | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- main | |
- staging # for Bors | |
- trying # for Bors | |
schedule: | |
- cron: '00 04 * * *' | |
env: | |
CI: 1 | |
jobs: | |
test: | |
name: test | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
strategy: | |
matrix: | |
build: [ ubuntu-stable, macos-stable, win-gnu-stable, win-msvc-stable ] | |
include: | |
# latest rust stable :: ubuntu | |
- build: ubuntu-stable | |
os: ubuntu-latest | |
rust: stable | |
# latest rust stable :: mac_os | |
- build: macos-stable | |
os: macOS-latest | |
rust: stable | |
# latest rust stable :: windows + gnu | |
- build: win-gnu-stable | |
os: windows-latest | |
rust: stable-x86_64-gnu | |
# latest rust stable :: windows + msvc | |
- build: win-msvc-stable | |
os: windows-latest | |
rust: stable | |
steps: | |
- name: checkout_repo | |
uses: actions/checkout@v2 | |
- name: install_nasm | |
if: matrix.build != 'win-msvc' | |
uses: ilammy/setup-nasm@v1 | |
# from rav1e | |
- name: install_nasm_msvc | |
if: matrix.build == 'win-msvc-stable' | |
run: | | |
$NASM_VERSION="2.15.05" | |
$LINK = "https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/win64" | |
$NASM_FILE = "nasm-$NASM_VERSION-win64" | |
curl --ssl-no-revoke -LO "$LINK/$NASM_FILE.zip" | |
7z e -y "$NASM_FILE.zip" -o"C:\nasm" | |
echo "C:\nasm" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
# from rav1e | |
- name: set_path_msvc_linker | |
if: matrix.build == 'win-msvc-stable' | |
run: | | |
$LinkGlob = "VC\Tools\MSVC\*\bin\Hostx64\x64" | |
$env:PATH = "$env:PATH;${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer" | |
$LinkPath = vswhere -latest -products * -find "$LinkGlob" | Select-Object -Last 1 | |
echo "$LinkPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: install_rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
override: true | |
profile: minimal | |
- name: build_workspace | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --verbose --all | |
- name: test_workspace | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --all | |
- name: test_workspace_no_default_features | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --all --no-default-features | |
- name: test_workspace_all_features | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --all --all-features | |
rustfmt: | |
name: rustfmt | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: checkout_repo | |
uses: actions/checkout@v2 | |
- name: install_rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
components: rustfmt | |
- name: check_rustfmt | |
run: | | |
cargo fmt --all -- --check | |
clippy: | |
name: clippy | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: checkout_repo | |
uses: actions/checkout@v2 | |
- name: install_nasm | |
uses: ilammy/setup-nasm@v1 | |
- name: install_rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
components: clippy | |
- name: check_clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features --all-targets --workspace | |
cargo_deny: | |
name: cargo_deny | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
checks: | |
- advisories | |
- bans licenses sources | |
continue-on-error: ${{ matrix.checks == 'advisories' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
with: | |
log-level: error | |
msrv: | |
name: msrv | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: checkout_repo | |
uses: actions/checkout@v2 | |
- name: install_nasm | |
uses: ilammy/setup-nasm@v1 | |
- name: install_rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
- name: install_cargo_msrv | |
run: cargo install cargo-msrv | |
- name: version_of_cargo_msrv | |
run: cargo msrv --version # as of writing: 0.14.0 (required for verify subcommand) | |
- name: run_cargo_msrv | |
run: cargo msrv --ignore-lockfile --output-format json verify |