Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 22, 2023
1 parent d845963 commit 81a0ba7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 20 deletions.
52 changes: 39 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,59 @@ name: Build Squirrel

on: [ push, pull_request ]

env:
DOTNET_VERSION: '6.0.301'

jobs:
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build
shell: pwsh
run: .\build.ps1
- name: Test Core
run: dotnet test --no-build test\Squirrel.Tests\Squirrel.Tests.csproj -c Release -l "console;verbosity=detailed"
- name: Test CLI
run: dotnet test --no-build test\Squirrel.CommandLine.Tests\Squirrel.CommandLine.Tests.csproj -c Release -l "console;verbosity=detailed"
dotnet-version: 6.0.x

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Install Rust
run: rustup update stable

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Build Rust
working-directory: src/Rust
run: |
cargo build
cargo build --release
- name: Test Rust
working-directory: src/Rust
run: cargo llvm-cov --codecov --output-path ../../test/codecov-rust.json

- name: Build .NET
run: dotnet build -c Release

- name: Test .NET
run: dotnet test -c Release --no-build -l "console;verbosity=detailed"

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test/codecov-rust.json,./test/coverage.opencover.xml
fail_ci_if_error: true

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: .\build\Release\*.nupkg

- name: Publish to GitHub Packages
shell: pwsh
run: dotnet nuget push .\build\Release\*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
7 changes: 4 additions & 3 deletions src/Squirrel.Csq/Commands/SystemCommandLineExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,11 @@ public static void MustBeValidMsiVersion(OptionResult result)

public static void MustBeSupportedRid(OptionResult result)
{
for (int i = 0; i < result.Tokens.Count; i++) {
if (!Regex.IsMatch(result.Tokens[i].Value, @"^(?<os>osx|win)\.?(?<ver>[\d\.]+)?(?:-(?<arch>(?:x|arm)\d{2}))$"))
for (var i = 0; i < result.Tokens.Count; i++) {
if (!Regex.IsMatch(result.Tokens[i].Value, @"^(?<os>osx|win)\.?(?<ver>[\d\.]+)?(?:-(?<arch>(?:x|arm)\d{2}))$")) {
result.AddError($"Invalid or unsupported runtime '{result.IdentifierToken.Value}'. Valid example: win-x64, osx-arm64.");
break;
break;
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/Squirrel.Packaging/HelperFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public HelperFile(ILogger logger)
Log = logger;
}

#if DEBUG
public static string FindTestFile(string toFind) => FindHelperFile(toFind, throwWhenNotFound: true);
#endif

public static void AddSearchPath(params string[] pathParts)
{
Expand Down
4 changes: 2 additions & 2 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

<PropertyGroup>
<CoverletOutputFormat>json,opencover</CoverletOutputFormat>
<CoverletOutput>..\coverage\</CoverletOutput>
<MergeWith>..\coverage\coverage.json</MergeWith>
<CoverletOutput>..\</CoverletOutput>
<MergeWith>..\coverage.json</MergeWith>
<Include>[Squirrel*]*</Include>
<Exclude>[Squirrel.*.Tests]*</Exclude>
<CollectCoverage>true</CollectCoverage>
Expand Down

0 comments on commit 81a0ba7

Please sign in to comment.