Skip to content

Commit

Permalink
[chore] Port Makefile steps (#63)
Browse files Browse the repository at this point in the history
- Add missing make steps for publishing
- Sync make steps with those used in EasyPost .NET library
- Move VB and F# tests to compatibility
- Allow GitHub release CI to be triggered manually
  • Loading branch information
nwithan8 authored Feb 10, 2024
1 parent 78a6495 commit c9015c0
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:

# Build the test project
- name: Build Solution
run: msbuild EasyVCR.Tests.FSharp\EasyVCR.Tests.FSharp.fsproj /p:platform="Any CPU" /p:configuration="Debug" /p:outputPath="bin/Test" /p:target="Rebuild" -restore
run: make fs-compat-test fw=net8.0 # Always run compatibility tests on the latest framework

Visual_Basic_Compatibility:
runs-on: windows-2022
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:

# Build the test project
- name: Build Solution
run: msbuild EasyVCR.Tests.VB\EasyVCR.Tests.VB.vbproj /p:platform="Any CPU" /p:configuration="Debug" /p:outputPath="bin/Test" /p:target="Rebuild" -restore
run: make vb-compat-test fw=net8.0 # Always run compatibility tests on the latest framework


# .NET Standard notes:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Release
on:
release:
types: [ published ]
workflow_dispatch:

jobs:
publish:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>EasyVCR.Compatibility.FSharp</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This test checks that EasyVCR C# code can be used in F#.
// This test project is running on .NET 6.0, although a success here should mean a success in all versions of .NET.'
// This test project is running on the latest .NET, although a success here should mean a success in all versions of .NET.'

namespace EasyVCR.Tests.FSharp
namespace EasyVCR.Compatibility.FSharp

open Xunit

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>EasyVCR.Tests.VB</RootNamespace>
<RootNamespace>EasyVCR.Compatibility.VB</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'This test checks that EasyVCR C# code can be used in Visual Basic.
'This test project is running on .NET 6.0, although a success here should mean a success in all versions of .NET.
'This test project is running on the latest .NET, although a success here should mean a success in all versions of .NET.
Imports Xunit

Public Class VbCompileTest
Expand Down
4 changes: 2 additions & 2 deletions EasyVCR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyVCR", "EasyVCR\EasyVCR.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyVCR.Tests", "EasyVCR.Tests\EasyVCR.Tests.csproj", "{6DE2872F-98ED-4AE1-8674-F33A36AC2012}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "EasyVCR.Tests.FSharp", "EasyVCR.Tests.FSharp\EasyVCR.Tests.FSharp.fsproj", "{163D6AB6-D5CF-4D77-A2D0-BDF329D99DE4}"
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "EasyVCR.Compatibility.FSharp", "EasyVCR.Compatibility.FSharp\EasyVCR.Compatibility.FSharp.fsproj", "{163D6AB6-D5CF-4D77-A2D0-BDF329D99DE4}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EasyVCR.Tests.VB", "EasyVCR.Tests.VB\EasyVCR.Tests.VB.vbproj", "{B78C8E42-AECD-441A-936C-C0F8F1006E2A}"
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EasyVCR.Compatibility.VB", "EasyVCR.Compatibility.VB\EasyVCR.Compatibility.VB.vbproj", "{B78C8E42-AECD-441A-936C-C0F8F1006E2A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
43 changes: 26 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,13 @@ coverage-check:
docs:
dotnet tool run docfx docs/docfx.json

## format - Formats the project
format:
dotnet tool run dotnet-format --no-restore

## install-tools - Install required dotnet tools
install-tools:
dotnet new tool-manifest || exit 0
dotnet tool install --local security-scan --version 5.6.3 || exit 0
dotnet tool install --local dotnet-format || exit 0
dotnet tool install --local docfx --version 2.60.2 || exit 0

## install-release-tools - Install required tools for release
install-release-tools:
bash scripts/unix/install_osslsigncode.sh

## install - Install requirements
install: | install-tools
git submodule init
Expand All @@ -64,22 +56,27 @@ lint:
# Lint the source code by building with the "Linting" configuration (will trigger StyleCop)
dotnet build EasyVCR/EasyVCR.csproj -c "Linting" -t:Rebuild -restore -p:EnforceCodeStyleInBuild=true

## lint-fix - Formats the project
lint-fix:
dotnet tool run dotnet-format --no-restore

## lint-scripts - Lint and validate the Batch scripts (Windows only)
lint-scripts:
scripts\win\lint_scripts.bat

## prep-release - Build, sign and package the project for distribution, signing with the provided certificate
## publish - Publish the project to NuGet
# @parameters:
# sncert= - The strong-name certificate to use for signing the built assets.
# cert= - The authenticity certificate to use for signing the built assets.
# pass= - The password for the authenticity certificate.
prep-release:
bash scripts/unix/build_release_nuget.sh EasyVCR ${sncert} ${cert} ${pass} Release
# key= - The NuGet API key to use for publishing.
# ref: https://learn.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-push
publish:
# Verify that no extraneous .nupkg files exist
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${key} --skip-duplicate

## release - Cuts a release for the project on GitHub (requires GitHub CLI)
# tag = The associated tag title of the release
# target = Target branch or full commit SHA
release:
gh release create ${tag} *.nupkg
gh release create ${tag} --target ${target}

## restore - Restore the project
restore:
Expand Down Expand Up @@ -107,6 +104,18 @@ test:
# fw= - The framework to build for.
test-fw:
# Note, running .NET Framework tests on a non-Windows machine may cause issues: https://xunit.net/docs/getting-started/netfx/cmdline
dotnet test EasyVCR.Tests/EasyVCR.Tests.csproj -f ${fw}
dotnet test EasyVCR.Tests/EasyVCR.Tests.csproj -f ${fw} -c "Debug" # Always run unit tests in Debug mode to allow access to internal members

## fs-compat-test - Run the F# compatibility tests for a specific framework
## @parameters:
## fw= - The framework to build for.
fs-compat-test:
dotnet test EasyVCR.Compatibility.FSharp/EasyVCR.Compatibility.FSharp.fsproj -f ${fw} -restore

## vb-compat-test - Run the VB compatibility tests for a specific framework
## @parameters:
## fw= - The framework to build for.
vb-compat-test:
dotnet test EasyVCR.Compatibility.VB/EasyVCR.Compatibility.VB.vbproj -f ${fw} -restore

.PHONY: help analyze build build-fw build-prod clean coverage coverage-check docs format install-tools install-release-tools install lint lint-scripts prep-release release restore scan setup-win setup-unix test test-fw
.PHONY: help analyze build build-fw build-prod clean coverage coverage-check docs install-tools install lint lint-fix lint-scripts publish release restore scan setup-win setup-unix test test-fw fs-compat-test vb-compat-test

0 comments on commit c9015c0

Please sign in to comment.