diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 32943c471..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,215 +0,0 @@ -# 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 diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 000000000..1f8ee45aa --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,25 @@ +name: clippy +on: + pull_request: + push: + branches: + - main + merge_group: +jobs: + clippy: + name: clippy + runs-on: ubuntu-latest + steps: + - name: checkout_repo + uses: actions/checkout@v4 + + - name: install_rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: install_nasm + uses: ilammy/setup-nasm@v1 + + - name: clippy + run: cargo clippy --all-targets --all-features --workspace diff --git a/.github/workflows/deny.yml b/.github/workflows/deny.yml new file mode 100644 index 000000000..6f7782ffa --- /dev/null +++ b/.github/workflows/deny.yml @@ -0,0 +1,30 @@ +name: cargo_deny +on: + pull_request: + push: + branches: + - main + merge_group: +jobs: + cargo_deny: + name: cargo_deny + runs-on: ubuntu-latest + strategy: + matrix: + checks: + - advisories + - bans licenses sources + + continue-on-error: ${{ matrix.checks == 'advisories' }} + steps: + - name: checkout_repo + uses: actions/checkout@v4 + + - name: install_rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + log-level: error diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml new file mode 100644 index 000000000..d8879e4d5 --- /dev/null +++ b/.github/workflows/msrv.yml @@ -0,0 +1,69 @@ +name: msrv +on: + pull_request: + push: + branches: + - main + merge_group: + schedule: + - cron: '00 06 * * *' +jobs: + msrv_stable: + name: msrv_stable + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: checkout_repo + uses: actions/checkout@v4 + + - name: install_rust + uses: dtolnay/rust-toolchain@stable + + - name: install_cargo_msrv + run: cargo install cargo-msrv # 0.15.x + + - name: version_of_cargo_msrv + run: cargo msrv --version + + - name: install_nasm + uses: ilammy/setup-nasm@v1 + + - name: run_cargo_msrv_verify + run: cargo msrv --output-format json verify -- cargo check + + - name: run_cargo_msrv_on_verify_failure + if: ${{ failure() }} + run: cargo msrv --output-format json -- cargo check + + # The same as the 'msrv' job, except it takes the latest release, including beta releases + # We don't use --all-features here! + msrv_beta: + name: msrv_beta + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: checkout_repo + uses: actions/checkout@v4 + + - name: install_rust + uses: dtolnay/rust-toolchain@stable + + - uses: taiki-e/install-action@v2 + with: + tool: cargo-binstall + + - name: install_cargo_msrv_bin + run: cargo binstall --version 0.16.0-beta.25 --no-confirm cargo-msrv # 0.16.x (beta) + + - name: version_of_cargo_msrv + run: cargo msrv --version + + - name: install_nasm + uses: ilammy/setup-nasm@v1 + + - name: run_cargo_msrv_verify + run: cargo msrv verify --output-format json + + - name: run_cargo_msrv_on_verify_failure + if: ${{ failure() }} + run: cargo msrv find --output-format json diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 000000000..03441ba87 --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,22 @@ +name: rustfmt +on: + pull_request: + push: + branches: + - main + merge_group: +jobs: + rustfmt: + name: rustfmt + runs-on: ubuntu-latest + steps: + - name: checkout_repo + uses: actions/checkout@v4 + + - name: install_rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: fmt + run: cargo fmt --all -- --check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..5adfbf413 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,63 @@ +name: test +on: + pull_request: + push: + branches: + - main + merge_group: +jobs: + test: + strategy: + fail-fast: false + matrix: + build: [ ubuntu-stable, macos-stable, win-gnu-stable, win-msvc-stable ] + include: + - build: ubuntu-stable + os: ubuntu-latest + rust: stable + + - build: macos-stable + os: macos-latest + rust: stable + + - build: win-gnu-stable + os: windows-latest + rust: stable-x86_64-gnu + + - build: win-msvc-stable + os: windows-latest + rust: stable + + runs-on: ${{ matrix.os }} + steps: + - name: checkout_repository + uses: actions/checkout@v4 + + - name: install_rust_toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + + - name: install_nasm + uses: ilammy/setup-nasm@v1 + + - name: fetch + run: cargo fetch --verbose + + - name: build + run: cargo build --verbose --all + + - name: test_all + run: cargo test --verbose --all + + - name: build_(no_default_features) + run: cargo build --verbose --all --no-default-features + + - name: test_all_(no_default_features) + run: cargo test --verbose --all --no-default-features + + - name: build_(all_features) + run: cargo build --verbose --all --all-features + + - name: test_all_(all_features) + run: cargo test --verbose --all --all-features