chore: add workflows
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
name: publish_and_release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "**/README.md"
|
||||
- "**/.gitignore"
|
||||
- "**/.gitaltributes"
|
||||
- "**/.editorconfig"
|
||||
- "**/LICENSE.txt"
|
||||
- .github/**
|
||||
- src/BGR.Console.Tests/**
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
- name: Setup .NET 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
- name: Install versionize
|
||||
run: dotnet tool install --global Versionize
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --local user.email "65925598+StevanFreeborn@users.noreply.github.com"
|
||||
git config --local user.name "Stevan Freeborn"
|
||||
- name: Run versionize
|
||||
id: versionize
|
||||
run: versionize -i --exit-insignificant-commits --workingDir ./src/BGR.Console --commit-suffix "[skip ci]"
|
||||
continue-on-error: true
|
||||
- name: Upload changelog
|
||||
if: steps.versionize.outcome == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: change-log
|
||||
path: src/BGR.Console/CHANGELOG.md
|
||||
- name: Push changes to GitHub
|
||||
if: steps.versionize.outcome == 'success'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.ACTIONS_PAT }}
|
||||
branch: ${{ github.ref }}
|
||||
tags: true
|
||||
outputs:
|
||||
is_new_version: ${{ steps.versionize.outcome == 'success' }}
|
||||
publish:
|
||||
needs: [version]
|
||||
if: needs.version.outputs.is_new_version == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
- name: Setup .NET 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
- name: Publish for mac-os
|
||||
run: dotnet publish src/BGR.Console/BGR.Console.csproj -c Release -r osx-x64 --self-contained -o dist/mac-os
|
||||
- name: Rename mac-os binary
|
||||
run: mv dist/mac-os/BGR.Console dist/bgr_osx_x64
|
||||
- name: Publish for linux-os
|
||||
run: dotnet publish src/BGR.Console/BGR.Console.csproj -c Release -r linux-x64 --self-contained -o dist/linux-os
|
||||
- name: Rename linux-os binary
|
||||
run: mv dist/linux-os/BGR.Console dist/bgr_linux_x64
|
||||
- name: Publish for windows-os
|
||||
run: dotnet publish src/BGR.Console/BGR.Console.csproj -c Release -r win-x64 --self-contained -o dist/windows-os
|
||||
- name: Rename windows-os binary
|
||||
run: mv dist/windows-os/BGR.Console.exe dist/bgr_windows_x64.exe
|
||||
- name: Get project version
|
||||
uses: kzrnm/get-net-sdk-project-versions-action@v1
|
||||
id: get-version
|
||||
with:
|
||||
proj-path: src/BGR.Console/BGR.Console.csproj
|
||||
- name: Download changlog
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: change-log
|
||||
path: src/BGR.Console
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
name: bgr v${{ steps.get-version.outputs.version }}
|
||||
tag_name: v${{ steps.get-version.outputs.version }}
|
||||
draft: false
|
||||
body_path: src/BGR.Console/CHANGELOG.md
|
||||
files: |
|
||||
dist/bgr_osx_x64
|
||||
dist/bgr_linux_x64
|
||||
dist/bgr_windows_x64.exe
|
||||
@@ -0,0 +1,95 @@
|
||||
name: Pull Request
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- "**/README.md"
|
||||
- "**/LICENSE.txt"
|
||||
- "**/.gitignore"
|
||||
- "**/.gitattributes"
|
||||
- "**/.editorconfig"
|
||||
- .github/**
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
format:
|
||||
name: Run dotnet format
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x.x
|
||||
- name: Format project
|
||||
run: dotnet format src --verbosity normal
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "<>"
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
git add .
|
||||
git commit -m "chore: format fixes [skip ci]"
|
||||
git fetch origin
|
||||
git pull --rebase origin ${{ github.head_ref }}
|
||||
git push origin HEAD:${{ github.head_ref }}
|
||||
fi
|
||||
test:
|
||||
name: Test
|
||||
needs: format
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-lts, windows-lts, macos-lts]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup .NET 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
- name: Install report generator
|
||||
run: dotnet tool install --global dotnet-reportgenerator-globaltool
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore src
|
||||
- name: Build on ${{ matrix.os }}
|
||||
run: dotnet build src --no-restore
|
||||
- name: Test on ${{ matrix.os }}
|
||||
run: dotnet test src --no-build --verbosity normal
|
||||
- name: Rename test coverage report
|
||||
run: mv src/BGR.Console.Tests/TestResults/Coverage/coverage.cobertura.xml src/BGR.Console.Tests/TestResults/Coverage/${{ matrix.os }}-coverage.cobertura.xml
|
||||
- name: Upload test coverage report for ${{ matrix.os }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-coverage-${{ matrix.os }}
|
||||
path: src/BGR.Console.Tests/TestResults/Coverage/${{ matrix.os }}-coverage.cobertura.xml
|
||||
upload_test_coverage:
|
||||
name: Upload Test Coverage
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Download ubuntu-lts report
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: test-coverage-ubuntu-lts
|
||||
path: ./coverage
|
||||
- name: Download windows-lts report
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: test-coverage-windows-lts
|
||||
path: ./coverage
|
||||
- name: Download macos-lts report
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: test-coverage-macos-lts
|
||||
path: ./coverage
|
||||
- name: Upload test coverage reports
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
@@ -0,0 +1,35 @@
|
||||
# BGR
|
||||
|
||||
This is a background removal app that uses machine learning models to remove the background from an image. The app is available for download as a single file executable [here](). The app can also be built from source using the [.NET SDK](https://dotnet.microsoft.com/download). If you'd like to read more about the idea and initial development behind the app you can read the blog post I wrote about it [here]().
|
||||
|
||||
## Usage
|
||||
|
||||
The app is meant to be run from the command line. For example:
|
||||
|
||||
```pwsh
|
||||
bgr /path/to/image.jpg --output /path/to/output.jpg
|
||||
```
|
||||
|
||||
You can find the full list of commands, arguments, and options using the `--help` option:
|
||||
|
||||
```pwsh
|
||||
bgr --help
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
#### Input Image
|
||||
|
||||

|
||||
|
||||
#### Output Image
|
||||
|
||||

|
||||
|
||||
## Issues
|
||||
|
||||
If you encounter any issues while using the app, please open an issue on the repository. If you have any suggestions or feature requests, feel free to open an issue as well.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you'd like to contribute to the project, feel free to fork the repository and submit a pull request. If you have any questions or suggestions, feel free to open an issue.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 915 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 382 KiB |
@@ -1,6 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>BGR.Console</AssemblyTitle>
|
||||
<Product>BGR.Console</Product>
|
||||
<Description>A command-line app for removing backgrounds from images.</Description>
|
||||
<Version>0.0.0</Version>
|
||||
<Authors>Stevan Freeborn</Authors>
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<SelfContained>true</SelfContained>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user