Skip to content

Build .NET SDK

Build .NET SDK #175

Workflow file for this run

name: Build .NET SDK
on:
workflow_dispatch:
inputs:
fork:
description: 'dotnet VMR fork name'
required: true
type: string
default: dotnet
branch:
description: 'dotnet VMR branch name'
required: true
type: string
default: release/10.0.2xx
release:
description: 'publish release'
type: boolean
default: true
whole_source:
description: 'publish whole source'
type: boolean
whole_source_early:
description: 'publish whole source early'
type: boolean
jobs:
run:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v4.1
with:
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-cached-tools: 'true'
- name: Checkout repository
uses: actions/checkout@v4
- name: Build own rootfs
run: |
cd ${{ github.workspace }}
sudo ./00_build_rootfs.sh
- name: Clone repository
run: |
git clone --single-branch --depth 1 -b ${{ inputs.branch }} https://github.com/${{ inputs.fork }}/dotnet
- name: Patch repository
run: |
cd ${{ github.workspace }}
./patch_alpine.sh
./patch_runtime.sh
- name: Pack whole source early
if: ${{ inputs.whole_source_early }}
run: |
cd ${{ github.workspace }}
sudo ./xx_pack_whole_source.sh
- name: Upload whole source early
if: ${{ inputs.whole_source_early }}
uses: actions/upload-artifact@v4
with:
name: whole_source
path: ${{ github.workspace }}/whole_source.tar.gz
- name: Build rootfs
run: |
docker run --platform linux/amd64 --rm \
-v${{ github.workspace }}/dotnet:/dotnet \
-v${{ github.workspace }}/crossrootfs:/crossrootfs \
-w /dotnet \
-e ROOTFS_DIR=/crossrootfs/riscv64 \
mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-riscv64-musl \
./eng/common/cross/build-rootfs.sh riscv64 alpineedge \
--skipemulation \
--skipunmount \
--rootfsdir /crossrootfs/riscv64
- name: Provision GSSAPI stub into rootfs
run: |
docker run --platform linux/amd64 --rm \
-v${{ github.workspace }}:/work \
-v${{ github.workspace }}/crossrootfs:/crossrootfs \
-w /work \
-e ROOTFS_DIR=/crossrootfs/riscv64 \
mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-riscv64-musl \
./provision_gss_stub.sh
- name: Build
run: |
docker run --platform linux/amd64 --rm \
-v${{ github.workspace }}/dotnet:/dotnet \
-v${{ github.workspace }}/crossrootfs:/crossrootfs \
-v${{ github.workspace }}/tools:/tools:ro \
-w /dotnet \
-e ROOTFS_DIR=/crossrootfs/riscv64 \
-e CLR_CC=/tools/clang \
-e CLR_CXX=/tools/clang++ \
-e FeatureXplatEventSource=false \
-e RiscVSoftFloat=1 \
mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net10.0-cross-riscv64-musl \
./build.sh --clean-while-building --prep -sb \
--os linux-musl \
--rid linux-musl-riscv64 \
--verbosity normal \
--arch riscv64 \
-p:OfficialBuildId=$(date +%Y%m%d).99
- name: List assets directory
run: |
find "${{ github.workspace }}/dotnet/artifacts" || true
- name: List packages directory
run: |
find "${{ github.workspace }}/dotnet/.packages" || true
- name: List runtime assets directory
run: |
find "${{ github.workspace }}/dotnet/runtime/artifacts" || true
- name: Pack whole source
if: ${{ inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./xx_pack_whole_source.sh
- name: Upload whole source
if: ${{ inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: whole_source
path: ${{ github.workspace }}/whole_source.tar.gz
- name: Pack compiler-linux
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./01_pack_compiler_linux.sh
- name: Pack crossrootfs
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./02_pack_crossrootfs.sh
- name: Pack GNU libs
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./03_pack_gnu_libs.sh
- name: Pack libs
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./04_pack_libs.sh
- name: Pack bflat-refs
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./06_pack_refs.sh
- name: Pack bflat-libs-linux
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./07_pack_bflat_libs_linux.sh
- name: Pack bflat-compiler-nupkg
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./08_pack_bflat_compiler_nupkg.sh
- name: Pack bflat-compiler-native-linux
if: ${{ ! inputs.whole_source }}
run: |
cd ${{ github.workspace }}
sudo ./09_pack_bflat_compiler_native_linux.sh
- name: Upload .NET
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: dotnet-sdk-linux-musl-riscv64
path: |
${{ github.workspace }}/dotnet/artifacts/assets/Release/Sdk/*/dotnet-sdk-*.tar.gz
${{ github.workspace }}/dotnet/artifacts/packages/Release/Shipping/runtime/*.nupkg
- name: Upload crossrootfs-musl
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: crossrootfs-musl-riscv64
path: ${{ github.workspace }}/output/crossrootfs-linux/crossrootfs-musl-riscv64.tar.xz
- name: Upload crossrootfs-gnu
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: crossrootfs-gnu-riscv64
path: ${{ github.workspace }}/output/crossrootfs-linux/crossrootfs-gnu-riscv64.tar.xz
- name: Upload libs-linux
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: libs-linux-musl-riscv64
path: ${{ github.workspace }}/output/libs-linux/libs-linux-musl-riscv64.zip
- name: Upload compiler-linux
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: compiler-linux-glibc-x64
path: ${{ github.workspace }}/output/compiler-linux/compiler-linux-glibc-x64.zip
- name: Upload bflat-compiler-native-linux
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: bflat-compiler-native-linux-glibc-x64
path: ${{ github.workspace }}/output/bflat-compiler-native-linux/bflat-compiler-native-linux-glibc-x64.zip
- name: Upload bflat-refs
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: bflat-refs
path: ${{ github.workspace }}/output/bflat-refs/bflat-refs.zip
- name: Upload bflat-libs-linux
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: bflat-libs-linux
path: ${{ github.workspace }}/output/bflat-libs-linux/bflat-libs-linux-musl-riscv64.zip
- name: Upload bflat-compiler-nupkg
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: bflat-compiler-nupkg
path: ${{ github.workspace }}/output/bflat-compiler-nupkg/bflat.compiler.10.0.0.nupkg
- name: Upload runtime artifacts
if: ${{ ! inputs.whole_source }}
uses: actions/upload-artifact@v4
with:
name: runtime-artifacts-musl-riscv64
path: ${{ github.workspace }}/dotnet/src/runtime/artifacts
- name: Make release
if: ${{ inputs.release }}
run: |
sudo apt update -y
sudo apt install -y hub
sudo rm -rf "${{ github.workspace }}/dotnet/src/runtime/artifacts"
# hub(1) requires release to be created inside a git repo
git clone https://${{ secrets.CLONE_TOKEN }}:x-oauth-basic@github.com/${{ github.repository }}.git repo
cd repo
sdk_path=$(find ${{ github.workspace }}/dotnet/artifacts/assets/Release/Sdk -name 'dotnet-sdk-*.tar.gz' | head -n1)
sdk_filename=$(basename "$sdk_path")
# Extract version: strip prefix/suffix to get e.g. "10.0.100-preview.5.25277.114"
sdk_version=$(echo "$sdk_filename" | sed -E 's/dotnet-sdk-([^-]+(-[^-]+)*)-linux-.+\.tar\.gz/\1/')
artifacts=" -a $sdk_path"
artifacts+=" -a $(find ${{ github.workspace }}/dotnet/artifacts/packages/Release/Shipping/runtime -name '*.nupkg' ! -name '*symbols.nupkg' | head -n1)"
artifacts+=" -a ${{ github.workspace }}/output/crossrootfs-linux/crossrootfs-musl-riscv64.tar.xz"
artifacts+=" -a ${{ github.workspace }}/output/crossrootfs-linux/crossrootfs-gnu-riscv64.tar.xz"
artifacts+=" -a ${{ github.workspace }}/output/libs-linux/libs-linux-musl-riscv64.zip"
artifacts+=" -a ${{ github.workspace }}/output/compiler-linux/compiler-linux-glibc-x64.zip"
artifacts+=" -a ${{ github.workspace }}/output/bflat-compiler-native-linux/bflat-compiler-native-linux-glibc-x64.zip"
artifacts+=" -a ${{ github.workspace }}/output/bflat-refs/bflat-refs.zip"
artifacts+=" -a ${{ github.workspace }}/output/bflat-libs-linux/bflat-libs-linux-musl-riscv64.zip"
artifacts+=" -a ${{ github.workspace }}/output/bflat-compiler-nupkg/bflat.compiler.10.0.0.nupkg"
tag_name="$sdk_version"
echo "tag_name: $tag_name"
echo "artifacts: $artifacts"
# docs: https://hub.github.com/hub-release.1.html
hub release create $artifacts --prerelease -m "$tag_name" "$tag_name"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}