From ceda0a2188ac57ccdc39f1aa91aaed574ecec12d Mon Sep 17 00:00:00 2001 From: imlk Date: Wed, 18 Aug 2021 23:57:50 +0800 Subject: [PATCH] ci: upload binaries to release fix: fix workflow --- .github/workflows/publish.yml | 57 +++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 35 --------------------- 2 files changed, 57 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..12563c8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,57 @@ +name: Publish + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + cross-compile: + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + target: + - x86_64-unknown-linux-musl + - x86_64-unknown-linux-gnu + - x86_64-linux-android + - i686-unknown-linux-musl + - i686-unknown-linux-gnu + - i686-linux-android + - armv7-unknown-linux-musleabihf + - armv7-unknown-linux-gnueabihf + - arm-linux-androideabi + - aarch64-unknown-linux-musl + - aarch64-unknown-linux-gnu + - aarch64-linux-android + steps: + - uses: actions/checkout@v2 + - uses: davidB/rust-cargo-make@v1.6.0 + - name: Install cross + shell: bash + run: | + curl -L https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --to-stdout > ~/.cargo/bin/cross + chmod +x ~/.cargo/bin/cross + - name: Build proot-rs + shell: bash + run: | + USE_CROSS=true CARGO_BUILD_TARGET="${{ matrix.target }}" cargo make build --profile=production + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: proot-rs-${{ matrix.target }} + path: target/${{ matrix.target }}/release/proot-rs + - name: Compress binaries + # We only publish binaries when we create a tag + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + shell: bash + run: | + tar czvf proot-rs.tar.gz -C target/${{ matrix.target }}/release proot-rs + - name: Upload binaries to release + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: proot-rs.tar.gz + asset_name: proot-rs-$tag-${{ matrix.target }}.tar.gz + tag: ${{ github.ref }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cb1066e..8ebaede 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -84,38 +84,3 @@ jobs: shell: bash run: | PROOT_TEST_ROOTFS="$(pwd)/rootfs" bats -r tests - - cross-compile: - runs-on: ubuntu-latest - strategy: - matrix: - target: - - x86_64-unknown-linux-musl - - x86_64-unknown-linux-gnu - - x86_64-linux-android - - i686-unknown-linux-musl - - i686-unknown-linux-gnu - - i686-linux-android - - armv7-unknown-linux-musleabihf - - armv7-unknown-linux-gnueabihf - - arm-linux-androideabi - - aarch64-unknown-linux-musl - - aarch64-unknown-linux-gnu - - aarch64-linux-android - steps: - - uses: actions/checkout@v2 - - uses: davidB/rust-cargo-make@v1.6.0 - - name: Install cross - shell: bash - run: | - curl -L https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --to-stdout > ~/.cargo/bin/cross - chmod +x ~/.cargo/bin/cross - - name: Build proot-rs - shell: bash - run: | - USE_CROSS=true CARGO_BUILD_TARGET="${{ matrix.target }}" cargo make build - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: proot-rs-${{ matrix.target }} - path: target/${{ matrix.target }}/debug/proot-rs \ No newline at end of file