Skip to content

Commit

Permalink
fix(actions): build featureful and feature-less versions
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Sep 29, 2023
1 parent ca4011a commit 6f8aca0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
fail-fast: false
matrix:
platform: [windows-latest, ubuntu-latest, macos-latest]
feature: ["--no-default-features", "--all-features"]

steps:
- uses: oven-sh/setup-bun@v1
Expand All @@ -50,22 +51,22 @@ jobs:

- name: Build
if: matrix.platform != 'windows-latest'
run: bun run build:bun
run: cd ./frontend && bun run build && cd ../backend && cargo build --release ${{ matrix.feature }}

- name: Build (Windows)
if: matrix.platform == 'windows-latest'
run: npm run build
run: cd ./frontend && npm run build && cd ../backend && cargo build --release ${{ matrix.feature }}

- name: Upload
uses: actions/upload-artifact@v2
if: matrix.platform != 'windows-latest'
with:
name: procchi_${{ matrix.platform }}
name: procchi-${{ matrix.platform }}-${{ matrix.feature == '--no-default-features' && 'minimal' || 'all-features' }}
path: backend/target/release/procchi

- name: Upload (Windows)
uses: actions/upload-artifact@v2
if: matrix.platform == 'windows-latest'
with:
name: procchi_${{ matrix.platform }}
name: procchi-${{ matrix.platform }}-${{ matrix.feature == '--no-default-features' && 'minimal' || 'all-features' }}
path: backend/target/release/procchi.exe
5 changes: 4 additions & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
async-std = "1.12.0"
clap = { version = "4.3.21", features = ["derive"] }
include_dir = "0.7.3"
mcping = "0.2.0"
mcping = { version = "0.2.0", optional = true }
mime_guess = "2.0.4"
rpassword = "7.2.0"
serde = "1.0.188"
Expand All @@ -18,3 +18,6 @@ sha2 = "0.10.7"
sysinfo = "0.29.10"
tide = "0.16.0"
tide-http-auth = { git = "https://github.com/Atmelfan/tide-http-auth/", branch = "latest" }

[features]
plugins = ["dep:mcping"]
6 changes: 5 additions & 1 deletion backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ use std::{io::Write, path::Path};
use tide::utils::async_trait;
use tide_http_auth::{BasicAuthRequest, Storage};

#[cfg(feature = "plugins")]
use crate::plugins::parse_enable_plugins;

mod resource_watcher;
mod util;
mod plugins;
mod web;

#[cfg(feature = "plugins")]
mod plugins;

static FRONTEND_DIR: Dir = include_dir!("../frontend/dist");

#[derive(Clone)]
Expand Down Expand Up @@ -144,6 +147,7 @@ fn main() {
);

// Register plugins
#[cfg(feature = "plugins")]
parse_enable_plugins(&mut app, args.plugins.clone(), args.address.clone());

println!("Starting server on port {}...", args.port);
Expand Down

0 comments on commit 6f8aca0

Please sign in to comment.