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
**/dist
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
runtime: osx-x64
artifact: macos
outputs:
version: ${{ steps.gitversion.outputs.majorMinorPatch }}
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
@ -75,11 +78,23 @@ jobs:
*.zip
*.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:
name: Create windows release
runs-on: windows-latest
needs: build
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'tags') }}
env:
version: ${{ needs.build.outputs.version }}
steps:
- uses: actions/checkout@v1
- name: Download windows build
@ -96,7 +111,7 @@ jobs:
innosetup.exe /VERYSILENT /SUPPRESSMSGBOXES /Log=log.txt || (cat log.txt && exit 1)
- name: Create windows installer
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
with:
name: kyoo_windows_installer
@ -108,8 +123,8 @@ jobs:
needs: build
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'tags') }}
env:
description: "A media browser"
version: v0.0.1 #${{ github.ref }}
description: "A portable and vast media library solution."
version: ${{ needs.build.outputs.version }}
steps:
- uses: actions/checkout@v1
- name: Download linux build
@ -119,6 +134,7 @@ jobs:
path: artifact
- name: Unzip the published files.
run: mkdir dist && tar -C dist -xzf artifact/kyoo_linux.tar.gz
- name: Create the package structure
run: |
sudo mkdir -p pkg/usr/lib/
@ -140,17 +156,19 @@ jobs:
run: |
mkdir out
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
run: |
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
- uses: edlanglois/pkgbuild-action@v1
id: makepkg
with:
pkgdir: deployment
namcapDisable: true
- uses: actions/upload-artifact@v2
with:
name: kyoo_rpm
@ -164,7 +182,3 @@ jobs:
name: kyoo_arch
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
with:
submodules: recursive
fetch-depth: 0
- name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v2

View File

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

View File

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

View File

@ -12,6 +12,8 @@ RUN yarn install --frozen-lockfile
RUN yarn run build --configuration production
FROM mcr.microsoft.com/dotnet/sdk:6.0 as builder
WORKDIR /kyoo
COPY .git/ ./.git/
COPY . .
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>
pkgname=kyoo
pkgname=kyoo-bin
pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="A media browser."
pkgdesc="A portable and vast media library solution."
arch=("i686" "x86_64" "armv6h")
url="https://github.com/AnonymusRaccoon/Kyoo"
license=("GPLv3")
groups=()
depends=("dotnet-runtime>=5" "aspnet-runtime>=5" "ffmpeg")
makedepends=("dotnet-sdk>=5" "cmake" "gcc" "make" "npm" "git")
source=("git+https://github.com/AnonymusRaccoon/Kyoo" #tag=v${pkgver}
"kyoo.service"
"kyoo.sysusers"
"kyoo.tmpfiles")
sha256sums=("SKIP" "SKIP" "SKIP" "SKIP")
depends=("ffmpeg")
makedepends=()
# The output folder is needed but we can't use directory in the source array.
source=()
sha256sums=()
options=('staticlibs')
prepare() {
# 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
pkgver() {
echo $version # The version is available as an environment variable.
}
build() {
# cd "Kyoo-$pkgver"
cd "Kyoo"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
dotnet publish -c Release -o "$srcdir/output" Kyoo.Host.Console
cp -a "$srcdir/../output" "$srcdir"
}
package() {
mkdir -p "$pkgdir/usr/lib"
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"
cp -a "$srcdir/output/." "$pkgdir"
}

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]
AppId={{31A61284-7939-46BC-B584-D2279A6EEEE8}
AppName=Kyoo
AppVersion=1.0
AppVersion={#version}
AppPublisher=SDG
AppPublisherURL=https://github.com/AnonymusRaccoon/Kyoo
AppSupportURL=https://github.com/AnonymusRaccoon/Kyoo

View File

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

View File

@ -33,6 +33,10 @@
<ItemGroup>
<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 Condition="$(CheckCodingStyle) == true">

View File

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

View File

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