Skip to content

Commit

Permalink
Merge pull request #273 from stumpapp/develop
Browse files Browse the repository at this point in the history
Update main with latest develop
  • Loading branch information
aaronleopold committed Feb 17, 2024
2 parents bca5620 + a3f50bf commit 5162f0d
Show file tree
Hide file tree
Showing 56 changed files with 10,187 additions and 4,781 deletions.
121 changes: 1 addition & 120 deletions .github/workflows/nightly.yml
Expand Up @@ -17,7 +17,7 @@ env:
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}

jobs:
docker-build:
nightly-docker-build:
name: Build docker image
runs-on: [self-hosted]
steps:
Expand Down Expand Up @@ -47,122 +47,3 @@ jobs:
push: ${{ env.PUSH }}
platforms: ${{ env.PLATFORMS }}
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}

# TODO: build executables for apple(x86_64,darwin?),linux(x86_64,arm64?), and windows(x86_64)
# These should be uploaded to the nightly release as artifacts. Old artifacts should be deleted
# before uploading new ones.

build-web:
name: Bundle web app
runs-on: [self-hosted]
if: false # TODO: don't do that
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build web
uses: ./.github/actions/build-web

- name: Upload web build
uses: ./.github/actions/upload-artifact
with:
upload-name: webapp
upload-path: apps/web/dist

build-linux-server:
name: Compile server app (self-hosted linux)
needs: build-web
runs-on: [self-hosted]
if: false # TODO: don't do that
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build server
uses: ./.github/actions/build-server
with:
platform: 'linux'

- name: Upload stump server
uses: ./.github/actions/upload-artifact
with:
upload-name: stump_server-linux
upload-path: target/release/stump_server

build-server:
strategy:
fail-fast: true
matrix:
platform: [macos, windows]
name: Compile server app
needs: build-web
runs-on: ${{ matrix.platform }}
if: false # TODO: don't do that
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build server
uses: ./.github/actions/build-server
with:
platform: ${{ matrix.platform }}

- name: Upload stump server
uses: ./.github/actions/upload-artifact
with:
upload-name: stump_server-${{ matrix.platform }}
upload-path: target/release/stump_server

# build-linux-desktop:
# name: Compile desktop app (self-hosted linux)
# needs: build-web
# runs-on: [self-hosted]
# if: false # TODO: don't do that
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# - name: Build desktop
# uses: ./.github/actions/build-desktop
# with:
# platform: 'linux'

# - name: Upload desktop
# uses: ./.github/actions/upload-artifact
# with:
# upload-name: stump-desktop-linux
# upload-path: target/release/bundle

build-desktop:
strategy:
fail-fast: true
matrix:
platform: [macos, windows]
name: Compile desktop app
needs: build-web
runs-on: ${{ matrix.platform }}
if: false # TODO: don't do that
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build desktop
uses: ./.github/actions/build-desktop
with:
platform: ${{ matrix.platform }}

# https://github.com/tauri-apps/tauri-action
# - uses: tauri-apps/tauri-action@v0
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# tagName: stump-desktop-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
# releaseName: 'Stump Desktop v__VERSION__'
# releaseBody: 'See the assets to download this version and install.'
# releaseDraft: true
# prerelease: true

# - name: Upload desktop
# uses: ./.github/actions/upload-artifact
# with:
# upload-name: stump-desktop-${{ matrix.platform }}
# upload-path: target/release/bundle
128 changes: 128 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,128 @@
name: 'Release CI'

# This workflow triggers when a PR is merged into `main`, but jobs have conditions to only run when:
# - A PR is closed, merged into `main`, from a branch that matches the pattern `release/v*.*.*`

on:
pull_request:
branches:
- main
types: [opened, closed]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}

jobs:
parse-semver:
if: contains(github.event.pull_request.head.ref, 'release/v')
name: Parse semver version
runs-on: [self-hosted]
steps:
- name: Extract version from branch name
id: tag
run: echo "version=$(echo ${{ github.event.pull_request.head.ref }} | sed -e 's/release\/v//')" >> $GITHUB_ENV

- name: Print the tag
run: echo "The output version is ${{ steps.tag.outputs.version }}"

- name: Configure docker tags
run: |
echo "DOCKER_TAGS=latest,nightly,${{ steps.tag.outputs.version }}" >> $GITHUB_ENV
echo "Docker tags are latest, nightly, and ${{ steps.tag.outputs.version }}"
push-or-load:
if: contains(github.event.pull_request.head.ref, 'release/v')
name: Configure docker load/push
runs-on: [self-hosted]
steps:
- name: Configure environment
run: |
echo "load=${{ github.event.pull_request.merged == false }}" >> $GITHUB_OUTPUT
echo "push=${{ github.event.pull_request.merged == true }}" >> $GITHUB_OUTPUT
build-stable-docker:
if: contains(github.event.pull_request.head.ref, 'release/v')
name: Build docker image
runs-on: [self-hosted]
needs: [parse-semver, push-or-load]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build and push docker image
uses: ./.github/actions/build-docker
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
tags: ${{ env.DOCKER_TAGS }}
load: ${{ steps.push-or-load.outputs.load }}
push: ${{ steps.push-or-load.outputs.push }}
platforms: 'linux/arm64/v8,linux/amd64'
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}

# build-web-app:
# name: Build web app
# runs-on: [self-hosted]
# if: false # TODO: Enable this once 0.1.0 is ready
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# - name: Build the app
# uses: ./.github/actions/build-web

# - name: Upload the build
# uses: ./.github/actions/upload-artifact
# with:
# upload-name: webapp
# upload-path: apps/web/dist

# build-server:
# strategy:
# fail-fast: true
# matrix:
# platform: [macos, windows]
# name: Build server app
# needs: build-web
# runs-on: ${{ matrix.platform }}
# if: false # TODO: Enable this once 0.1.0 is ready
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# - name: Build the server
# uses: ./.github/actions/build-server
# with:
# platform: ${{ matrix.platform }}

# - name: Upload the server binary
# uses: ./.github/actions/upload-artifact
# with:
# upload-name: stump_server-${{ matrix.platform }}
# upload-path: target/release/stump_server

# # TODO: Investigate if I can just merge this with the above
# build-linux-server:
# name: Build server app (self-hosted runner)
# needs: build-web
# runs-on: [self-hosted]
# if: false # TODO: Enable this once 0.1.0 is ready
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# - name: Build the server
# uses: ./.github/actions/build-server
# with:
# platform: 'linux'

# - name: Upload the server binary
# uses: ./.github/actions/upload-artifact
# with:
# upload-name: stump_server-linux
# upload-path: target/release/stump_server
13 changes: 6 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion apps/server/src/routers/api/mod.rs
Expand Up @@ -19,7 +19,7 @@ mod tests {

use super::v1::{
auth::*, book_club::*, epub::*, job::*, library::*, media::*, metadata::*,
series::*, smart_list::*, user::*, ClaimResponse, StumpVersion,
series::*, smart_list::*, user::*, ClaimResponse, StumpVersion, UpdateCheck,
};

#[allow(dead_code)]
Expand Down Expand Up @@ -55,6 +55,7 @@ mod tests {
file.write_all(b"// SERVER TYPE GENERATION\n\n")?;

file.write_all(format!("{}\n\n", ts_export::<StumpVersion>()?).as_bytes())?;
file.write_all(format!("{}\n\n", ts_export::<UpdateCheck>()?).as_bytes())?;
file.write_all(
format!("{}\n\n", ts_export::<LoginOrRegisterArgs>()?).as_bytes(),
)?;
Expand Down

0 comments on commit 5162f0d

Please sign in to comment.