Skip to content

Merge pull request #18 from Sewer56/test-stable-on-ci #112

Merge pull request #18 from Sewer56/test-stable-on-ci

Merge pull request #18 from Sewer56/test-stable-on-ci #112

Workflow file for this run

name: Test, Upload Coverage and Release Rust
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
workflow_dispatch:
env:
build-with-pgo: true
jobs:
build-and-test:
strategy:
matrix:
include:
# Nightly (nightly feature)
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, use-pgo: true, use-cross: false, toolchain: nightly, features: nightly }
- { os: ubuntu-latest, target: i686-unknown-linux-gnu, use-pgo: true, use-cross: false, toolchain: nightly, features: nightly }
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, use-pgo: false, use-cross: true, toolchain: nightly, features: nightly } # no native runner
- { os: ubuntu-latest, target: armv7-unknown-linux-gnueabihf, use-pgo: false, use-cross: true, toolchain: nightly, features: nightly } # no native runner
- { os: windows-latest, target: x86_64-pc-windows-msvc, use-pgo: true, use-cross: false, toolchain: nightly, features: nightly }
- { os: windows-latest, target: i686-pc-windows-msvc, use-pgo: true, use-cross: false, toolchain: nightly, features: nightly }
- { os: windows-latest, target: aarch64-pc-windows-msvc, use-pgo: false, use-cross: false, toolchain: nightly, features: nightly } # no native runner
- { os: macos-13, target: x86_64-apple-darwin, use-pgo: true, use-cross: false, toolchain: nightly, features: nightly } # x86
- { os: macos-14, target: aarch64-apple-darwin, use-pgo: true, use-cross: false, toolchain: nightly, features: nightly } # M1
- { os: ubuntu-latest, target: x86_64-pc-windows-gnu, use-pgo: false, use-cross: true, toolchain: nightly, features: nightly } # test only, and has issues
- { os: ubuntu-latest, target: i686-pc-windows-gnu, use-pgo: false, use-cross: true, toolchain: nightly, features: nightly } # test only, and has issues
# Stable (no nightly feature)
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, use-pgo: true, use-cross: false, toolchain: stable }
- { os: ubuntu-latest, target: i686-unknown-linux-gnu, use-pgo: true, use-cross: false, toolchain: stable }
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, use-pgo: false, use-cross: true, toolchain: stable } # no native runner
- { os: ubuntu-latest, target: armv7-unknown-linux-gnueabihf, use-pgo: false, use-cross: true, toolchain: stable } # no native runner
- { os: windows-latest, target: x86_64-pc-windows-msvc, use-pgo: true, use-cross: false, toolchain: stable }
- { os: windows-latest, target: i686-pc-windows-msvc, use-pgo: true, use-cross: false, toolchain: stable }
- { os: windows-latest, target: aarch64-pc-windows-msvc, use-pgo: false, use-cross: false, toolchain: stable } # no native runner
- { os: macos-13, target: x86_64-apple-darwin, use-pgo: true, use-cross: false, toolchain: stable } # x86
- { os: macos-14, target: aarch64-apple-darwin, use-pgo: true, use-cross: false, toolchain: stable } # M1
- { os: ubuntu-latest, target: x86_64-pc-windows-gnu, use-pgo: false, use-cross: true, toolchain: stable } # test only, and has issues
- { os: ubuntu-latest, target: i686-pc-windows-gnu, use-pgo: false, use-cross: true, toolchain: stable } # test only, and has issues
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Run Tests and Upload Coverage
uses: Reloaded-Project/devops-rust-test-and-coverage@v1
# Currently unsupported due to no native runner.
# Native runner currently only available in enterprise.
if: matrix.target != 'aarch64-pc-windows-msvc'
with:
upload-coverage: true
codecov-token: ${{ secrets.CODECOV_TOKEN }}
target: ${{ matrix.target }}
rust-toolchain: ${{ matrix.toolchain }}
features: ${{ matrix.features }}
use-cross: ${{ matrix.use-cross }}
# Note: The GitHub Runner Images will contain an up to date Rust Stable Toolchain
# thus as per recommendation of cargo-semver-checks, we're using stable here.
#
# Note to reader. If adding this to a new repo, please clear cache.
- name: Run cargo-semver-checks
if: (github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')) && matrix.toolchain == 'stable'
shell: bash
run: |
SEARCH_RESULT=$(cargo search "^{{project-name}}$" --limit 1)
if echo "$SEARCH_RESULT" | grep -q "^{{project-name}} "; then
rustup target add ${{ matrix.target }}
cargo install cargo-semver-checks
cargo semver-checks --target ${{ matrix.target }} --only-explicit-features --features "lz4,detect_num_cores,hardened"
else
echo "No previous version found on crates.io. Skipping semver checks."
fi
test-on-wine:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-pc-windows-gnu, i686-pc-windows-gnu]
steps:
- uses: actions/checkout@v4
- name: Run Tests and Coverage on WINE
uses: Reloaded-Project/devops-rust-test-and-coverage@v1
with:
rust-toolchain: nightly
target: ${{ matrix.target }}
install-rust-toolchain: true
setup-rust-cache: true
upload-coverage: true
codecov-token: ${{ secrets.CODECOV_TOKEN }}
use-cross: true
publish-crate:
permissions:
contents: write
needs: [build-and-test,test-on-wine]
# Publish only on tags
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Publish Rust Crate and Artifacts
uses: Reloaded-Project/devops-publish-action@v1
with:
crates-io-token: ${{ secrets.CRATES_IO_TOKEN }}
nuget-api-key: ${{ secrets.NUGET_KEY }}
rust-project-paths: |
.