Skip to content

Commit

Permalink
[chore] Port all release scripts, CI steps and Makefile from EasyPost…
Browse files Browse the repository at this point in the history
…-CSharp (#50)

- Port all release scripts, CI steps and Makefile from EasyPost-CSharp
- Remove docs and static analysis for now
  • Loading branch information
nwithan8 authored May 17, 2023
1 parent 75243ea commit 2c80bb5
Show file tree
Hide file tree
Showing 31 changed files with 451 additions and 236 deletions.
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Description

<!-- Please provide a general summary of your PR changes and link any related issues or other pull requests. -->

# Testing

<!--
Please provide details on how you tested this code. See below.
- All pull requests must be tested (unit tests where possible with accompanying cassettes, or provide a screenshot of end-to-end testing when unit tests are not possible)
- New features must get a new unit test
- Bug fixes/refactors must re-record existing cassettes
-->

# Pull Request Type

Please select the option(s) that are relevant to this PR.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Improvement (fixing a typo, updating readme, renaming a variable name, etc)
167 changes: 102 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,69 +11,84 @@ jobs:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.x.x
6.x.x
7.x.x
dotnet-version: 7.x.x

- name: Set up dotnet tools
run: make install-tools
- name: Check dotnet Style

- name: Check style with dotnet-format
run: make lint
security:
runs-on: windows-2022

Security_Code_Scan:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.x.x
6.x.x
7.x.x
- name: Set up dotnet tools
run: make install-tools
dotnet-version: 7.x.x

- name: Set up dotnet tools and dependencies
run: make install

- name: Run security analysis
run: make scan
# TODO: In the future, we can collect the output logs by enabling Code Scanning and using the pre-built GitHub Action: https://github.com/marketplace/actions/securitycodescan
# https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#uploading-a-code-scanning-analysis-with-github-actions
coverage:
if: github.ref == 'refs/heads/master'
runs-on: windows-2022

Coverage_Requirements:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.x.x
6.x.x
7.x.x
dotnet-version: 7.x.x

- name: Set up dotnet tools and dependencies
run: make install

- name: Check if test suite coverage meets requirements
run: make coverage-check

Upload_Coverage_Report:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Set up dotnet tools and dependencies
run: make install

- name: Generate coverage report
run: make coverage

- name: Upload lcov coverage report to Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: coveragereport/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}

NET_Tests:
# derived from https://dev.to/felipetofoli/github-actions-for-net-full-framework-build-and-test-299h
runs-on: windows-2022
env:
EASYPOST_TEST_API_KEY: "123"
EASYPOST_PROD_API_KEY: "123"
strategy:
matrix:
name: [ 'net462', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0' ]
name: [ 'net462', 'netstandard2.0', 'netcoreapp3.1', 'net5.0', 'net6.0', 'net7.0' ]
include:
- name: net462
# This is really a test of .NET Standard, a bridge between .NET Framework and .NET, targeting .NET Framework 4.6.2
framework: net462
- name: netstandard2.0
# can't run tests on .NET Standard, it's just a bridge between .NET Framework and .NET.
# So we'll target .NET Framework 4.6.2
# More notes at the bottom of this file
# Name chosen so we don't have to change the names of the required tests on GitHub Actions
framework: net462
- name: netcoreapp3.1
framework: netcoreapp3.1
Expand All @@ -87,83 +102,105 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
# .NET 5 is deprecated and removed from GitHub Actions, we need to manually install it
dotnet-version: |
3.1.x
5.x.x
6.x.x
7.x.x
# Install MSBuild, used to build the test project
- name: Setup MSBuild
uses: microsoft/[email protected]
# Install NuGet.exe to restore required NuGet packages

- name: Setup Nuget
uses: NuGet/[email protected]
# Load NuGet package cache

- name: Load NuGet package cache
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ matrix.framework }}-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
# Restore required NuGet packages
- name: Restore NuGet Packages
run: make restore
# Run the framework-specific tests

# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install

# Run the unit tests in a specific framework (verify that the library works in that framework)
- name: Run Tests
run: make test-fw fw=${{ matrix.framework }}
Compatibility_Tests:

FSharp_Compatibility:
runs-on: windows-2022
strategy:
matrix:
lang: [ 'VB', 'FSharp' ]
include:
- lang: VB
ext: vbproj
- lang: FSharp
ext: fsproj
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.x.x
6.x.x
7.x.x
# Set the project name, based on platform version currently selected
- name: Set up variables
id: test_project
run: echo "::set-output name=test_file::EasyVCR.Tests.${{ matrix.lang }}"
# Install MSBuild, used to build the test project
dotnet-version: 7.x.x

- name: Setup MSBuild
uses: microsoft/[email protected]
# Install NuGet.exe to restore required NuGet packages

- name: Setup Nuget
uses: NuGet/[email protected]
# Install Visual Studio's console test application, to execute tests

- name: Setup VSTest
uses: darenm/[email protected]
# Load NuGet package cache
- name: Load NuGet package cache
uses: actions/cache@v3

- name: Restore NuGet Packages
run: make restore

# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install

# 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

Visual_Basic_Compatibility:
runs-on: windows-2022
steps:

- uses: actions/checkout@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ matrix.framework }}-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
# Restore required NuGet packages
submodules: true

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x.x

- name: Setup MSBuild
uses: microsoft/[email protected]

- name: Setup Nuget
uses: NuGet/[email protected]

- name: Setup VSTest
uses: darenm/[email protected]

- name: Restore NuGet Packages
run: make restore

# Pull in fixtures submodule
- name: Set up dotnet tools and dependencies
run: make install

# Build the test project
- name: Build Solution
run: msbuild ${{ steps.test_project.outputs.test_file }}\${{ steps.test_project.outputs.test_file }}.${{ matrix.ext }} /p:platform="Any CPU" /p:configuration="Debug" /p:outputPath="bin/Test" /p:target="Rebuild" -restore
run: msbuild EasyVCR.Tests.VB\EasyVCR.Tests.VB.vbproj /p:platform="Any CPU" /p:configuration="Debug" /p:outputPath="bin/Test" /p:target="Rebuild" -restore


# .NET Standard notes:
# - NET Standard 2.0 is compatible with minimum .NET Framework 4.6.1: https://docs.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0
Expand Down
Binary file removed EasyPost.pub
Binary file not shown.
Binary file added EasyPostNETStrongNameSigning.pub
Binary file not shown.
2 changes: 1 addition & 1 deletion EasyVCR/EasyVCR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>..\EasyPost.pub</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>..\EasyPostNETStrongNameSigning.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading

0 comments on commit 2c80bb5

Please sign in to comment.