From c15adcb58a7262749de637d899a93ee6936ac176 Mon Sep 17 00:00:00 2001 From: ckaznable Date: Tue, 23 May 2023 09:43:28 +0800 Subject: [PATCH 1/4] chore(ci): add github action --- .github/workflows/CI.yml | 101 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..96dff0c --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,101 @@ +name: CI + +on: + pull_request: + paths: + - 'src/**' + - 'Cargo.*' + - '.github/workflows/**' + push: + branches: + - master + tags: + - 'v*.*.*' + +jobs: + style: + name: Check Style + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: cargo fmt -- --check + run: cargo fmt --all -- --check + + test: + name: Test + needs: [style] + runs-on: ubuntu-latest + + strategy: + matrix: + build: [stable, beta, nightly] + include: + - build: nightly + benches: true + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.build || 'stable' }} + + - name: install whisper.cpp deps + run: sudo apt-get update && sudo apt-get install libclang-dev + + - name: Build debug + run: cargo build --locked + + - name: Test + run: cargo test --all-features + + - name: Test all benches + if: matrix.benches + run: cargo test --benches --all-features + + deploy-linux: + name: deploy-${{ matrix.target }} + permissions: + contents: write + needs: [test] + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64-unknown-linux-gnu] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Install Cross + run: cargo install cross + + - name: Build target + run: cross build --release --locked --target ${{ matrix.target }} + + - name: Package + shell: bash + run: | + #strip target/${{ matrix.target }}/release/poketex + cd target/${{ matrix.target }}/release + tar czvf ../../../poketex-${{ matrix.target }}.tar.gz poketex + cd - + + - name: Publish + uses: softprops/action-gh-release@v1 + with: + files: 'poketex*' From fe807d6b852567ac70b93815c05a17e0408e7edc Mon Sep 17 00:00:00 2001 From: ckaznable Date: Tue, 23 May 2023 09:45:05 +0800 Subject: [PATCH 2/4] chore(ci): fix ci script --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 96dff0c..85e1bc3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -50,7 +50,7 @@ jobs: toolchain: ${{ matrix.build || 'stable' }} - name: install whisper.cpp deps - run: sudo apt-get update && sudo apt-get install libclang-dev + run: sudo apt-get update && sudo apt-get install libclang-dev -y - name: Build debug run: cargo build --locked From 608169f06b9dd59dde4dcf2b99bc19db27e8aea2 Mon Sep 17 00:00:00 2001 From: ckaznable Date: Tue, 23 May 2023 09:46:22 +0800 Subject: [PATCH 3/4] chore(ci): fix publish script --- .github/workflows/CI.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 85e1bc3..3d4956c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -90,12 +90,12 @@ jobs: - name: Package shell: bash run: | - #strip target/${{ matrix.target }}/release/poketex + #strip target/${{ matrix.target }}/release/yt-cli-live cd target/${{ matrix.target }}/release - tar czvf ../../../poketex-${{ matrix.target }}.tar.gz poketex + tar czvf ../../../yt-cli-live-${{ matrix.target }}.tar.gz yt-cli-live cd - - name: Publish uses: softprops/action-gh-release@v1 with: - files: 'poketex*' + files: 'yt-cli-live*' From 49c7b58d6da6d72afd679265e7a18b4a2120928f Mon Sep 17 00:00:00 2001 From: ckaznable Date: Tue, 23 May 2023 09:46:57 +0800 Subject: [PATCH 4/4] chore(ci): fix publish script --- .github/workflows/CI.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3d4956c..2d35f67 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -84,6 +84,9 @@ jobs: - name: Install Cross run: cargo install cross + - name: install whisper.cpp deps + run: sudo apt-get update && sudo apt-get install libclang-dev -y + - name: Build target run: cross build --release --locked --target ${{ matrix.target }}