Skip to content

Adds output option to CLI to stdout with -S argument. -S will ignore … #343

Adds output option to CLI to stdout with -S argument. -S will ignore …

Adds output option to CLI to stdout with -S argument. -S will ignore … #343

Workflow file for this run

name: libNOM.io
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
create:
jobs:
test:
name: Test
strategy:
matrix:
# November, 2024 / May, 2024 / November, 2026
framwork: [{dotnet: 'net6.0', version: '6.0.x'}, {dotnet: 'net7.0', version: '7.0.x'}, {dotnet: 'net8.0', version: '8.0.x'}]
os: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.framwork.version }}
dotnet-quality: ga
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
# TODO: Disabled until pipeline runs properly and LFS bandwidth is reseted.
# - name: Large File Storage (Create)
# run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
# - name: Large File Storage (Cache)
# uses: actions/cache@v4
# with:
# path: .git/lfs/objects
# key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
# restore-keys: |
# ${{ runner.os }}-lfs-
# - name: Large File Storage (Pull)
# run: git lfs pull
- name: Secret Injector
run: Get-ChildItem ./libNOM.test/Properties/ -File | ForEach-Object { (Get-Content $_.FullName) -Replace "{{ secrets.TESTSUITE_PASSWORD }}","${{ secrets.TESTSUITE_PASSWORD }}" | Set-Content $_.FullName }
shell: pwsh
- name: Unit Test
run: dotnet test libNOM.test --configuration Debug --framework ${{ matrix.framwork.dotnet }}
build:
name: Build
strategy:
matrix:
framwork: [{dotnet: 'net8.0', version: '8.0.x'}] # must match project file
os: [{display: 'windows', name: 'windows', runtime: 'win-x64'}, {display: 'macos', name: 'macos', runtime: 'osx-x64'}, {display: 'linux', name: 'ubuntu', runtime: 'linux-x64'}]
runs-on: ${{ matrix.os.name }}-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.framwork.version }}
dotnet-quality: ga
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Secret Injector
run: Get-ChildItem ./libNOM.io/Properties/ -File | ForEach-Object { (Get-Content $_.FullName) -Replace "{{ secrets.STEAM_API_KEY }}","${{ secrets.STEAM_API_KEY }}" | Set-Content $_.FullName }
shell: pwsh
- name: Pack
if: ${{ matrix.os.name == 'macos' }} # only once
run: dotnet pack libNOM.io --configuration Release
- name: Publish
run: dotnet publish libNOM.cli --configuration Release --framework ${{ matrix.framwork.dotnet }} --runtime ${{ matrix.os.runtime }}
- name: Publish (Apple Silicon)
if: ${{ matrix.os.name == 'macos' }} # do this to have both native
run: dotnet publish libNOM.cli --configuration Release --framework ${{ matrix.framwork.dotnet }} --runtime osx-arm64
- name: Upload (NuGet)
if: ${{ matrix.os.name == 'macos' }} # only once
uses: actions/upload-artifact@v4
with:
name: NuGet
path: ./libNOM.io/bin/Release/libNOM.io.*nupkg
if-no-files-found: error
- name: Upload (Build)
uses: actions/upload-artifact@v4
with:
name: Build (${{ matrix.os.display }})
path: | # files not found are ignored
./libNOM.cli/bin/Release/${{ matrix.framwork.dotnet }}/${{ matrix.os.runtime }}/publish/libNOM.io.cli
./libNOM.cli/bin/Release/${{ matrix.framwork.dotnet }}/${{ matrix.os.runtime }}/publish/libNOM.io.cli.exe
./libNOM.cli/bin/Release/${{ matrix.framwork.dotnet }}/osx-arm64/publish/libNOM.io.cli
if-no-files-found: error
- name: Upload (Release)
if: ${{ matrix.os.name == 'macos' && startsWith(github.ref, 'refs/tags/') }} # only once and if tagged
uses: actions/upload-artifact@v4
with:
name: Release
path: ./.github/changelogs/${{ github.ref_name }}.md
if-no-files-found: error
release:
name: Release
if: ${{ startsWith(github.ref, 'refs/tags/') }} # only if tagged
runs-on: ubuntu-latest
needs: [test, build]
steps:
- name: Download
uses: actions/download-artifact@v4
- name: Version
run: echo "nupkg_version=$((((Get-Item -Path ./NuGet/libNOM.io.*.nupkg).Name -split '\.',3)[2] -split '\.',-2)[0])" >> $env:GITHUB_ENV
shell: pwsh
- name: Mismatch
if: ${{ github.ref_name != env.nupkg_version }}
run: |
echo "There is a version mismatch between git tag (${{ github.ref_name }}) and nupkg version (${{ env.nupkg_version }})!"
exit 1
- name: Rename
run: |
mv "./Build (windows)/win-x64/publish/libNOM.io.cli.exe" ./libNOM.io.cli.win-x64.exe
mv "./Build (macos)/osx-arm64/publish/libNOM.io.cli" ./libNOM.io.cli.macos-arm64
mv "./Build (macos)/osx-x64/publish/libNOM.io.cli" ./libNOM.io.cli.macos-x64
mv "./Build (linux)/linux-x64/publish/libNOM.io.cli" ./libNOM.io.cli.linux-x64
- name: Create
uses: softprops/action-gh-release@v2
with:
body_path: ./Release/${{ github.ref_name }}.md
files: |
./NuGet/libNOM.io.*nupkg
./libNOM.io.cli*
- name: Publish
run: dotnet nuget push ./NuGet/libNOM.io.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}