WIP #395
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: .NET | |
on: [push] | |
jobs: | |
#=========================================================================================== | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
#----------------------------------------------------------------------- | |
# Checkout | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# lfs: true | |
#- name: Checkout LFS objects | |
# run: git lfs checkout | |
- name: Extract branch name | |
id: extract_branch_name | |
run: | | |
export branch_name=`git name-rev --name-only --exclude=tags/* HEAD` | |
echo "Detected current branch: ${branch_name}" | |
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT | |
#----------------------------------------------------------------------- | |
# Setup environments | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
2.2.x | |
3.1.x | |
5.0.x | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Setup NuGet package reference | |
run: | | |
dotnet nuget add source ${{secrets.GH_LOCAL_NUGET_URL}} -n ref1 -u ${{secrets.GH_LOCAL_NUGET_USER}} -p ${{secrets.GH_LOCAL_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config | |
# dotnet nuget add source ${{secrets.GH_NUGET_URL}} -n ref2 -u ${{secrets.GH_NUGET_USER}} -p ${{secrets.GH_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config | |
#----------------------------------------------------------------------- | |
# Build | |
- name: Build | |
run: dotnet build -p:Configuration=Release -p:Platform="Any CPU" -p:RestoreNoCache=True -p:BuildIdentifier=${GITHUB_RUN_NUMBER} chibicc-cil-toolchain.sln | |
- name: Build NuGet packages | |
run: dotnet pack -p:Configuration=Release -p:Platform="Any CPU" -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts chibicc-cil-toolchain.sln | |
#----------------------------------------------------------------------- | |
# Test | |
- name: Test | |
run: | | |
dotnet clean -p:Configuration=Release -p:Platform="Any CPU" | |
dotnet test -p:Configuration=Release -p:Platform="Any CPU" -p:CITest=True chibicc-cil-toolchain.sln | |
timeout-minutes: 10 | |
#----------------------------------------------------------------------- | |
# Deploy packages (develop) | |
- name: Deploy NuGet package (develop/ref1) | |
if: startsWith( github.ref, 'refs/tags/' ) | |
run: dotnet nuget push artifacts/chibi*.nupkg --source ref1 | |
#----------------------------------------------------------------------- | |
# Deploy packages (main) | |
#- name: Deploy NuGet package (main/ref2) | |
# if: (startsWith( github.ref, 'refs/tags/' )) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'main')) | |
# run: dotnet nuget push artifacts/chibi*.nupkg --source ref2 | |
#=========================================================================================== | |
windows: | |
runs-on: windows-latest | |
steps: | |
#----------------------------------------------------------------------- | |
# Checkout | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# lfs: true | |
#- name: Checkout LFS objects | |
# run: git lfs checkout | |
- name: Extract branch name | |
id: extract_branch_name | |
run: | | |
$branch_name=$(git name-rev --name-only --exclude=tags/* HEAD) | |
echo "Detected current branch: ${branch_name}" | |
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT | |
#----------------------------------------------------------------------- | |
# Setup environments | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
2.2.x | |
3.1.x | |
5.0.x | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Setup NuGet package reference | |
run: | | |
dotnet nuget add source ${{secrets.GH_LOCAL_NUGET_URL}} -n ref1 -u ${{secrets.GH_LOCAL_NUGET_USER}} -p ${{secrets.GH_LOCAL_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config | |
# dotnet nuget add source ${{secrets.GH_NUGET_URL}} -n ref2 -u ${{secrets.GH_NUGET_USER}} -p ${{secrets.GH_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config | |
#----------------------------------------------------------------------- | |
# Build | |
- name: Build | |
run: dotnet build -p:Configuration=Release -p:Platform="Any CPU" -p:RestoreNoCache=True -p:BuildIdentifier=${GITHUB_RUN_NUMBER} chibicc-cil-toolchain.sln | |
- name: Build NuGet packages | |
run: dotnet pack -p:Configuration=Release -p:Platform="Any CPU" -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts chibicc-cil-toolchain.sln | |
#----------------------------------------------------------------------- | |
# Test | |
- name: Test | |
run: | | |
dotnet clean -p:Configuration=Release -p:Platform="Any CPU" | |
dotnet test -p:Configuration=Release -p:Platform="Any CPU" -p:CITest=True chibicc-cil-toolchain.sln | |
timeout-minutes: 10 | |
#----------------------------------------------------------------------- | |
# Deploy packages (develop) | |
#- name: Deploy NuGet package (develop/ref1) | |
# if: startsWith( github.ref, 'refs/tags/' ) | |
# run: dotnet nuget push artifacts\chibi*.nupkg --source ref1 | |
#----------------------------------------------------------------------- | |
# Deploy packages (main) | |
#- name: Deploy NuGet package (main/ref2) | |
# if: (startsWith( github.ref, 'refs/tags/' )) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'main')) | |
# run: dotnet nuget push artifacts\chibi*.nupkg --source ref2 |