Merge pull request #116 from AnonymusRaccoon/feat/gitversion

This commit is contained in:
Zoe Roux 2022-05-13 18:47:55 +02:00 committed by GitHub
commit dc8152dfaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 75 additions and 123 deletions

View File

@ -1,4 +1,3 @@
.git
**/build **/build
**/dist **/dist
src/Kyoo.WebApp/Front/nodes_modules src/Kyoo.WebApp/Front/nodes_modules

View File

@ -1,20 +0,0 @@
---
name: Bug Report
about: Create a bug report to help improve Kyoo
title: "[BUG] "
labels: bug
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1.
**Expected Behavior**
A clear and concise description of what you expected to happen.
**Environment:**
- Platform [e.g. Windows / Linux]
- Action Version [e.g. v0.0.1 or a git commit's SHA]

7
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,7 @@
name: Bug Report
description: Create a bug report to help improve Kyoo
labels: [bug]
body:
- type: input
attributes:
label: "Kyoo's version"

View File

@ -1,18 +0,0 @@
---
name: Feature Request
about: Suggest a new feature for Kyoo (don't forget to check projects first)
title: "[FEATURE] "
labels: enhancement
---
**Is your feature request related to a problem? If yes, please describe.**
A clear and concise description of what the problem is.
**Describe the feature you'd like**
A clear and concise description of what you want Kyoo to have.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -0,0 +1,3 @@
name: Feature Request
description: Suggest a new feature for Kyoo (don't forget to check projects first)
labels: [enhancement]

View File

@ -1,20 +0,0 @@
## Proposed changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue.
## Information
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] New public API added
- [ ] Non-breaking changes
## Checklist
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
## Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did
and what alternatives you considered, etc...

View File

@ -19,10 +19,13 @@ jobs:
- os: macOS-latest - os: macOS-latest
runtime: osx-x64 runtime: osx-x64
artifact: macos artifact: macos
outputs:
version: ${{ steps.gitversion.outputs.majorMinorPatch }}
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
with: with:
submodules: recursive submodules: recursive
fetch-depth: 0
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
@ -75,11 +78,23 @@ jobs:
*.zip *.zip
*.tar.gz *.tar.gz
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.13
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.13
with:
useConfigFile: true
windows_release: windows_release:
name: Create windows release name: Create windows release
runs-on: windows-latest runs-on: windows-latest
needs: build needs: build
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'tags') }} if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'tags') }}
env:
version: ${{ needs.build.outputs.version }}
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Download windows build - name: Download windows build
@ -96,7 +111,7 @@ jobs:
innosetup.exe /VERYSILENT /SUPPRESSMSGBOXES /Log=log.txt || (cat log.txt && exit 1) innosetup.exe /VERYSILENT /SUPPRESSMSGBOXES /Log=log.txt || (cat log.txt && exit 1)
- name: Create windows installer - name: Create windows installer
shell: bash shell: bash
run: iscc -Dkyoo=$(realpath dist_win) -O./ -Fkyoo-windows deployment/kyoo-windows.iss run: iscc -Dkyoo=$(realpath dist_win) -Dversion=${version} -O./ -Fkyoo-windows deployment/kyoo-windows.iss
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: kyoo_windows_installer name: kyoo_windows_installer
@ -108,8 +123,8 @@ jobs:
needs: build needs: build
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'tags') }} if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'tags') }}
env: env:
description: "A media browser" description: "A portable and vast media library solution."
version: v0.0.1 #${{ github.ref }} version: ${{ needs.build.outputs.version }}
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Download linux build - name: Download linux build
@ -119,6 +134,7 @@ jobs:
path: artifact path: artifact
- name: Unzip the published files. - name: Unzip the published files.
run: mkdir dist && tar -C dist -xzf artifact/kyoo_linux.tar.gz run: mkdir dist && tar -C dist -xzf artifact/kyoo_linux.tar.gz
- name: Create the package structure - name: Create the package structure
run: | run: |
sudo mkdir -p pkg/usr/lib/ sudo mkdir -p pkg/usr/lib/
@ -140,17 +156,19 @@ jobs:
run: | run: |
mkdir out mkdir out
sudo rm -rf pkg/DEBIAN sudo rm -rf pkg/DEBIAN
rpmbuild -bb --buildroot $(pwd)/out --build-in-place --define "_rpmdir $(pwd)/rpm" deployment/kyoo.spec rpmbuild -bb --buildroot $(pwd)/out --build-in-place --define "_rpmdir $(pwd)/rpm" --define "version_ ${version}" deployment/kyoo.spec
- name: Prepare arch package - name: Prepare arch package
run: | run: |
mkdir deployment/output mkdir deployment/output
mv deployment/PKGBUILD.github deployment/PKGBUILD sed -i s/\$version/${version}/ deployment/PKGBUILD #doing the substitution here since the pkgbuild is run in a docker without env
cp -a pkg/usr deployment/output/usr cp -a pkg/usr deployment/output/usr
- uses: edlanglois/pkgbuild-action@v1 - uses: edlanglois/pkgbuild-action@v1
id: makepkg id: makepkg
with: with:
pkgdir: deployment pkgdir: deployment
namcapDisable: true namcapDisable: true
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: kyoo_rpm name: kyoo_rpm
@ -164,7 +182,3 @@ jobs:
name: kyoo_arch name: kyoo_arch
path: ${{steps.makepkg.outputs.pkgfile0}} path: ${{steps.makepkg.outputs.pkgfile0}}
# new-version:
# if: startsWith(github.ref, 'refs/tags/v')
# runs-on: ubuntu-latest

View File

@ -9,6 +9,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
fetch-depth: 0
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: crazy-max/ghaction-docker-meta@v2 uses: crazy-max/ghaction-docker-meta@v2

View File

@ -9,6 +9,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
fetch-depth: 0
- name: Build the app - name: Build the app
run: docker-compose build run: docker-compose build

View File

@ -19,6 +19,8 @@ jobs:
--health-retries 5 --health-retries 5
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore
- name: Build - name: Build

View File

@ -12,6 +12,8 @@ RUN yarn install --frozen-lockfile
RUN yarn run build --configuration production RUN yarn run build --configuration production
FROM mcr.microsoft.com/dotnet/sdk:6.0 as builder FROM mcr.microsoft.com/dotnet/sdk:6.0 as builder
WORKDIR /kyoo
COPY .git/ ./.git/
COPY . . COPY . .
RUN dotnet publish -c Release -o /opt/kyoo '-p:SkipWebApp=true;SkipTranscoder=true;CheckCodingStyle=false' src/Kyoo.Host.Console RUN dotnet publish -c Release -o /opt/kyoo '-p:SkipWebApp=true;SkipTranscoder=true;CheckCodingStyle=false' src/Kyoo.Host.Console

5
GitVersion.yml Normal file
View File

@ -0,0 +1,5 @@
mode: Mainline
branches: {}
ignore:
sha: []
merge-message-formats: {}

View File

@ -1,41 +1,28 @@
# Maintainer: Zoe Roux <zoe.roux@sdg.moe> # Maintainer: Zoe Roux <zoe.roux@sdg.moe>
pkgname=kyoo pkgname=kyoo-bin
pkgver=1.0.0 pkgver=1.0.0
pkgrel=1 pkgrel=1
epoch= epoch=
pkgdesc="A media browser." pkgdesc="A portable and vast media library solution."
arch=("i686" "x86_64" "armv6h") arch=("i686" "x86_64" "armv6h")
url="https://github.com/AnonymusRaccoon/Kyoo" url="https://github.com/AnonymusRaccoon/Kyoo"
license=("GPLv3") license=("GPLv3")
groups=() groups=()
depends=("dotnet-runtime>=5" "aspnet-runtime>=5" "ffmpeg") depends=("ffmpeg")
makedepends=("dotnet-sdk>=5" "cmake" "gcc" "make" "npm" "git") makedepends=()
source=("git+https://github.com/AnonymusRaccoon/Kyoo" #tag=v${pkgver} # The output folder is needed but we can't use directory in the source array.
"kyoo.service" source=()
"kyoo.sysusers" sha256sums=()
"kyoo.tmpfiles") options=('staticlibs')
sha256sums=("SKIP" "SKIP" "SKIP" "SKIP")
pkgver() {
prepare() { echo $version # The version is available as an environment variable.
# cd "Kyoo-$pkgver"
cd "Kyoo"
# This is necessary since submodules paths are relative and PKGBUILD remote are the local directory.
git remote set-url origin https://github.com/AnonymusRaccoon/Kyoo
git submodule update --init --recursive
} }
build() { build() {
# cd "Kyoo-$pkgver" cp -a "$srcdir/../output" "$srcdir"
cd "Kyoo"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
dotnet publish -c Release -o "$srcdir/output" Kyoo.Host.Console
} }
package() { package() {
mkdir -p "$pkgdir/usr/lib" cp -a "$srcdir/output/." "$pkgdir"
cp -r --no-preserve ownership "$srcdir/output" "$pkgdir/usr/lib/kyoo"
install -Dm 644 kyoo.service -t "$pkgdir/usr/lib/systemd/system/"
install -Dm 644 kyoo.sysusers "$pkgdir/usr/lib/sysusers.d/kyoo.conf"
install -Dm 644 kyoo.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/kyoo.conf"
} }

View File

@ -1,24 +0,0 @@
# Maintainer: Zoe Roux <zoe.roux@sdg.moe>
pkgname=kyoo-bin
pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="A media browser."
arch=("i686" "x86_64" "armv6h")
url="https://github.com/AnonymusRaccoon/Kyoo"
license=("GPLv3")
groups=()
depends=("ffmpeg")
makedepends=()
# The output folder is needed but we can't use directory in the source array.
source=()
sha256sums=()
options=('staticlibs')
build() {
cp -a "$srcdir/../output" "$srcdir"
}
package() {
cp -a "$srcdir/output/." "$pkgdir"
}

View File

@ -1,7 +1,7 @@
[Setup] [Setup]
AppId={{31A61284-7939-46BC-B584-D2279A6EEEE8} AppId={{31A61284-7939-46BC-B584-D2279A6EEEE8}
AppName=Kyoo AppName=Kyoo
AppVersion=1.0 AppVersion={#version}
AppPublisher=SDG AppPublisher=SDG
AppPublisherURL=https://github.com/AnonymusRaccoon/Kyoo AppPublisherURL=https://github.com/AnonymusRaccoon/Kyoo
AppSupportURL=https://github.com/AnonymusRaccoon/Kyoo AppSupportURL=https://github.com/AnonymusRaccoon/Kyoo

View File

@ -1,9 +1,9 @@
%define _build_id_links none %define _build_id_links none
Name: kyoo Name: kyoo
Version: 0.0.1 Version: %{version_}
Release: 1 Release: 1%{?dist}
Summary: A media browser Summary: A portable and vast media library solution.
URL: https://github.com/AnonymusRaccoon/Kyoo URL: https://github.com/AnonymusRaccoon/Kyoo
License: GPL-3.0 License: GPL-3.0
BuildArch: x86_64 BuildArch: x86_64

View File

@ -33,6 +33,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02" PrivateAssets="All" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-20204-02" PrivateAssets="All" />
<PackageReference Include="GitVersion.MsBuild" Version="5.10.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup Condition="$(CheckCodingStyle) == true"> <ItemGroup Condition="$(CheckCodingStyle) == true">

View File

@ -36,7 +36,7 @@ namespace Kyoo.Database
{ {
static string ToDbProperty(string key) static string ToDbProperty(string key)
{ {
return key switch return key.ToUpperInvariant() switch
{ {
"USER" => "USER ID", "USER" => "USER ID",
_ => key _ => key

View File

@ -19,6 +19,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Autofac; using Autofac;
@ -44,7 +45,7 @@ namespace Kyoo.Host.Generic
/// Hosts of kyoo (main functions) generally only create a new <see cref="Application"/> /// Hosts of kyoo (main functions) generally only create a new <see cref="Application"/>
/// and return <see cref="Start(string[])"/>. /// and return <see cref="Start(string[])"/>.
/// </summary> /// </summary>
public class Application : IApplication public class Application : IApplication, IDisposable
{ {
/// <summary> /// <summary>
/// The environment in witch Kyoo will run (ether "Production" or "Development"). /// The environment in witch Kyoo will run (ether "Production" or "Development").
@ -202,6 +203,7 @@ namespace Kyoo.Host.Generic
try try
{ {
_logger.Information("Running as {Name}", Environment.UserName); _logger.Information("Running as {Name}", Environment.UserName);
_logger.Information("Version: {Version}", Assembly.GetExecutingAssembly().GetName().Version.ToString(3));
_logger.Information("Data directory: {DataDirectory}", GetDataDirectory()); _logger.Information("Data directory: {DataDirectory}", GetDataDirectory());
await host.RunAsync(cancellationToken); await host.RunAsync(cancellationToken);
} }
@ -309,5 +311,12 @@ namespace Kyoo.Host.Generic
.Enrich.WithThreadId() .Enrich.WithThreadId()
.Enrich.FromLogContext(); .Enrich.FromLogContext();
} }
/// <inheritdoc/>
public void Dispose()
{
_tokenSource.Dispose();
GC.SuppressFinalize(this);
}
} }
} }