aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release.yml85
1 files changed, 85 insertions, 0 deletions
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