remove scoping from the check (#17) #103
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: AOT Example | |
on: | |
push: | |
workflow_dispatch: | |
env: | |
GITHUB_USERNAME: baronfel | |
# GITHUB_TOKEN: ${{ secrets.CONTAINER_PUSH_PAT }} | |
jobs: | |
aot: | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
sdkflavor: [jammy-aot] | |
arch: [amd64, arm64] | |
include: | |
# jammy can do both architectures, so the same metadata can be applied to both architectures | |
- sdkflavor: jammy-aot | |
runtimeflavor: jammy-chiseled-amd64 | |
installcommand: apt update && apt install llvm -y | |
arch: amd64 | |
- sdkflavor: jammy-aot | |
runtimeflavor: jammy-chiseled-arm64v8 | |
arch: arm64 | |
installcommand: apt update && apt install llvm -y | |
# alpine doesn't support cross-architecture, so need to fully specify each of those jobs | |
- sdkflavor: alpine-aot-amd64 | |
runtimeflavor: alpine | |
arch: amd64 | |
installcommand: 'true' | |
# arm64 emulation is flaky for alpine so we will skip this for now | |
# - sdkflavor: alpine-aot-arm64v8 | |
# runtimeflavor: alpine | |
# arch: arm64 | |
# installcommand: 'true' | |
name: "${{ matrix.sdkflavor }} => ${{ matrix.runtimeflavor }}-${{ matrix.arch }}" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get the code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: build the app AOT-style | |
run: | | |
docker run --rm --pull=always \ | |
-v $(pwd)/src:/src \ | |
-v ~/.docker/config.json:/root/.docker/config.json:ro \ | |
-w /src/aot-sample \ | |
mcr.microsoft.com/dotnet/nightly/sdk:8.0-${{ matrix.sdkflavor }} \ | |
sh -c " | |
${{matrix.installcommand}} && \ | |
dotnet publish /t:PublishContainer \ | |
-p ContainerBaseImage=mcr.microsoft.com/dotnet/runtime-deps:8.0-${{matrix.runtimeflavor}} \ | |
-p ContainerRegistry=ghcr.io \ | |
-p ContainerRepository=${{ github.repository_owner }}/aot-sample \ | |
-p ContainerImageTag=${{matrix.runtimeflavor}}-${{matrix.arch}} \ | |
--arch ${{matrix.arch}} \ | |
-bl \ | |
/check | |
" | |
- name: upload binlog | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
path: src/aot-sample/msbuild.binlog | |
name: ${{matrix.runtimeflavor}}-${{matrix.arch}}.binlog | |
- name: run the just-built container | |
run: | | |
docker run --rm ghcr.io/${{github.repository_owner}}/aot-sample:${{matrix.runtimeflavor}}-${{matrix.arch}} | |
- name: inspect the just-built container | |
run: | | |
docker history ghcr.io/${{github.repository_owner}}/aot-sample:${{matrix.runtimeflavor}}-${{matrix.arch}} --format "{{.ID}}: {{.Size}}" | |
create-manifest-list: | |
name: Create Manifest List for aot-sample | |
needs: [aot] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: create manifest | |
run: | | |
docker manifest create ghcr.io/${{github.repository_owner}}/aot-sample:latest \ | |
ghcr.io/${{github.repository_owner}}/aot-sample:jammy-chiseled-amd64 \ | |
ghcr.io/${{github.repository_owner}}/aot-sample:jammy-chiseled-arm64 \ | |
ghcr.io/${{github.repository_owner}}/aot-sample:alpine-amd64 | |
docker manifest push ghcr.io/${{github.repository_owner}}/aot-sample:latest |