Skip to content

Commit

Permalink
fixed: build release with github action (8xFF#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
giangndm authored Jul 12, 2024
1 parent 9ae17cb commit 31b6f4d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 11 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
target: x86_64-unknown-linux-gnu
extension: ""
cross: false
build_record_tool: true
- build: linux musl x64
os: ubuntu-latest
rust: stable
Expand Down Expand Up @@ -156,12 +157,14 @@ jobs:
target: x86_64-apple-darwin
extension: ""
cross: false
build_record_tool: true
- build: macos aarch64
os: macos-latest
rust: stable
target: aarch64-apple-darwin
extension: ""
cross: true
build_record_tool: true
# - build: windows gnu x64
# os: ubuntu-latest
# rust: stable
Expand Down Expand Up @@ -201,25 +204,40 @@ jobs:
run: |
mv ./.cargo/config.toml.release-build .cargo/config.toml
- name: Build
- name: Build server
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --verbose --release --package ${{ env.APP_NAME }} --target ${{ matrix.target }} --features embed_static

- name: Rename file
- name: Build record tool
if: matrix.build_record_tool
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --verbose --release --package media-server-record --target ${{ matrix.target }} --bin convert_webm

- name: Rename server
if: ${{ matrix.build != 'windows gnu x64' && matrix.build != 'windows msvc x64' }}
run: mv ./target/${{ matrix.target }}/release/${{ env.APP_NAME }}${{ matrix.extension }} ${{ env.APP_NAME }}-${{ matrix.target }}${{ matrix.extension }}
run: |
mv ./target/${{ matrix.target }}/release/${{ env.APP_NAME }}${{ matrix.extension }} ${{ env.APP_NAME }}-${{ matrix.target }}${{ matrix.extension }}
- name: Rename record
if: ${{ matrix.build_record_tool && matrix.build != 'windows gnu x64' && matrix.build != 'windows msvc x64' }}
run: |
mv ./target/${{ matrix.target }}/release/convert_webm${{ matrix.extension }} convert_webm-${{ matrix.target }}${{ matrix.extension }}
- name: Upload Artifact to Summary
if: ${{ matrix.build != 'windows gnu x64' && matrix.build != 'windows msvc x64' }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ env.APP_NAME }}-${{ matrix.target }}${{ matrix.extension }}
path: |
*-${{ matrix.target }}${{ matrix.extension }}
- name: Upload binaries to release
- name: Upload server binarie to release
if: startsWith(github.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
Expand All @@ -229,6 +247,16 @@ jobs:
tag: ${{ github.ref }}
overwrite: true

- name: Upload record_tool binarie to release
if: startsWith(github.ref, 'refs/tags/') && matrix.build_record_tool
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: convert_webm-${{ matrix.target }}${{ matrix.extension }}
asset_name: convert_webm-${{ matrix.target }}${{ matrix.extension }}
tag: ${{ github.ref }}
overwrite: true

create-release:
# only run if not a tags build
if: startsWith(github.ref, 'refs/tags/') == false
Expand Down
2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ media-server-secure = { path = "../packages/media_secure" }
media-server-runner = { path = "../packages/media_runner", optional = true }
media-server-gateway = { path = "../packages/media_gateway", optional = true }
media-server-connector = { path = "../packages/media_connector", optional = true }
media-server-record = { path = "../packages/media_record", optional = true }
media-server-record = { path = "../packages/media_record", default-features=false, optional = true }
media-server-utils = { path = "../packages/media_utils", optional = true }
local-ip-address = "0.6"
serde = { version = "1.0", features = ["derive"] }
Expand Down
10 changes: 5 additions & 5 deletions packages/media_record/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ futures = "0.3.30"
bytes = "1.6.0"
surf = "2.3.2"
tracing-subscriber = { workspace = true, optional = true }
webm = "1.1.2"
rtp = "0.11.0"
clap = { version = "4.5", features = ["env", "derive"] }
serde = { version = "1.0", features = ["derive"] }
webm = { version = "1.1.2", optional = true }
rtp = { version = "0.11.0", optional = true }
clap = { version = "4.5", features = ["env", "derive"], optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }

[features]
default = ["convert_webm"]
convert_webm = ["tokio/full", "tracing-subscriber"]
convert_webm = ["tokio/full", "tracing-subscriber", "webm", "rtp", "clap", "serde"]

[dev-dependencies]
tokio = { version = "1", features = ["full"] }
Expand Down
2 changes: 2 additions & 0 deletions packages/media_record/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ use storage::{memory::MemoryFile, FileId, RecordFile};
use tokio::sync::mpsc::Sender;
use worker::UploadWorker;

#[cfg(feature="convert_webm")]
mod media;
mod raw_record;
mod session;
mod storage;
mod worker;

#[cfg(feature="convert_webm")]
pub use media::*;
pub use raw_record::*;

Expand Down

0 comments on commit 31b6f4d

Please sign in to comment.