diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2206a5c..fdc4b3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ on: types: [created] jobs: - build: + build-with-peace: runs-on: ubuntu-latest steps: @@ -18,18 +18,18 @@ jobs: override: true - name: Build - run: cargo build --all --release + run: cargo build --features with_peace --release --bin pp-server-with-peace - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: | - target/release/peace + target/release/pp-server-with-peace env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - build-win: + build-with-peace-win: runs-on: windows-latest steps: @@ -44,12 +44,65 @@ jobs: override: true - name: Build - run: cargo build --release + run: cargo build --features with_peace --release --bin pp-server-with-peace - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: - files: target/release/peace.exe + files: | + target/release/pp-server-with-peace.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-without-db: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - name: Build + run: cargo build --no-default-features --features peace-objects/no_database --release --bin pp-server-without-db + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/pp-server-without-db env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-without-db-win: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - name: Build + run: cargo build --no-default-features --features peace-objects/no_database --release --bin pp-server-without-db + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/pp-server-without-db.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 39eb1eb..06b441a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,19 @@ [package] name = "pp-server" -version = "0.4.0" +version = "0.4.1" authors = ["Pure-Peace <940857703@qq.com>"] edition = "2018" license = "MIT" repository = "https://github.com/pure-peace/pp-server" +[[bin]] +name = "pp-server-with-peace" +path = "src/main.rs" + +[[bin]] +name = "pp-server-without-db" +path = "src/main.rs" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] # default = ["peace-objects/no_database"] # Not use peace database, run pp-server independently. @@ -51,7 +59,7 @@ tokio-postgres = { version = "0.7", features = ["with-chrono-0_4", "with-serde_j peace-performance = { git = "https://github.com/Pure-Peace/Peace-performance.git", branch = "main" } # Git -peace-constants = {git = "https://github.com/Pure-Peace/Peace.git", branch = "main" } +peace-constants = { git = "https://github.com/Pure-Peace/Peace.git", branch = "main" } peace-database = { git = "https://github.com/Pure-Peace/Peace.git", branch = "main", features = ["with_peace"], optional = true } peace-objects = { git = "https://github.com/Pure-Peace/Peace.git", branch = "main", features = ["osu_file_downloader"], optional = true } peace-settings = { git = "https://github.com/Pure-Peace/Peace.git", branch = "main" } diff --git a/src/objects/calculator.rs b/src/objects/calculator.rs index e3ae65d..064c88b 100644 --- a/src/objects/calculator.rs +++ b/src/objects/calculator.rs @@ -263,7 +263,6 @@ pub async fn get_beatmap_from_api( let expires = glob.local_config.data.beatmap_cache_timeout as i64; #[cfg(not(feature = "with_peace"))] let osu_api = &glob.osu_api; - let a = glob.database.get_ref(); peace_objects::beatmaps::Beatmap::get( request_md5, None, @@ -271,7 +270,7 @@ pub async fn get_beatmap_from_api( file_name, &osu_api, #[cfg(feature = "with_peace")] - a, + glob.database.get_ref(), true, &glob.caches.beatmap_cache, expires,