-
Notifications
You must be signed in to change notification settings - Fork 55
108 lines (93 loc) · 3.46 KB
/
build-workflow.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: build-workflow
on:
push:
branches: [ main ]
tags:
- "*"
workflow_dispatch:
inputs:
disable_cache:
description: Disable rust caching
type: boolean
required: false
default: false
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
build:
name: Build ${{ matrix.job.target }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-musl, cache: true }
- { target: aarch64-unknown-linux-musl, cache: true }
- { target: arm-unknown-linux-musleabihf, cache: true }
- { target: armv7-unknown-linux-musleabihf, cache: true }
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Retrieve MSRV from workspace Cargo.toml
id: rust_version
uses: SebRollen/[email protected]
with:
file: Cargo.toml
field: "workspace.package.rust-version"
- name: Enable toolchain via github action
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust_version.outputs.value }}
targets: ${{ matrix.job.target }}
- name: Enable cache
if: ${{ matrix.job.cache && !inputs.disable_cache }}
# https://github.com/marketplace/actions/rust-cache
uses: Swatinem/rust-cache@v2
- name: Build for ${{ matrix.job.target }}
run: bash -x ./ci/build_scripts/build.sh ${{ matrix.job.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.job.target }}
path: target/${{ matrix.job.target }}/debian/*.deb
- name: Upload binaries as tarball
# https://github.com/marketplace/actions/upload-a-build-artifact
uses: actions/upload-artifact@v3
with:
name: archive-${{ matrix.job.target }}
path: target/${{ matrix.job.target }}/*.tar.gz
publish:
name: Publish ${{ matrix.job.target }}
runs-on: ubuntu-20.04
needs: [build]
strategy:
matrix:
job:
- { target: x86_64-unknown-linux-musl, repo: tedge-main, component: main }
- { target: aarch64-unknown-linux-musl, repo: tedge-main, component: main }
# Keep arm-unknown-linux-musleabihf in separate repo due to armhf conflict between raspbian and debian
- { target: arm-unknown-linux-musleabihf, repo: tedge-main-armv6, component: main }
- { target: armv7-unknown-linux-musleabihf, repo: tedge-main, component: main }
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download release artifacts
uses: actions/download-artifact@v3
# https://github.com/marketplace/actions/download-a-build-artifact
with:
name: debian-packages-${{ matrix.job.target }}
path: target/${{ matrix.job.target }}/debian/
- name: Publish debian packages
env:
PUBLISH_OWNER: ${{ secrets.PUBLISH_OWNER }}
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: |
bash -x \
./ci/build_scripts/publish_debian.sh \
--path "target/${{ matrix.job.target }}/debian/" \
--repo "${{ matrix.job.repo }}" \
--component "${{ matrix.job.component }}"