Skip to content

Commit

Permalink
Updated GA script.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Jan 20, 2024
1 parent 117249e commit b17dfc2
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 40 deletions.
126 changes: 96 additions & 30 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ name: .NET
on: [push]

jobs:
build:
runs-on: windows-latest

#===========================================================================================

linux:
runs-on: ubuntu-latest
steps:

#-----------------------------------------------------------------------
# Checkout

- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
# lfs: true
Expand All @@ -20,33 +23,23 @@ jobs:
- name: Extract branch name
id: extract_branch_name
run: |
$branch_name=$(git name-rev --name-only --exclude=tags/* HEAD)
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 2.2
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.*
- name: Setup .NET 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.*
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.*
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.*
- name: Setup .NET 7
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.*
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: |
Expand All @@ -56,28 +49,101 @@ jobs:
#-----------------------------------------------------------------------
# Build

- name: NuGet restore
run: dotnet restore -p:Configuration=Release chibias.sln

- name: Build
run: dotnet build -p:Configuration=Release -p:BuildIdentifier=${GITHUB_RUN_NUMBER} chibias.sln
run: dotnet build -p:Configuration=Release -p:Platform="Any CPU" -p:RestoreNoCache=True -p:BuildIdentifier=${GITHUB_RUN_NUMBER} chibias.sln

- name: Build NuGet packages
run: dotnet pack -p:Configuration=Release -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -p:PackageOutputPath="..\artifacts" chibias.sln
run: dotnet pack -p:Configuration=Release -p:Platform="Any CPU" -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts chibias.sln

#-----------------------------------------------------------------------
# Test

- name: Test
run: dotnet test --no-restore --verbosity normal -p:CITest=True chibias.sln
run: |
dotnet clean -p:Configuration=Release -p:Platform="Any CPU" |
dotnet test -p:Configuration=Release -p:Platform="Any CPU" -p:CITest=True chibias.sln
timeout-minutes: 10

#-----------------------------------------------------------------------
# Deploy packages (develop)

- name: Deploy NuGet package (develop/ref1)
if: startsWith( github.ref, 'refs/tags/' )
run: dotnet nuget push artifacts\chibias*.nupkg --source ref1
run: dotnet nuget push artifacts/chibias*.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/chibias*.nupkg --source ref1

#===========================================================================================

windows:
runs-on: windows-latest
steps:

#-----------------------------------------------------------------------
# Checkout

- uses: actions/checkout@v3
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@v3
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} chibias.sln

- name: Build NuGet packages
run: dotnet pack -p:Configuration=Release -p:Platform="Any CPU" -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts chibias.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 chibias.sln
timeout-minutes: 10

#-----------------------------------------------------------------------
# Deploy packages (develop)

#- name: Deploy NuGet package (develop/ref1)
# if: startsWith( github.ref, 'refs/tags/' )
# run: dotnet nuget push artifacts\chibias*.nupkg --source ref1

#-----------------------------------------------------------------------
# Deploy packages (main)
Expand Down
40 changes: 31 additions & 9 deletions chibias.core.Tests/AssemblerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -756,25 +756,47 @@ .function public int32() main
[Test]
public Task LdcR4Varies1()
{
var actual = Run($@"
// HACK: ILDasm on Windows, R4 constant value format is suppressed leading zero.
// Linux: "3.4028235e+038"
// Windows: "3.4028235e+38"
// So will fail the test.
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
var actual = Run($@"
.function public int32() main
ldc.r4 {float.MaxValue}
pop
ldc.i4.1
ret");
return Verify(actual);
return Verify(actual);
}
else
{
return Task.CompletedTask;
}
}

[Test]
public Task LdcR4Varies2()
{
var actual = Run($@"
.function public int32() main
ldc.r4 {float.MinValue}
pop
ldc.i4.1
ret");
return Verify(actual);
// HACK: ILDasm on Windows, R4 constant value format is suppressed leading zero.
// Linux: "-3.4028235e+038"
// Windows: "-3.4028235e+38"
// So will fail the test.
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
var actual = Run($@"
.function public int32() main
ldc.r4 {float.MinValue}
pop
ldc.i4.1
ret");
return Verify(actual);
}
else
{
return Task.CompletedTask;
}
}

/////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion chibias.net4/chibias.net4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
<PackageReference Include="ILRepack.FullAuto" Version="1.4.0" PrivateAssets="All" />
<PackageReference Include="ILRepack.FullAuto" Version="1.5.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit b17dfc2

Please sign in to comment.