Skip to content

Merge with public repo #2

Merge with public repo

Merge with public repo #2

Workflow file for this run

# SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
#
# SPDX-License-Identifier: MIT
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: write
jobs:
cache-runtimes:
strategy:
matrix:
runtime:
- linux-x64
- win-x64
- browser-wasm
uses: ./.github/workflows/cache-runtime.yml
with:
runtime: ${{ matrix.runtime }}
permissions:
contents: read
actions: write
build-dotnet:
needs:
- cache-runtimes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore linux-x64 artifact
uses: actions/cache/restore@v4
with:
path: |
Xmss/runtimes/**
key: runtime-linux-x64-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-linux-x64.yml') }}
fail-on-cache-miss: true
- name: Restore win-x64 artifact
uses: actions/cache/restore@v4
with:
path: |
Xmss/runtimes/**
key: runtime-win-x64-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-win-x64.yml') }}
fail-on-cache-miss: true
- name: Restore browser-wasm artifact
uses: actions/cache/restore@v4
with:
path: |
Xmss/runtimes/**
key: runtime-browser-wasm-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-browser-wasm.yml') }}
fail-on-cache-miss: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('global.json', '.config/dotnet-tools.json', '**/Directory.Packages.props') }}
- name: Restore dependencies
run: |
dotnet tool restore
dotnet workload restore
dotnet restore
dotnet restore Documentation --no-dependencies
- name: Build
run: |
dotnet build --configuration Release --no-restore
- name: Test
run: |
dotnet test --configuration Release --no-build \
-p:TestingPlatformCommandLineArguments="--report-trx --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml"
- name: Package
run: |
dotnet pack --configuration Release --no-build
- name: Upload Package Artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: |
**/*.nupkg
**/*.snupkg
retention-days: 14
- name: Upload Documentation Artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: Documentation/_site
retention-days: 3
- name: Convert test results
if: ${{ !cancelled() }}
run: |
find . -name "*.trx" -exec dotnet tool run trx2junit --output TestResults/JUnit {} +
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: true
files: TestResults/JUnit/*.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}