-
Notifications
You must be signed in to change notification settings - Fork 25
175 lines (149 loc) · 4.73 KB
/
build.yaml
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Build
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
defaults:
run:
shell: bash
env:
RUSTFLAGS: --deny warnings
jobs:
all:
name: All
strategy:
matrix:
target:
- aarch64-apple-darwin
- aarch64-pc-windows-msvc
- aarch64-unknown-linux-musl
- arm-unknown-linux-musleabihf
- armv7-unknown-linux-musleabihf
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
- x86_64-unknown-linux-musl
include:
- target: aarch64-apple-darwin
os: macos-latest
target_rustflags: ''
- target: aarch64-pc-windows-msvc
os: windows-latest
target_rustflags: ''
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc'
- target: arm-unknown-linux-musleabihf
os: ubuntu-latest
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc'
- target: armv7-unknown-linux-musleabihf
os: ubuntu-latest
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc'
- target: x86_64-apple-darwin
os: macos-latest
target_rustflags: ''
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
target_rustflags: ''
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# An issue with BSD Tar causes sporadic failures on macOS.
# c.f https://github.com/actions/cache/issues/403
- name: Install GNU Tar
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo /usr/local/opt/gnu-tar/libexec/gnubin > $GITHUB_PATH
- name: Install Rust Toolchain Components
uses: actions-rs/toolchain@v1
with:
components: clippy, rustfmt
override: true
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Info
run: |
rustup --version
cargo --version
cargo clippy --version
- name: Build
run: cargo build --all
- name: Test
run: cargo test --all
- name: Clippy
run: cargo clippy --all-targets --all-features
- name: Lint
if: matrix.target == 'x86_64-apple-darwin'
run: |
brew install ripgrep
./bin/lint
- name: Check Formatting
run: cargo fmt --all -- --check
- name: Check Generated
if: matrix.target == 'x86_64-apple-darwin'
run: |
brew install help2man
cargo run --package gen -- --bin target/debug/imdl all
git diff --no-ext-diff --exit-code
- name: Install `mdbook`
if: matrix.os != 'windows-latest'
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: 0.4.40
- name: Build Book
if: matrix.os != 'windows-latest'
run: |
cargo run --package gen -- --bin target/debug/imdl book
mdbook build book --dest-dir ../www/book
- name: Record Git Revision
if: github.ref == 'refs/heads/master' && matrix.os == 'x86_64-unknown-linux-musl'
run: git rev-parse --verify HEAD > www/head.txt
- name: Deploy Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master' && matrix.os == 'x86_64-unknown-linux-musl'
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_branch: gh-pages
publish_dir: ./www
- name: Install AArch64 Toolchain
if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }}
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu libc6-dev-i386
- name: Install ARM Toolchain
if: ${{ matrix.target == 'arm-unknown-linux-musleabihf' || matrix.target == 'armv7-unknown-linux-musleabihf' }}
run: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
- name: Install AArch64 Toolchain (Windows)
if: ${{ matrix.target == 'aarch64-pc-windows-msvc' }}
run: |
rustup target add aarch64-pc-windows-msvc
- name: Package
id: package
if: startsWith(github.ref, 'refs/tags/')
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
OS: ${{ matrix.os }}
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }}
run: ./bin/package
- name: Publish Release Archive
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
files: ${{steps.package.outputs.archive}}
prerelease: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}