summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 49000966dd20a581f677f06891aafc941dd1091a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release
on:
  # schedule:
  # - cron: '0 0 * * *' # midnight UTC

  push:
    # tags:
    ## - release

jobs:
  dist:
    name: Dist
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false # don't fail other jobs if one fails
      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