-
Notifications
You must be signed in to change notification settings - Fork 25
148 lines (128 loc) · 4.29 KB
/
rust.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
name: Rust
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
SHELL: /bin/bash
jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-13]
rust: [stable, beta]
include:
- os: windows-latest
id: windows
- os: macos-13
id: macos
- os: ubuntu-latest
id: linux
env:
CCACHE: sccache
SCCACHE_CACHE_SIZE: 3G
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@v3
- name: Install Dependencies on Windows
if: matrix.id == 'windows'
env:
MOZILLA_BUILD_LINK: https://ftp.mozilla.org/pub/mozilla/libraries/win32
MOZILLA_BUILD_VERSION: 3.4
run: |
curl -SL "https://github.com/servo/servo-build-deps/releases/download/msvc-deps/moztools-4.0.zip" --create-dirs -o target/dependencies/moztools.zip
cd target/dependencies && unzip -qo moztools.zip -d .
echo 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Tools\LLVM\bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Dependencies on OS X
if: matrix.id == 'macos'
run: brew install --overwrite python autoconf@2.13 llvm sccache yasm
- name: Install Dependencies on Linux
if: matrix.id == 'linux'
run: sudo apt install clang llvm -y
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
default: true
- name: Install Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Cache Cargo Cache and Git Database
uses: actions/cache@v2
with:
path: |
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ matrix.id }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-${{ matrix.id }}-
- name: Build POSIX
if: matrix.id == 'macos' || matrix.id == 'linux'
env:
CC: clang
CXX: clang++
RUSTC_WRAPPER: sccache
run: |
just build-release -vv --color=never
just test-release -vv --color=never
mv ./target/release/cli ./target/release/spiderfire
strip ./target/release/spiderfire
- name: Build Windows
if: matrix.id == 'windows'
env:
MOZTOOLS_PATH: "${{ github.workspace }}\\target\\dependencies\\moztools-4.0"
CC: clang-cl.exe
CXX: clang-cl.exe
LINKER: lld-link.exe
run: |
just build-release -vv --color=never
just test-release -vv --color=never
Rename-Item -Path .\target\release\cli.exe -NewName spiderfire.exe
- name: Upload Executables as Artifacts
uses: actions/upload-artifact@v2
if: matrix.rust == 'stable'
with:
name: spiderfire-${{ github.sha }}-${{ matrix.id }}
path: target/release/spiderfire${{ matrix.id == 'windows' && '.exe' || '' }}
if-no-files-found: error
Lint:
runs-on: ubuntu-latest
env:
CCACHE: sccache
SCCACHE_CACHE_SIZE: 1G
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@v3
- name: Install Dependencies on Linux
run: sudo apt install clang llvm -y
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
default: true
- name: Install Just
uses: extractions/setup-just@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Cache Cargo Cache and Git Database
uses: actions/cache@v2
with:
path: |
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-lint-
- name: Lint
env:
CC: clang
CXX: clang++
RUSTC_WRAPPER: sccache
run: just lint