Skip to content

Update ci.yml

Update ci.yml #192

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: "--deny warnings"
RUSTFLAGS: "--deny warnings"
jobs:
test:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
toolchain: ["nightly"]
target: ["x86_64-pc-windows-msvc", "i686-pc-windows-msvc"]
include:
- target: x86_64-pc-windows-msvc
target32: i686-pc-windows-msvc
steps:
- uses: actions/checkout@v6
- name: Install latest rust ${{ matrix.toolchain }} for ${{ matrix.target }}
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
- name: Install latest rust ${{ matrix.toolchain }} for x86 version of target
if: matrix.target32
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target32 }}
toolchain: ${{ matrix.toolchain }}
- name: Build macros
run: cargo build --target ${{ matrix.target }} --manifest-path "dll-syringe-macros/Cargo.toml" --all-targets
- name: Build main crate
run: cargo build --target ${{ matrix.target }}
- name: Build test target
run: cargo build --target ${{ matrix.target }} --manifest-path "tests/helpers/test_target/Cargo.toml" --all-targets
- name: Build test payload
run: cargo build --target ${{ matrix.target }} --manifest-path "tests/helpers/test_payload/Cargo.toml" --all-targets
- name: Test
run: cargo test --target ${{ matrix.target }} --all-targets --all-features -- --nocapture
test-on-wine:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install latest rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Add windows rust targets
run: |
rustup target add x86_64-pc-windows-msvc --toolchain nightly
rustup target add i686-pc-windows-msvc --toolchain nightly
- name: Install cargo-xwin
run: cargo install cargo-xwin
- name: Install Wine
run: |
sudo apt-get install ppa-purge && sudo ppa-purge -y ppa:ubuntu-toolchain-r/test
sudo dpkg --add-architecture i386
sudo mkdir -pm755 /etc/apt/keyrings && sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt-get update
sudo apt install --install-recommends winehq-stable
- name: Run tests on Wine
run: ./scripts/test-wine.ps1
shell: pwsh
arm-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Install latest rust nightly for aarch64-pc-windows-msvc
uses: dtolnay/rust-toolchain@nightly
with:
targets: aarch64-pc-windows-msvc
- name: Check macros
run: cargo check --manifest-path dll-syringe-macros/Cargo.toml --target aarch64-pc-windows-msvc --all-features
- name: Check main crate
run: cargo check --target aarch64-pc-windows-msvc --all-features
hack:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Install latest nightly
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-pc-windows-msvc, i686-pc-windows-msvc
- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: cargo hack
run: cargo hack --feature-powerset check
documentation:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Install latest nightly
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-pc-windows-msvc, i686-pc-windows-msvc
- name: Generate documentation
run: cargo doc --all-features
- name: Install cargo-deadlinks
run: cargo install cargo-deadlinks
- name: Check dead links in doc
run: cargo deadlinks
clippy:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Install latest nightly
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-pc-windows-msvc, i686-pc-windows-msvc
components: clippy
- name: Clippy check
run: cargo clippy --all-features
fmt:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Install latest nightly
uses: dtolnay/rust-toolchain@nightly
with:
targets: x86_64-pc-windows-msvc, i686-pc-windows-msvc
components: rustfmt
- name: Format check
run: cargo fmt --all -- --check
build-c-libs:
strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
use_cross: false
features: "c-exports,into-x86-from-x64"
- os: windows-latest
target: i686-pc-windows-msvc
use_cross: false
features: "c-exports"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- id: build-libs
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-c-library@v1
with:
target: ${{ matrix.target }}
use_pgo: false
use_cross: ${{ matrix.use_cross }}
features: ${{ matrix.features }}
no_default_features: true
build-c-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Generate C++ bindings
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/generate-bindings@v1
with:
config_file: cbindgen_cpp.toml
header_file: bindings_cpp.hpp
- name: Generate C bindings
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/generate-bindings@v1
with:
config_file: cbindgen_c.toml
header_file: bindings_c.h
build-dotnet-library:
needs: build-c-libs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build and Package .NET Library
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/build-dotnet-library@dotnet-bindings
with:
targets: 'x86_64-pc-windows-msvc,i686-pc-windows-msvc'
publish-crate:
permissions:
contents: write
needs: [test,build-c-libs,build-c-headers,test-on-wine,build-dotnet-library]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload to NuGet
shell: pwsh
run: |
$items = Get-ChildItem -Path "artifacts/**.nupkg" -Recurse
Foreach ($item in $items)
{
Write-Host "Pushing $item"
dotnet nuget push "$item" -k "${{ secrets.NUGET_KEY }}" -s "https://api.nuget.org/v3/index.json" --skip-duplicate
}
$items = Get-ChildItem -Path "artifacts/**.snupkg" -Recurse
Foreach ($item in $items)
{
Write-Host "Pushing Symbol Package $item"
dotnet nuget push "$item" -k "${{ secrets.NUGET_KEY }}" -s "https://api.nuget.org/v3/index.json" --skip-duplicate
}
- name: Compress Artifacts
shell: bash
run: |
dir="artifacts"
if [ ! -d "$dir" ]; then
echo "Directory $dir does not exist. No artifacts found."
exit 0
fi
for subdir in "$dir"/*; do
if [ -d "$subdir" ]; then
base=$(basename "$subdir")
zip -r "$dir/$base.zip" "$subdir"
rm -r "$subdir"
fi
done
ls -A ./artifacts
- name: GitHub Release Artifacts
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/*
- name: Publish to crates.io
uses: Reloaded-Project/reloaded-project-configurations-rust/.github/actions/publish-crate@v1
with:
token: ${{ secrets.CRATES_IO_TOKEN }}