-
Notifications
You must be signed in to change notification settings - Fork 172
148 lines (128 loc) · 6.16 KB
/
build.yaml
File metadata and controls
148 lines (128 loc) · 6.16 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Build
on:
workflow_call:
inputs:
disable_extra_builds:
type: boolean
disable_tests:
type: boolean
extra_packages:
type: string
runs_on:
default: ubuntu-latest
type: string
target:
required: true
type: string
toolchain:
default: stable
type: string
pin-incompatible-msrv-bump-dependencies:
default: false
type: boolean
continue-on-error:
default: false
type: boolean
env:
# While we could define these on a per-job basis, there's no harm in simply
# defining all environment variables for each job. This has the added benefit
# of keeping them all together in one place.
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_GNUEABI_LINKER: arm-linux-gnueabi-gcc
CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_MUSLEABI_LINKER: arm-linux-gnueabi-gcc
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER: arm-linux-gnueabi-gcc
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABI_LINKER: arm-linux-gnueabi-gcc
CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER: mips64el-linux-gnuabi64-gcc
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER: mips64-linux-gnuabi64-gcc
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER: mipsel-linux-gnu-gcc
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER: mipsel-linux-gnu-gcc
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER: mips-linux-gnu-gcc
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER: mips-linux-gnu-gcc
CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER: powerpc64le-linux-gnu-gcc
CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER: powerpc64-linux-gnu-gcc
CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER: powerpc-linux-gnu-gcc
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER: s390x-linux-gnu-gcc
# Pretty cargo output!
CARGO_TERM_COLOR: always
# Enable cross compilation for `pkg_config`.
PKG_CONFIG_ALLOW_CROSS: 1
# Deny warnings.
RUSTFLAGS: -D warnings
jobs:
build:
runs-on: ${{ inputs.runs_on }}
continue-on-error: ${{ inputs.continue-on-error }}
steps:
- name: Build | install dependencies
if: inputs.runs_on == 'ubuntu-latest'
run: |
sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list
sudo apt-get -qq update
sudo apt-get -qq -y install build-essential curl git pkg-config ${{ inputs.extra_packages }}
- name: Build | add mingw32 to path
if: inputs.runs_on == 'windows-2025'
shell: bash
run: |
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
- name: Build | checkout
uses: actions/checkout@v2
- name: Build | install toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ inputs.target }}
toolchain: ${{ inputs.toolchain }}
- name: Build | rust-cache
uses: Swatinem/rust-cache@v2
# Pin some dependencies (for building with MSRV 1.59.0) just here in CI
# and not via Cargo.toml. The latter would enforce them to all users
# and not just the ones who want to build with an old Rust release. See
# issue https://github.com/serialport/serialport-rs/issues/324.
#
# The command line arguments below are for Cargo 1.59.0. The have
# changed with newer releases and need to be adjusted when bumbing our
# MSRV.
- name: Build | pin some dependencies for building with MSRV
if: ${{ inputs.pin-incompatible-msrv-bump-dependencies == true }}
run: |
cargo update --precise 0.10.0 --package core-foundation
cargo update --precise 0.2.163 --package libc
cargo update --precise 1.0.101 --package proc-macro2
cargo update --precise 1.0.40 --package quote
cargo update --precise 1.0.22 --package unicode-ident
- name: Build | build library (default features)
run: cargo build --target=${{ inputs.target }}
- name: Build | build library (no default features)
run: cargo build --no-default-features --target=${{ inputs.target }}
- name: Build | build library (all features)
run: cargo build --all-features --target=${{ inputs.target }}
- name: Build | build examples (default features)
if: ${{ inputs.disable_extra_builds == false }}
run: cargo build --examples --target=${{ inputs.target }}
- name: Build | build examples (no default features)
if: ${{ inputs.disable_extra_builds == false }}
run: cargo build --no-default-features --examples --target=${{ inputs.target }}
- name: Build | build examples (all features)
if: ${{ inputs.disable_extra_builds == false }}
run: cargo build --examples --all-features --target=${{ inputs.target }}
- name: Build | build tests (default features)
if: ${{ inputs.disable_extra_builds == false }}
run: cargo build --tests --target=${{ inputs.target }}
- name: Build | run tests (default features)
if: ${{ inputs.disable_tests == false }}
run: cargo test --no-fail-fast --target=${{ inputs.target }}
- name: Build | build tests (no default features)
if: ${{ inputs.disable_extra_builds == false }}
run: cargo build --tests --no-default-features --target=${{ inputs.target }}
- name: Build | run tests (no default features)
if: ${{ inputs.disable_tests == false }}
run: cargo test --no-default-features --no-fail-fast --target=${{ inputs.target }}
- name: Build | build tests (selected features)
if: ${{ inputs.disable_extra_builds == false }}
run: cargo build --tests --features libudev,usbportinfo-interface --target=${{ inputs.target }}
- name: Build | run tests (selected features)
if: ${{ inputs.disable_tests == false }}
run: cargo test --no-fail-fast --features libudev,usbportinfo-interface --target=${{ inputs.target }}