From 172c7aa4a527991372b16f45260aaeb3698abf6a Mon Sep 17 00:00:00 2001 From: liulifox233 Date: Thu, 28 Nov 2024 19:49:10 +0800 Subject: [PATCH] add ci --- .github/workflows/check.yml | 23 +++++++++++++++++++++++ src/lib.rs | 6 +----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..60d314d --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,23 @@ +name: Check + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + MEDIA_USER_TOKEN: ${{ secrets.MEDIA_USER_TOKEN }} + +jobs: + check: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Check + run: cargo check --verbose + - name: Run tests + run: cargo test --verbose diff --git a/src/lib.rs b/src/lib.rs index 4ecaa17..dfeb629 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -269,11 +269,7 @@ mod tests { #[tokio::test] async fn test_apple_music() { - let args: Vec = std::env::args().collect(); - let media_user_token = args - .get(2) - .expect("MEDIA_USER_TOKEN not provided") - .to_string(); + let media_user_token = std::env::var("MEDIA_USER_TOKEN").unwrap(); let apple_music_downloader = AppleMusicDownloader::new_with_media_user_token(&media_user_token) .await