Skip to content

CI

CI #489

Workflow file for this run

name: CI
on:
push:
branches:
- main
- validate/*
tags:
- 'v*.*'
pull_request:
workflow_dispatch:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BUILDCONFIGURATION: Release
codecov_token: 38462e91-92d5-4fa6-be55-f363099a3e15
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages/
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
test_target: x86_64-unknown-linux-gnu
- os: macos-latest
test_target: x86_64-apple-darwin
- os: windows-latest
test_target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: recursive
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.os }}
workspaces: src/nerdbank-zcash-rust
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
if: matrix.os == 'ubuntu-20.04'
- name: ⚙️ Install Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 10406996
if: matrix.os == 'ubuntu-20.04'
- name: ⚙️ Install prerequisites
run: |
./init.ps1 -UpgradePrerequisites
dotnet --info
# Print mono version if it is present.
if (Get-Command mono -ErrorAction SilentlyContinue) {
mono --version
}
shell: pwsh
- name: ⚙️ Set pipeline variables based on source
run: azure-pipelines/variables/_pipelines.ps1
shell: pwsh
- name: 🛠 cargo build
run: src/nerdbank-zcash-rust/build_all.ps1 -Release
shell: pwsh
- name: 📢 Upload artifacts
uses: actions/upload-artifact@v1
with:
name: rust
path: obj/src/nerdbank-zcash-rust/
- name: 🧪 cargo test
run: cargo test -r --target ${{ matrix.test_target }}
working-directory: ./src/nerdbank-zcash-rust
- name: 🛠 dotnet build
run: dotnet build --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnaserror /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog"
- name: 🧪 dotnet test
run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }}
shell: pwsh
- name: ⚙ Update pipeline variables based on build outputs
run: azure-pipelines/variables/_pipelines.ps1
shell: pwsh
- name: 📥 Collect artifacts
run: azure-pipelines/artifacts/_stage_all.ps1
shell: pwsh
if: always()
- name: 📢 Upload test_logs
if: always()
uses: actions/upload-artifact@v1
with:
name: test_logs-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/test_logs
continue-on-error: true
- name: 📢 Upload testResults
if: always()
uses: actions/upload-artifact@v1
with:
name: testResults-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/testResults
continue-on-error: true
- name: 📢 Upload coverageResults
if: always()
uses: actions/upload-artifact@v1
with:
name: coverageResults-${{ runner.os }}
path: ${{ runner.temp }}/_artifacts/coverageResults
continue-on-error: true
- name: 📢 Publish code coverage results to codecov.io
run: ./azure-pipelines/publish-CodeCov.ps1 -CodeCovToken '${{ secrets.CODECOV_TOKEN }}' -PathToCodeCoverage '${{ runner.temp }}/_artifacts/coverageResults' -Name "${{ runner.os }} Coverage Results" -Flags "${{ runner.os }}Host,${{ env.BUILDCONFIGURATION }}"
shell: pwsh
timeout-minutes: 3
continue-on-error: true
if: always()
pack:
needs: build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: recursive # workaround https://github.com/dotnet/sourcelink/issues/1071
- name: ⚙ Install prerequisites
run: |
./init.ps1 -UpgradePrerequisites -NoRust
dotnet --info
# Print mono version if it is present.
if (Get-Command mono -ErrorAction SilentlyContinue) {
mono --version
}
shell: pwsh
- name: ⚙️ Set pipeline variables based on source
run: azure-pipelines/variables/_pipelines.ps1
shell: pwsh
- name: 🔻 Download rust artifacts
uses: actions/download-artifact@v3
with:
name: rust
path: obj/src/nerdbank-zcash-rust/
- name: 🛠 build
run: dotnet pack --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnaserror /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog"
- name: ⚙ Update pipeline variables based on build outputs
run: azure-pipelines/variables/_pipelines.ps1
shell: pwsh
- name: 📥 Collect artifacts
run: azure-pipelines/artifacts/_stage_all.ps1
shell: pwsh
if: always()
- name: 🔏 Code sign
run: >
dotnet tool install --tool-path obj SignClient
obj/SignClient sign
--baseDirectory '${{ runner.temp }}/_artifacts/deployables'
--input '**/*'
--config '${{ github.workspace }}/azure-pipelines/SignClient.json'
--filelist '${{ github.workspace }}/azure-pipelines/signfiles.txt'
--user '${{ secrets.CODESIGN_USERNAME }}'
--secret '${{ secrets.CODESIGN_SECRET }}'
--name 'Nerdbank.Streams'
--descriptionUrl 'https://github.com/nerdcash/Nerdbank.Cryptocurrencies'
if: success() && github.event_name != 'pull_request'
shell: pwsh
- name: 📢 Upload build_logs
if: always()
uses: actions/upload-artifact@v1
with:
name: build_logs-pack
path: ${{ runner.temp }}/_artifacts/build_logs
continue-on-error: true
- name: 📢 Upload symbols
uses: actions/upload-artifact@v1
with:
name: symbols
path: ${{ runner.temp }}/_artifacts/symbols
continue-on-error: true
- name: 📢 Upload deployables
uses: actions/upload-artifact@v1
with:
name: deployables
path: ${{ runner.temp }}/_artifacts/deployables
if: always()
- name: 🚀 Push NuGet packages
if: startsWith(github.ref, 'refs/tags/')
run: dotnet nuget push ${{ runner.temp }}/_artifacts/deployables/*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ secrets.NUGET_API_KEY }}'