Skip to content

Commit

Permalink
ci: Add release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnt2910 committed Jun 4, 2023
1 parent e63e084 commit cdedf81
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
43 changes: 23 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ env:
DOTNET_MAJOR_VERSION: 8
DOTNET_ARCH: x64
DOTNET_OS: haiku
CONFIGURATION: Debug

jobs:
build:
strategy:
matrix:
configuration: [Debug, Release]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -74,32 +76,32 @@ jobs:
run: ${{ github.workspace }}/runtime/eng/common/cross/build-rootfs.sh ${{ env.DOTNET_ARCH }} ${{ env.DOTNET_OS }}

- name: Build .NET Runtime
run: ${{ github.workspace }}/runtime/build.sh --ci -c ${{ env.CONFIGURATION }} -arch ${{ env.DOTNET_ARCH }} -os ${{ env.DOTNET_OS }} -cross -gcc /p:OfficialBuildId=${{ steps.buildid.outputs.buildid }}
run: ${{ github.workspace }}/runtime/build.sh --ci -c ${{ matrix.configuration }} -arch ${{ env.DOTNET_ARCH }} -os ${{ env.DOTNET_OS }} -cross -gcc /p:OfficialBuildId=${{ steps.buildid.outputs.buildid }}

- name: Determine .NET version
id: version
run: |
shopt -s extglob
echo version=$(sed -r 's/(.*Microsoft\.NETCore\.App\.Ref\.)(.*?)(\.nupkg)/\2/' <<< $(ls ${{ github.workspace }}/runtime/artifacts/packages/Debug/Shipping/Microsoft.NETCore.App.Ref.!(*symbols).nupkg)) >> "$GITHUB_OUTPUT"
echo version=$(sed -r 's/(.*Microsoft\.NETCore\.App\.Ref\.)(.*?)(\.nupkg)/\2/' <<< $(ls ${{ github.workspace }}/runtime/artifacts/packages/${{ matrix.configuration }}/Shipping/Microsoft.NETCore.App.Ref.!(*symbols).nupkg)) >> "$GITHUB_OUTPUT"
- name: Extract tarballs
run: |
shopt -s extglob
mkdir ${{ github.workspace }}/output
pushd ${{ github.workspace }}/output
for f in ${{ github.workspace }}/runtime/artifacts/packages/${{ env.CONFIGURATION }}/Shipping/!(*symbols*).tar.gz; do tar xf "$f"; done
for f in ${{ github.workspace }}/runtime/artifacts/packages/${{ matrix.configuration }}/Shipping/!(*symbols*).tar.gz; do tar xf "$f"; done
popd
- name: Clone .NET SDK
run: git clone https://github.com/trungnt2910/dotnet-sdk -b haiku-dotnet${{ env.DOTNET_MAJOR_VERSION }} --depth=1 ${{ github.workspace }}/sdk

- name: Build .NET SDK
run: |
${{ github.workspace }}/sdk/build.sh --ci --pack -c ${{ env.CONFIGURATION }} /p:OSName=${{ env.DOTNET_OS }} /p:Architecture=${{ env.DOTNET_ARCH }} /p:OfficialBuildId=${{ steps.buildid.outputs.buildid }}
${{ github.workspace }}/sdk/build.sh --ci --pack -c ${{ matrix.configuration }} /p:OSName=${{ env.DOTNET_OS }} /p:Architecture=${{ env.DOTNET_ARCH }} /p:OfficialBuildId=${{ steps.buildid.outputs.buildid }}
dotnetVersion=${{ steps.version.outputs.version }}
sdkFeatureBand=$(ls ${{ github.workspace }}/sdk/artifacts/bin/redist/${{ env.CONFIGURATION }}/dotnet/sdk)
pushd ${{ github.workspace }}/sdk/artifacts/bin/redist/${{ env.CONFIGURATION }}/dotnet/sdk/$sdkFeatureBand
sdkFeatureBand=$(ls ${{ github.workspace }}/sdk/artifacts/bin/redist/${{ matrix.configuration }}/dotnet/sdk)
pushd ${{ github.workspace }}/sdk/artifacts/bin/redist/${{ matrix.configuration }}/dotnet/sdk/$sdkFeatureBand
# Update RuntimeIdentifierGraph
cp -f ${{ github.workspace }}/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json ./RuntimeIdentifierGraph.json
Expand Down Expand Up @@ -129,50 +131,51 @@ jobs:
run: |
shopt -s extglob
# SDK
cp -r ${{ github.workspace }}/sdk/artifacts/bin/redist/${{ env.CONFIGURATION }}/dotnet/sdk ${{ github.workspace }}/output
cp -r ${{ github.workspace }}/sdk/artifacts/bin/redist/${{ matrix.configuration }}/dotnet/sdk ${{ github.workspace }}/output
# Templates
dotnetVersion=${{ steps.version.outputs.version }}
mkdir -p ${{ github.workspace }}/output/templates/$dotnetVersion
cp ${{ github.workspace }}/sdk/artifacts/packages/Debug/Shipping/*Templates!(*symbols*).nupkg ${{ github.workspace }}/output/templates/$dotnetVersion
cp ${{ github.workspace }}/sdk/artifacts/packages/${{ matrix.configuration }}/Shipping/*Templates!(*symbols*).nupkg ${{ github.workspace }}/output/templates/$dotnetVersion
- name: Create .NET tarball
run: |
pushd ${{ github.workspace }}/output
fileName=${{ github.workspace }}/net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}
fileName=${{ github.workspace }}/net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}-${{ matrix.configuration }}
tar -cf $fileName.tar *
gzip -9 < $fileName.tar > $fileName.tar.gz
popd
- name: Upload .NET artifact
uses: actions/upload-artifact@v3
with:
name: net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}.tar
path: ${{ github.workspace }}/net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}.tar
name: net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}-${{ matrix.configuration }}.tar
path: ${{ github.workspace }}/net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}-${{ matrix.configuration }}.tar

- name: Upload .NET NuGet packages artifact
uses: actions/upload-artifact@v3
with:
name: dotnet-nuget
path: ${{ github.workspace }}/runtime/artifacts/packages/${{ env.CONFIGURATION }}/Shipping/*.nupkg
path: ${{ github.workspace }}/runtime/artifacts/packages/${{ matrix.configuration }}/Shipping/*.nupkg

- name: Create release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}
automatic_release_tag: net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}-${{ matrix.configuration }}
prerelease: false
title: .NET ${{ env.DOTNET_MAJOR_VERSION }} for Haiku ${{ env.DOTNET_ARCH }} build ${{ steps.buildid.outputs.buildid }}
title: .NET ${{ env.DOTNET_MAJOR_VERSION }} for Haiku ${{ env.DOTNET_ARCH }} build ${{ steps.buildid.outputs.buildid }} ${{ matrix.configuration }}
files: |
${{ github.workspace }}/runtime/artifacts/packages/${{ env.CONFIGURATION }}/Shipping/*
${{ github.workspace }}/sdk/artifacts/packages/${{ env.CONFIGURATION }}/Shipping/*
${{ github.workspace }}/net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}.tar.gz
${{ github.workspace }}/runtime/artifacts/packages/${{ matrix.configuration }}/Shipping/*
${{ github.workspace }}/sdk/artifacts/packages/${{ matrix.configuration }}/Shipping/*
${{ github.workspace }}/net${{ env.DOTNET_MAJOR_VERSION }}-${{ env.DOTNET_OS }}-${{ env.DOTNET_ARCH }}-${{ steps.buildid.outputs.buildid }}-${{ matrix.configuration }}.tar.gz
- name: Publish NuGet packages on GitHub
if: ${{ matrix.configuration == 'Release' }}
run: |
shopt -s extglob
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
# Do not upload symbol packages because:
# - No debugging support on Haiku yet.
# - Pushing symbols packages to GitHub Packages seems to fail with 403 Forbidden.
dotnet nuget push ${{ github.workspace }}/runtime/artifacts/packages/${{ env.CONFIGURATION }}/Shipping/!(*symbols*).nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
dotnet nuget push ${{ github.workspace }}/sdk/artifacts/packages/${{ env.CONFIGURATION }}/Shipping/!(*symbols*).nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
dotnet nuget push ${{ github.workspace }}/runtime/artifacts/packages/${{ matrix.configuration }}/Shipping/!(*symbols*).nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
dotnet nuget push ${{ github.workspace }}/sdk/artifacts/packages/${{ matrix.configuration }}/Shipping/!(*symbols*).nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ Not in the near future, because:

More discussion can be found in [this](https://discuss.haiku-os.org/t/gsoc-2023-net-port/13237/44) forum comment and the following ones.

### Why is this build so slow?

This build of .NET is a **Debug** build. Release builds are currently not provided because of some weird bugs like [this one](https://github.com/dotnet/runtime/issues/55803#issuecomment-1547175040).

## License

.NET binary releases and artifacts belong to the .NET Foundation and Contributors, and are covered by the [MIT License](https://github.com/dotnet/runtime/blob/main/LICENSE.TXT).
Expand Down

0 comments on commit cdedf81

Please sign in to comment.