-
Notifications
You must be signed in to change notification settings - Fork 25
141 lines (117 loc) · 3.36 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
name: Build
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
defaults:
run:
shell: bash
env:
# Cache issues can sometimes be fixed by incrementing this value.
CACHE_KEY: 6
jobs:
all:
name: All
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{matrix.os}}
env:
RUSTFLAGS: --deny warnings
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: Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ env.CACHE_KEY }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust Toolchain Components
uses: actions-rs/toolchain@v1
with:
components: clippy, rustfmt
override: true
toolchain: 1.56.0
- 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.os == 'macos-latest'
run: |
brew install ripgrep
./bin/lint
- name: Check Formatting
run: cargo fmt --all -- --check
- name: Check Generated
if: matrix.os == 'macos-latest'
run: |
brew install help2man
cargo run --package gen -- --bin target/debug/imdl all --no-changelog
git diff --no-ext-diff --exit-code
- name: Install `mdbook`
if: matrix.os != 'windows-latest'
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: latest
- name: Build Book
if: matrix.os != 'windows-latest'
run: |
cargo run --package gen -- --bin target/debug/imdl book --no-changelog
mdbook build book --dest-dir ../www/book
- name: Record Git Revision
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest'
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 == 'ubuntu-latest'
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_branch: gh-pages
publish_dir: ./www
- name: Package
id: package
if: startsWith(github.ref, 'refs/tags/')
run: ./bin/package ${{github.ref}} ${{matrix.os}} ${{matrix.target}}
- 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}}