Rework builds to run tests and benchmarks #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
pull_request: | |
branches: main | |
permissions: | |
contents: read | |
env: | |
DOTNET_NOLOGO: 1 | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_GENERATE_ASPNET_CERTIFICATE: 0 | |
RestoreLockedMode: true | |
RepositoryBranch: '${{ github.ref_name }}' | |
RepositoryCommit: '${{ github.sha }}' | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
Configuration: ['Debug', 'Release'] | |
env: | |
Configuration: '${{ matrix.configuration }}' | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8 | |
- name: restore | |
run: dotnet restore | |
- name: build | |
run: dotnet build --no-restore | |
- name: test | |
run: dotnet test --no-restore --no-build | |
- name: pack | |
if: ${{ matrix.configuration == 'Release' }} | |
run: | | |
dotnet pack src/VbaCompiler/VbaCompiler.csproj --no-build --no-restore -o dist | |
dotnet pack src/vbamc/vbamc.csproj --no-build --no-restore -o dist | |
- name: publish artifact | |
if: ${{ matrix.configuration == 'Release' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'vbamc_packages_${{ matrix.configuration }}' | |
path: '${{ github.workspace }}/dist' | |
benchmark: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ['ubuntu-22.04', 'windows-2022'] | |
env: | |
Configuration: 'Release' | |
PROJECT: 'tests/VbaCompiler.Benchmark/VbaCompiler.Benchmark.csproj' | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8 | |
- name: restore | |
run: dotnet restore | |
- name: build | |
run: dotnet build --no-restore -c Release tests/VbaCompiler.Benchmark/VbaCompiler.Benchmark.csproj | |
- name: benchmark | |
shell: bash | |
run: | | |
dotnet run -c Release --project tests/VbaCompiler.Benchmark/VbaCompiler.Benchmark.csproj -- -e github --artifacts | |
{ | |
echo "## VBA Compiler Benchmark" | |
echo "" | |
echo "Runner: \`${{ matrix.os }}\`" | |
echo "" | |
cat "BenchmarkDotNet.Artifacts/results/CompileMacroBenchmark-report-github.md" | |
} >> $GITHUB_STEP_SUMMARY |