Skip to content

Commit

Permalink
Added test before deploy. CLI Player now deploys to nuget.
Browse files Browse the repository at this point in the history
  • Loading branch information
qkmaxware committed Jul 17, 2024
1 parent 397104b commit 9f69769
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 72 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/pages.yml

This file was deleted.

106 changes: 106 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Release
on:
release:
types: [ published, edited ]
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest, macOS-latest ]
steps:
- name: Checkout Code
uses: actions/checkout@master
- name: Setup Dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # SDK Version to use
- name: .Net Core Info
run: dotnet --info
- name: Run Unit Tests
run: dotnet test

cli:
needs: [ test ]
name: Publish Nuget
permissions:
packages: write
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@master
- name: Setup Dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # SDK Version to use
- name: Setup Nuget
uses: warrenbuckley/Setup-Nuget@v1
- name: Register Nuget Source
env:
GITHUB_SOURCE: https://nuget.pkg.github.com/qkmaxware/index.json
GITHUB_USERNAME: qkmaxware
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: cmd
run: nuget source Add -Name "GitHub" -Source %GITHUB_SOURCE% -UserName %GITHUB_USERNAME% -Password %GITHUB_TOKEN%
- name: Pack Nuget Package
env:
# Work around https://github.com/actions/setup-dotnet/issues/29
DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64
run: dotnet pack Gameboy.Player.Cli --configuration Release --output nupkg
- name: Publish Nuget Package
env:
# Work around https://github.com/actions/setup-dotnet/issues/29
DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ matrix.dotnet }}/x64
run: nuget push nupkg\*.nupkg -Source "GitHub" --skip-duplicate

blazor:
name: Deploy Github Pages
needs: [ test ]
permissions:
packages: read
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@master
with:
submodules: "recursive"
fetch-depth: 0

- name: Setup Dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # SDK Version to use

- name: Testing
run: dotnet test Gameboy.Test

- name: Change base-tag
run: sed -i 's/<base href="\/" \/>/<base href="\/BlazorBoy\/" \/>/g' Gameboy.Player.Blazor/wwwroot/index.html

- name: Restore Packages
env:
GITHUB_USERNAME: qkmaxware
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: dotnet restore

- name: Build Site
env:
GITHUB_USERNAME: qkmaxware
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: dotnet publish Gameboy.Player.Blazor -c Release -o .site

- name: Add .nojekyll file
run: touch .site/wwwroot/.nojekyll

- name: Custom 404
run: cp .site/wwwroot/index.html .site/wwwroot/404.html

- name: Commit to Github Pages
uses: JamesIves/[email protected]
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: .site/wwwroot
37 changes: 19 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ on:
push:
branches:
- "*"
workflow_call:
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest, macOS-latest ]
steps:
- name: Checkout Code
uses: actions/checkout@master
- name: Setup Dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # SDK Version to use
- name: .Net Core Info
run: dotnet --info
- name: Run Unit Tests
run: dotnet test
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest, macOS-latest ]
steps:
- name: Checkout Code
uses: actions/checkout@master
- name: Setup Dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # SDK Version to use
- name: .Net Core Info
run: dotnet --info
- name: Run Unit Tests
run: dotnet test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/
obj/
nupkg/
[pP]rivate/
TestResults/
.site/
19 changes: 18 additions & 1 deletion Gameboy.Player.Cli/Gameboy.Player.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<PackageId>Blazorboy.Cli</PackageId>
<AssemblyName>Blazorboy.Cli</AssemblyName>
<Version>0.1.0</Version>
<Authors>qkmaxware</Authors>
<PackageTags>emulator</PackageTags>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<RepositoryUrl>https://github.com/qkmaxware/BlazorBoy</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageDescription>
CLI front-end for BlazorBoy emulator
</PackageDescription>

<PackAsTool>true</PackAsTool>
<ToolCommandName>blazorboy</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -20,10 +36,11 @@

<ItemGroup>
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.4.0-alpha.22272.1" />
<ProjectReference Include="..\Gameboy\Gameboy.csproj" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Gameboy\Gameboy.csproj" />
<None Include="..\LICENSE.md" CopyToOutputDirectory="Always" Pack="true" PackagePath="$(PackageLicenseFile)"/>
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions Gameboy.Player.Cli/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CLI Player
CLI front-end for BlazorBoy.

## Installation
1. Clone or Download repo
2. Using dotnet 8 or newer run the following commands
1. dotnet pack Gameboy.Player.Cli.csproj
2. dotnet tool install --global --add-source ./nupkg Blazorboy.Cli

## Uninstall
1. Using dotnet cli run the following commands
1. dotnet tool uninstall --global Blazorboy.Cli

0 comments on commit 9f69769

Please sign in to comment.