Add arm64
support to .NET snap
#49
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: Build on main | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
workflow_dispatch: | |
permissions: | |
checks: write | |
pull-requests: write | |
jobs: | |
unit-test: | |
strategy: | |
matrix: | |
os: | |
- [self-hosted, large, jammy, X64] | |
- [self-hosted, large, jammy, ARM64] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
id: checkout | |
- name: Install .NET | |
id: install-dotnet | |
run: | | |
sudo apt-get update | |
sudo apt-get upgrade --yes | |
sudo apt-get install --yes dotnet-sdk-8.0 | |
echo "DPKG_ARCH=$(dpkg --print-architecture)" >> "$GITHUB_OUTPUT" | |
- name: Run Tests | |
run: dotnet test --verbosity normal --logger trx --results-directory TestResults | |
- name: Publish Test Results to Workflow | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: test-results | |
comment_title: Test Results (${{ steps.install-dotnet.outputs.DPKG_ARCH }}) | |
files: | | |
TestResults/*.trx | |
snapcraft-build: | |
strategy: | |
matrix: | |
os: | |
- [self-hosted, large, jammy, X64] | |
- [self-hosted, large, jammy, ARM64] | |
runs-on: ${{ matrix.os }} | |
needs: unit-test | |
steps: | |
- uses: actions/checkout@v4 | |
id: checkout | |
- name: Retrieve Architecture | |
id: get-arch | |
run: echo "DPKG_ARCH=$(dpkg --print-architecture)" >> "$GITHUB_OUTPUT" | |
- name: Run Snapcraft | |
id: snapcraft | |
uses: snapcore/action-build@v1 | |
- name: Upload Snap to workflow artifacts | |
id: upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dotnet-${{ steps.get-arch.outputs.DPKG_ARCH }} | |
path: ${{ steps.snapcraft.outputs.snap }} | |
snapcraft-publish: | |
runs-on: ubuntu-latest | |
if: ${{ contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.ref_name == 'main' }} | |
needs: snapcraft-build | |
strategy: | |
matrix: | |
artifact-name: | |
- dotnet-amd64 | |
- dotnet-arm64 | |
steps: | |
- uses: actions/download-artifact@v4 | |
id: download-artifact | |
with: | |
name: ${{ matrix.artifact-name }} | |
- name: Gather filename | |
id: gather-filename | |
env: | |
ARTIFACT_PATH: ${{ steps.download-artifact.outputs.download-path }} | |
run: | | |
ls -la $ARTIFACT_PATH | |
SNAP_FILE_NAME=$(ls ${ARTIFACT_PATH}/dotnet*.snap) | |
echo "SNAP_PATH=${SNAP_FILE_NAME}" >> "$GITHUB_OUTPUT" | |
- uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }} | |
with: | |
snap: ${{ steps.gather-filename.outputs.SNAP_PATH }} | |
release: edge | |
publish-coverage: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
id: checkout | |
- name: Install .NET | |
id: install-dotnet | |
run: | | |
sudo apt-get update | |
sudo apt-get upgrade --yes | |
sudo apt-get install --yes dotnet-sdk-8.0 | |
- name: Install reportgenerator tool | |
run: | | |
dotnet tool install -g dotnet-reportgenerator-globaltool | |
- name: Generate Coverage report | |
run: | | |
dotnet test --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory TestResults | |
reportgenerator -reports:TestResults/*/coverage.cobertura.xml -targetdir:TestResults/Html/coverage -reporttypes:'Html' | |
- name: Commit Coverage files | |
run: | | |
cd TestResults/Html | |
git init | |
git add -A | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m 'deploy' | |
- name: Push to GH Pages branch | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
force: true | |
directory: ./TestResults/Html |