Skip to content

chore: general and error handling cleanup #824

chore: general and error handling cleanup

chore: general and error handling cleanup #824

Workflow file for this run

name: CI
on:
push:
branches: [ "*.*.x" ]
pull_request:
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
lint:
name: Lint & test
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
shell: pwsh
run: |
$rustfmt_output = cargo fmt --all --check -- --color always 2> $null
$rustfmt_exit_code = $LASTEXITCODE
if ($rustfmt_exit_code -ne 0 ) {
Write-Output "::error title=Rustfmt code formatting check failed::$(@(
"Code formatting error.",
" ",
"This project requires code to conform to the rustfmt style.",
"Please run ``cargo +nightly fmt --all`` before commiting."
) -join '%0A')"
Write-Output ""
Write-Output "Expand for details:"
Write-Output "::group::Detailed rustfmt error messages"
Write-Output $rustfmt_output
Write-Output "::endgroup::"
Write-Output ""
}
exit $rustfmt_exit_code
- run: cargo clippy -- -Dwarnings
- run: cargo test
build:
name: Build & upload artifacts
runs-on: windows-latest
env:
ARCHIVE_NAME: redscript-${{ github.ref_name }}.zip
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build and package the mod archive
run: .\resources\package.ps1 -stagingDir ${{ runner.temp }}/redscript-staging -archiveName ${{ env.ARCHIVE_NAME }}
- name: Archive artifacts
uses: actions/upload-artifact@v3
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
path: |
${{ env.MOD_ARTIFACT_PATH }}
./target/release/redscript-cli.exe