-
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (132 loc) · 4.61 KB
/
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
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
name: ci
on:
- push
- pull_request
jobs:
create_draft_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_draft_release.outputs.upload_url }}
steps:
- name: Create draft release on tags
id: create_draft_release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
build:
needs: create_draft_release
strategy:
fail-fast: false
matrix:
include:
# macos targets
- target: x86_64-apple-darwin
os: macos-latest
rust_toolchain: stable
- target: aarch64-apple-darwin
os: macos-latest
rust_toolchain: stable
- target: aarch64-apple-ios
os: macos-latest
rust_toolchain: stable
# linux builds
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
rust_toolchain: stable
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
rust_toolchain: stable
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
rust_toolchain: stable
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
rust_toolchain: stable
# windows builds
- target: x86_64-pc-windows-gnu
os: windows-latest
rust_toolchain: stable
- target: x86_64-pc-windows-msvc
os: windows-latest
rust_toolchain: stable
env:
OS: ${{ matrix.os }}
RUST_TOOLCHAIN: ${{ matrix.rust_toolchain }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch tags
id: tag
run: git fetch --tags --force
- name: Cached Infra
uses: actions/cache@v2
env:
cache-name: cached-cargo
with:
path: |
~/.cargo
target
C:\cygwin
key: v${{ secrets.CACHE_VERSION }}-${{ matrix.os }}-${{ matrix.target }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
v${{ secrets.CACHE_VERSION }}-${{ matrix.os }}-${{ matrix.target }}-${{ env.cache-name }}-
v${{ secrets.CACHE_VERSION }}-${{ matrix.os }}-${{ matrix.target }}-
- name: Use Rust (stable)
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_toolchain }}
target: ${{ matrix.target }}
- name: Set git user
run: |
git config --global user.name github-actions
git config --global user.email github-actions-bot@users.noreply.github.com
- name: Define env (Unix)
if: ${{ runner.os != 'Windows' }}
run: echo "GITHUB_TAG=$(git describe --always --tags)" >> $GITHUB_ENV
- name: Define env (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
echo "GITHUB_TAG=$(git describe --always --tags)" >> $Env:GITHUB_ENV
- name: Setup Rust environment
run: make setup
- name: Build project
run: make clean build
- name: Run tests
run: make test
- name: Run integration tests on Linux
if: ${{ success() && startsWith(runner.os, 'Linux') }}
run: make test.integration
- name: Check code formatting
if: ${{ success() && startsWith(runner.os, 'Linux') }}
run: make fmt
- name: Create release archive (Windows)
if: ${{ success() && runner.os == 'Windows' }}
run: make release.win
- name: Create release archive (Unix)
if: ${{ success() && runner.os != 'Windows' }}
run: make release
- name: Upload Lore build artifact
if: ${{ success() }}
uses: actions/upload-artifact@v2
with:
path: release.tar.gz
name: lore-${{ env.GITHUB_TAG }}-${{ matrix.target }}.tar.gz
if-no-files-found: error
- name: Upload Lore release tarball
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }}
id: upload-lore-release-tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_draft_release.outputs.upload_url }}
asset_path: release.tar.gz
asset_name: lore-${{ env.GITHUB_TAG }}-${{ matrix.target }}.tar.gz
asset_content_type: application/zip