iced/.github/workflows/build.yml

306 lines
12 KiB
YAML
Raw Normal View History

2019-09-24 23:22:36 +00:00
name: GitHub CI
2019-09-25 17:56:12 +00:00
on: push
2019-09-24 23:22:36 +00:00
jobs:
2019-11-23 19:36:32 +00:00
build-csharp-windows:
2019-11-28 01:13:45 +00:00
name: C# (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
2019-10-03 16:04:21 +00:00
2019-09-24 23:22:36 +00:00
steps:
- uses: actions/checkout@v1
2019-12-31 09:16:25 +00:00
- 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 }
2020-01-26 19:21:08 +00:00
- name: Build one feature at a time
shell: pwsh
run: |
foreach ($def in
2020-02-10 19:03:58 +00:00
"DECODER",
"ENCODER",
2020-03-28 19:02:12 +00:00
"ENCODER;BLOCK_ENCODER"
2020-03-28 19:02:29 +00:00
"ENCODER;OPCODE_INFO"
2020-02-10 19:03:58 +00:00
"INSTR_INFO",
"GAS",
"INTEL",
"MASM",
"NASM"
2020-01-26 19:21:08 +00:00
) {
git clean -xdf
if ($LASTEXITCODE) { exit $LASTEXITCODE }
2020-02-10 19:03:58 +00:00
$env:IcedFeatureFlags=$def
2020-01-26 19:21:08 +00:00
dotnet build -v:m -c Release src/csharp/Intel/Iced/Iced.csproj
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
foreach ($def in
2020-02-10 19:03:58 +00:00
"DECODER",
"DECODER;ENCODER",
2020-03-28 19:02:12 +00:00
"DECODER;ENCODER;BLOCK_ENCODER",
2020-03-28 19:02:29 +00:00
"DECODER;ENCODER;OPCODE_INFO",
2020-02-10 19:03:58 +00:00
"DECODER;INSTR_INFO",
"DECODER;GAS",
"DECODER;INTEL",
"DECODER;MASM",
"DECODER;NASM"
2020-01-26 19:21:08 +00:00
) {
git clean -xdf
if ($LASTEXITCODE) { exit $LASTEXITCODE }
2020-02-10 19:03:58 +00:00
$env:IcedFeatureFlags=$def
2020-01-26 19:21:08 +00:00
dotnet build -v:m -c Release src/csharp/Intel/Iced.UnitTests/Iced.UnitTests.csproj
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
2020-01-26 19:39:38 +00:00
git clean -xdf
2020-01-26 19:21:08 +00:00
2019-09-24 23:22:36 +00:00
- name: Build, test
2019-10-04 16:28:14 +00:00
shell: pwsh
2019-09-24 23:22:36 +00:00
run: |
2019-10-04 16:28:14 +00:00
.\build.ps1
2019-09-24 23:22:36 +00:00
- name: upload-artifact doesn't support wildcards
2019-10-04 16:28:14 +00:00
shell: pwsh
2019-09-24 23:22:36 +00:00
run: |
2019-10-04 16:28:14 +00:00
New-Item -ItemType Directory nuget_files > $null
2019-11-06 01:49:44 +00:00
Copy-Item src\csharp\Intel\Iced\bin\Release\*.*nupkg nuget_files
2019-09-24 23:22:36 +00:00
- uses: actions/upload-artifact@v1
with:
name: nupkg
path: nuget_files
2019-09-25 17:56:12 +00:00
2019-10-05 15:57:58 +00:00
- uses: actions/upload-artifact@v1
with:
name: coverage.info
2019-11-06 01:49:44 +00:00
path: src/csharp/Intel/Iced.UnitTests/coverage.info
2019-10-05 15:57:58 +00:00
2019-10-05 13:52:24 +00:00
- name: Upload coverage report
shell: bash
run: |
curl https://codecov.io/bash -o codecov
chmod +x codecov
2019-11-06 01:49:44 +00:00
./codecov -f src/csharp/Intel/Iced.UnitTests/coverage.info
2019-10-05 13:52:24 +00:00
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
2019-09-25 17:56:12 +00:00
- name: Upload to nuget.org if it's a new release
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
run: |
2019-10-03 16:04:21 +00:00
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -UseBasicParsing -OutFile nuget.exe
2019-11-06 01:49:44 +00:00
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 }
2019-10-06 18:38:57 +00:00
# Make sure it builds on Linux too
2019-11-28 01:13:45 +00:00
build-csharp:
name: C# (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
2019-10-06 18:38:57 +00:00
steps:
- uses: actions/checkout@v1
2020-01-03 21:12:14 +00:00
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.100'
2019-10-06 18:38:57 +00:00
- name: Build, test
shell: pwsh
2019-10-06 18:52:59 +00:00
run: ./build.ps1
2019-11-23 19:36:32 +00:00
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"
2019-12-23 16:04:03 +00:00
# It fails on Windows, disable auto self update
rustup toolchain install 1.20.0 --no-self-update
2020-01-05 12:11:28 +00:00
rustup toolchain install nightly --no-self-update
2020-03-21 18:36:38 +00:00
rustup target add wasm32-unknown-unknown
2019-12-23 16:04:03 +00:00
rustup update --no-self-update
2019-11-23 19:36:32 +00:00
2020-01-15 19:25:18 +00:00
- name: Build no_std
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
export RUSTFLAGS="-D warnings"
git clean -xdf
2020-01-16 06:55:26 +00:00
cd src/rust/iced-x86
2020-01-15 19:25:18 +00:00
echo ==== BUILD DEBUG ====
2020-03-28 19:02:29 +00:00
cargo check --color always --no-default-features --features "no_std decoder encoder block_encoder op_code_info instr_info gas intel masm nasm db"
2020-01-16 06:55:26 +00:00
cd ../../..
2020-01-15 19:25:18 +00:00
git clean -xdf
2020-01-26 19:21:08 +00:00
- name: Build one feature at a time
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
export RUSTFLAGS="-D warnings"
cd src/rust/iced-x86
echo ==== std decoder ====
cargo check --color always --no-default-features --features "std decoder"
2020-01-26 19:21:08 +00:00
echo ==== std encoder ====
cargo check --color always --no-default-features --features "std encoder"
2020-03-28 19:02:12 +00:00
echo ==== std encoder block_encoder ====
cargo check --color always --no-default-features --features "std encoder block_encoder"
2020-03-28 19:02:29 +00:00
echo ==== std encoder op_code_info ====
cargo check --color always --no-default-features --features "std encoder op_code_info"
2020-01-26 19:21:08 +00:00
echo ==== std instr_info ====
cargo check --color always --no-default-features --features "std instr_info"
echo ==== std gas ====
cargo check --color always --no-default-features --features "std gas"
echo ==== std intel ====
cargo check --color always --no-default-features --features "std intel"
echo ==== std masm ====
cargo check --color always --no-default-features --features "std masm"
echo ==== std nasm ====
cargo check --color always --no-default-features --features "std nasm"
2020-01-26 19:21:08 +00:00
echo ==== no_std decoder ====
cargo check --color always --no-default-features --features "no_std decoder"
echo ==== no_std encoder ====
cargo check --color always --no-default-features --features "no_std encoder"
2020-03-28 19:02:12 +00:00
echo ==== no_std encoder block_encoder ====
cargo check --color always --no-default-features --features "no_std encoder block_encoder"
2020-03-28 19:02:29 +00:00
echo ==== no_std encoder op_code_info ====
cargo check --color always --no-default-features --features "no_std encoder op_code_info"
echo ==== no_std instr_info ====
cargo check --color always --no-default-features --features "no_std instr_info"
echo ==== no_std gas ====
cargo check --color always --no-default-features --features "no_std gas"
echo ==== no_std intel ====
cargo check --color always --no-default-features --features "no_std intel"
echo ==== no_std masm ====
cargo check --color always --no-default-features --features "no_std masm"
echo ==== no_std nasm ====
cargo check --color always --no-default-features --features "no_std nasm"
2020-01-26 19:21:08 +00:00
echo ==== TEST std decoder ====
cargo check --color always --tests --no-default-features --features "std decoder"
2020-01-26 19:21:08 +00:00
echo ==== TEST std decoder encoder ====
cargo check --color always --tests --no-default-features --features "std decoder encoder"
2020-03-28 19:02:12 +00:00
echo ==== TEST std decoder encoder block_encoder ====
cargo check --color always --tests --no-default-features --features "std decoder encoder block_encoder"
2020-03-28 19:02:29 +00:00
echo ==== TEST std decoder encoder op_code_info ====
cargo check --color always --tests --no-default-features --features "std decoder encoder op_code_info"
2020-01-26 19:21:08 +00:00
echo ==== TEST std decoder instr_info ====
cargo check --color always --tests --no-default-features --features "std decoder instr_info"
echo ==== TEST std decoder gas ====
cargo check --color always --tests --no-default-features --features "std decoder gas"
echo ==== TEST std decoder intel ====
cargo check --color always --tests --no-default-features --features "std decoder intel"
echo ==== TEST std decoder masm ====
cargo check --color always --tests --no-default-features --features "std decoder masm"
echo ==== TEST std decoder nasm ====
cargo check --color always --tests --no-default-features --features "std decoder nasm"
2020-03-25 18:19:55 +00:00
2020-03-26 17:07:20 +00:00
cd ..
git clean -xdf
- name: iced-x86-js
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
export RUSTFLAGS="-D warnings"
cd src/rust/iced-x86-js
2020-03-28 19:02:12 +00:00
echo ==== decoder ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "decoder"
echo ==== encoder ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "encoder"
echo ==== encoder block_encoder ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "encoder block_encoder"
2020-03-28 19:02:29 +00:00
echo ==== encoder op_code_info ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "encoder op_code_info"
2020-03-28 19:02:12 +00:00
echo ==== instr_info ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "instr_info"
echo ==== gas ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "gas"
echo ==== intel ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "intel"
echo ==== masm ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "masm"
echo ==== nasm ====
cargo check --color always --target wasm32-unknown-unknown --no-default-features --features "nasm"
2020-03-28 19:02:29 +00:00
echo ==== CLIPPY decoder encoder block_encoder op_code_info instr_info gas intel masm nasm ====
cargo clippy --color always --target wasm32-unknown-unknown --no-default-features --features "decoder encoder block_encoder op_code_info instr_info gas intel masm nasm"
2020-03-25 18:19:55 +00:00
2020-01-26 19:21:08 +00:00
cd ..
git clean -xdf
2019-11-23 19:36:32 +00:00
- name: Build, test (default)
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
2019-12-17 20:46:30 +00:00
export RUSTFLAGS="-D warnings"
2019-11-23 19:36:32 +00:00
cargo -V
2019-11-28 01:13:45 +00:00
cd src/rust/iced-x86
2019-11-23 19:36:32 +00:00
echo ==== CLIPPY ====
cargo clippy --color always
2019-12-03 19:41:35 +00:00
echo ==== CLIPPY --tests ====
cargo clippy --color always --tests
2019-11-28 01:13:45 +00:00
echo ==== FORMAT CHECK ====
2019-11-23 20:19:42 +00:00
cargo fmt -- --color always --check
2020-01-05 12:11:28 +00:00
echo ==== DOC ====
# Use nightly since that's what docs.rs uses
cargo +nightly doc --color always
2019-11-23 19:36:32 +00:00
echo ==== BUILD DEBUG ====
2020-02-11 16:38:44 +00:00
cargo build --color always --features "db"
2019-11-23 19:36:32 +00:00
echo ==== TEST DEBUG ====
2020-02-11 16:38:44 +00:00
cargo test --color always --features "db"
2019-11-23 19:36:32 +00:00
echo ==== BUILD RELEASE ====
2020-02-11 16:38:44 +00:00
cargo build --color always --features "db" --release
2019-11-23 19:36:32 +00:00
echo ==== TEST RELEASE ====
2020-02-11 16:38:44 +00:00
cargo test --color always --features "db" --release
2020-03-21 18:36:38 +00:00
echo ==== BUILD RELEASE wasm32-unknown-unknown ====
cargo check --color always --features "db" --target wasm32-unknown-unknown --release
2020-01-05 12:11:28 +00:00
echo ==== PUBLISH DRY-RUN ====
2020-01-05 22:52:52 +00:00
# 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
2020-01-05 12:11:28 +00:00
cargo publish --color always --dry-run
2019-11-23 19:36:32 +00:00
- name: Build, test (1.20.0)
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
2019-12-17 20:46:30 +00:00
export RUSTFLAGS="-D warnings"
2019-11-23 19:36:32 +00:00
cd src/rust/iced-x86
echo ==== UPDATE Cargo.lock ====
cargo +1.20.0 generate-lockfile
2020-02-10 21:03:21 +00:00
cargo +1.20.0 update --package lazy_static --precise 1.1.1
2019-11-23 19:36:32 +00:00
echo ==== BUILD DEBUG ====
2020-02-11 16:38:44 +00:00
cargo +1.20.0 build --color always --features "db"
2019-11-23 19:36:32 +00:00
echo ==== TEST DEBUG ====
2020-02-11 16:38:44 +00:00
cargo +1.20.0 test --color always --features "db" -- --skip "lib.rs"
2019-11-23 19:36:32 +00:00
echo ==== BUILD RELEASE ====
2020-02-11 16:38:44 +00:00
cargo +1.20.0 build --color always --features "db" --release
2019-11-23 19:36:32 +00:00
echo ==== TEST RELEASE ====
2020-02-11 16:38:44 +00:00
cargo +1.20.0 test --color always --features "db" --release -- --skip "lib.rs"