From 274c413f5a90252adbd9d0a7f1f2a8f914ec1707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 10 May 2021 15:39:50 +0900 Subject: [PATCH] Try building (but not packaging yet) binary releases. --- .github/workflows/release.yml | 85 +++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..73964ef6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: Release +on: + schedule: + - cron: '0 0 * * *' # midnight UTC + + push: + branches: + - release + +jobs: + dist: + name: Dist + runs-on: ${{ matrix.os }} + strategy: + matrix: + build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc] + include: + - build: linux + os: ubuntu-20.04 + rust: nightly + target: x86_64-unknown-linux-musl + - build: linux-arm + os: ubuntu-20.04 + rust: nightly + target: arm-unknown-linux-gnueabihf + - build: macos + os: macos-latest + rust: nightly + target: x86_64-apple-darwin + - build: win-msvc + os: windows-2019 + rust: nightly + target: x86_64-pc-windows-msvc + # - build: win-gnu + # os: windows-2019 + # rust: nightly-x86_64-gnu + # target: x86_64-pc-windows-gnu + # - build: win32-msvc + # os: windows-2019 + # rust: nightly + # target: i686-pc-windows-msvc + + steps: + - name: Checkout sources + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install ${{ matrix.rust }} toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + target: ${{ matrix.target }} + override: true + + - name: Build release binary + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --release --locked --target ${{ matrix.target }} + + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: test + args: --release --locked + + - name: Strip release binary (linux and macos) + if: matrix.build == 'linux' || matrix.build == 'macos' + run: strip "target/${{ matrix.target }}/release/rg" + + - name: Strip release binary (arm) + if: matrix.build == 'linux-arm' + run: | + docker run --rm -v \ + "$PWD/target:/target:Z" \ + rustembedded/cross:arm-unknown-linux-gnueabihf \ + arm-linux-gnueabihf-strip \ + /target/arm-unknown-linux-gnueabihf/release/rg + + # package + # upload to nightly release