iced/.github/workflows/build.yml

155 lines
4.8 KiB
YAML

name: GitHub CI
on: push
jobs:
build-csharp-windows:
name: C# (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v1
- name: Run generator, verify no diff
shell: pwsh
run: |
cd src/csharp/Intel/Generator
dotnet run -c Release
if ($LASTEXITCODE) { exit $LASTEXITCODE }
git diff --exit-code
if ($LASTEXITCODE) { exit $LASTEXITCODE }
- name: Build, test
shell: pwsh
run: |
.\build.ps1
- name: upload-artifact doesn't support wildcards
shell: pwsh
run: |
New-Item -ItemType Directory nuget_files > $null
Copy-Item src\csharp\Intel\Iced\bin\Release\*.*nupkg nuget_files
- uses: actions/upload-artifact@v1
with:
name: nupkg
path: nuget_files
- uses: actions/upload-artifact@v1
with:
name: coverage.info
path: src/csharp/Intel/Iced.UnitTests/coverage.info
- name: Upload coverage report
shell: bash
run: |
curl https://codecov.io/bash -o codecov
chmod +x codecov
./codecov -f src/csharp/Intel/Iced.UnitTests/coverage.info
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
- name: Upload to nuget.org if it's a new release
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
run: |
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -UseBasicParsing -OutFile nuget.exe
Get-ChildItem src\csharp\Intel\Iced\bin\Release\Iced.*.nupkg | ForEach-Object { .\nuget.exe push $_.FullName -ApiKey ${{secrets.NUGET_APIKEY}} -NonInteractive -Source https://api.nuget.org/v3/index.json }
# Make sure it builds on Linux too
build-csharp:
name: C# (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.100'
- name: Build, test
shell: pwsh
run: ./build.ps1
build-rust:
name: Rust (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v1
- name: Install rustup and rustc latest (macOS)
shell: bash
if: startsWith(matrix.os, 'macos-')
run: |
curl https://sh.rustup.rs -sSf | bash -s -- -y
export PATH="$HOME/.cargo/bin:$PATH"
rustup install stable
- name: Install rustc
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
# It fails on Windows, disable auto self update
rustup toolchain install 1.20.0 --no-self-update
rustup toolchain install nightly --no-self-update
rustup update --no-self-update
- name: Build, test (default)
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
export RUSTFLAGS="-D warnings"
cargo -V
cd src/rust/iced-x86
echo ==== CLIPPY ====
cargo clippy --color always
echo ==== CLIPPY --tests ====
cargo clippy --color always --tests
echo ==== FORMAT CHECK ====
cargo fmt -- --color always --check
echo ==== DOC ====
# Use nightly since that's what docs.rs uses
cargo +nightly doc
echo ==== BUILD DEBUG ====
cargo build --color always
echo ==== TEST DEBUG ====
cargo test --color always
echo ==== BUILD RELEASE ====
cargo build --color always --release
echo ==== TEST RELEASE ====
cargo test --color always --release
echo ==== PUBLISH DRY-RUN ====
# It fails on Windows without this, claiming that some random number of rust files are dirty.
# This is the 2nd GitHub CI for Windows hack I've added to this file.
git status
git diff
cargo publish --color always --dry-run
- name: Build, test (1.20.0)
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
export RUSTFLAGS="-D warnings"
cd src/rust/iced-x86
echo ==== UPDATE Cargo.lock ====
cargo +1.20.0 generate-lockfile
cargo +1.20.0 update --package lazy_static --precise 1.1.0
echo ==== BUILD DEBUG ====
cargo +1.20.0 build --color always
echo ==== TEST DEBUG ====
cargo +1.20.0 test --color always
echo ==== BUILD RELEASE ====
cargo +1.20.0 build --color always --release
echo ==== TEST RELEASE ====
cargo +1.20.0 test --color always --release