Skip to content

- Bump version number (#577) #1576

- Bump version number (#577)

- Bump version number (#577) #1576

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request: ~
workflow_dispatch: ~
jobs:
lint:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools
run: make install install-styleguide
- name: Check style with dotnet-format
run: make lint
Roslyn_Static_Analysis:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools
run: make install install-styleguide
- name: Restore NuGet Packages
run: make restore
# This Make step is configured to treat all warnings as errors, so it will fail if any warnings are found
- name: Run static analysis
run: make analyze
Security_Code_Scan:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Set up dotnet tools and dependencies
run: make install
- name: Run security analysis
run: make scan
Coverage_Requirements:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.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@v4
- 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 }}
Publish_Docs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x.x
- name: Install docfx
run: make install-tools
- name: Generate docs
run: make docs
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
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: [ 'NetStandard20', 'Net50', 'Net60', 'Net70', 'Net80' ]
include:
- name: NetStandard20
# 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
framework: net462
- name: Net50
framework: net5.0
- name: Net60
framework: net6.0
- name: Net70
framework: net7.0
- name: Net80
framework: net8.0
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
# .NET 5.0 is deprecated and removed from GitHub Actions, we need to manually install it
dotnet-version: |
5.x.x
8.x.x
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Setup Nuget
uses: NuGet/[email protected]
- 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-
- name: Restore NuGet Packages
run: make restore
# 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 unit-test fw=${{ matrix.framework }}
Integration_Tests:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.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
# Run the integration tests
- name: Run Tests
run: make integration-test fw=net7.0 # Always run integration tests on the latest framework
FSharp_Compatibility_Tests:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.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
# Run the compatibility tests
- name: Run Tests
run: make fs-compat-test fw=net7.0 # Always run compatibility tests on the latest framework
Visual_Basic_Compatibility_Test:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.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
# Run the compatibility tests
- name: Run Tests
run: make vb-compat-test fw=net7.0 # Always run compatibility tests on the latest framework
# .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
# - NET Framework 4.6.1 is EOL after April 26, 2022, due to its security concerns (was affected by the SHA-1 crack): https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-framework
# - GitHub's Windows 2022 runner only supports minimum .NET Framework 4.6.2 anyway: https://github.com/actions/virtual-environments/issues/5055#issuecomment-1040757930
# - .NET Standard is not a framework, but a set of shared APIs between the old .NET Framework and new .NET/.NET Core
# - `EasyPost` targets .NET Standard 2.0, meaning it is compatible with specific versions of both .NET and .NET Framework: https://docs.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0
# - When you want to actually run code, however, you can't run it in .NET Standard. You have to run it in either .NET or .NET Framework: https://stackoverflow.com/a/48885500/13343799
# - So, while `EasyPost` targets .NET Standard 2.0, `EasyPost.Tests`, the code we're actually executing, targets .NET Framework 4.6.2
# - By extension, this is ensuring we are testing that the `EasyPost` source code can run in a .NET Framework environment