summaryrefslogtreecommitdiffstats
path: root/.github/workflows/build-workflow.yml
blob: f1ff16aa63aae802f128f0687041f4acbe682f99 (plain)
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
87
88
name: build-workflow

on:
  push:
    branches: [ main, 'release-*' ]
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -D warnings

jobs:
  build-amd64:
    name: Build for amd64
    runs-on: Ubuntu-20.04

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Enable toolchain via github action
        uses: dtolnay/rust-toolchain@1.63.0

      - name: Enable cache
        # https://github.com/marketplace/actions/rust-cache
        uses: Swatinem/rust-cache@v1

      - name: Build packages for amd64
        run: ./ci/build_scripts/build_for_amd64.sh

      - name: Upload artifacts as zip
        # https://github.com/marketplace/actions/upload-a-build-artifact
        uses: actions/upload-artifact@v3
        with:
          name: debian-packages-amd64
          path: target/debian/*.deb

  build-arm-matrix:
    name: Build for ${{ matrix.target }}
    runs-on: Ubuntu-20.04
    strategy:
      matrix:
        # Add only arm targets here as we use a custom strip binary!
        target:
          [
            aarch64-unknown-linux-gnu,
            aarch64-unknown-linux-musl,
            arm-unknown-linux-gnueabihf,
            armv7-unknown-linux-gnueabihf,
            armv7-unknown-linux-musleabihf,
          ]

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Enable toolchain via github action
        uses: dtolnay/rust-toolchain@1.63.0
        with:
          targets: ${{ matrix.target }}

      - name: Enable cache
        # https://github.com/marketplace/actions/rust-cache
        uses: Swatinem/rust-cache@v1

      - name: Build for ${{ matrix.target }}
        run: ./ci/build_scripts/build_for_arm.sh ${{ matrix.target }}

      - name: Upload debian packages as zip
        # https://github.com/marketplace/actions/upload-a-build-artifact
        uses: actions/upload-artifact@v3
        with:
          name: debian-packages-${{ matrix.target }}
          path: target/${{ matrix.target }}/debian/*.deb

      - name: Upload sawtooth publisher as zip
        # https://github.com/marketplace/actions/upload-a-build-artifact
        uses: actions/upload-artifact@v3
        with:
          name: sawtooth_publisher_${{ matrix.target }}
          path: target/${{ matrix.target }}/release/sawtooth_publisher

      - name: Upload dummy-plugin as zip
        # https://github.com/marketplace/actions/upload-a-build-artifact
        uses: actions/upload-artifact@v3
        with:
          name: tedge_dummy_plugin_${{ matrix.target }}
          path: target/${{ matrix.target }}/release/tedge_dummy_plugin