-
Notifications
You must be signed in to change notification settings - Fork 4
141 lines (129 loc) · 3.83 KB
/
main.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
# GitHub Workflows file
name: main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
RUSTFLAGS: -Dwarnings
jobs:
build_and_test:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- macos-aarch64
- macos-x86_64
- ubuntu-20.04
- ubuntu-22.04
- windows
include:
- build: ubuntu-20.04
os: ubuntu-20.04
mkcmd: ./tools/mkdeb.sh -d focal
- build: ubuntu-22.04
os: ubuntu-22.04
mkcmd: ./tools/mkdeb.sh -d jammy
- build: macos-aarch64
os: macos-latest
mkcmd: ./tools/mkpkg.sh -a aarch64 -t aarch64-apple-darwin
- build: macos-x86_64
os: macos-latest
mkcmd: ./tools/mkpkg.sh
- build: windows
os: windows-latest
mkcmd: ./tools/mkzip.ps1
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install Rust (macos-aarach64)
if: ${{ matrix.build == 'macos-aarch64' }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Install Linux dependency
run: sudo apt-get install libkrb5-dev
if: startswith(matrix.os, 'ubuntu')
# see https://github.com/rust-lang/rust-bindgen/issues/1797
- name: Install Windows dependency (LLVM)
uses: KyleMayes/[email protected]
if: startswith(matrix.os, 'windows')
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: startswith(matrix.os, 'windows')
- name: Run cargo test
run: cargo test
- name: Build Release Package
id: buildpkg
run: ${{ matrix.mkcmd }}
- name: Upload package artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.buildpkg.outputs.pkgfile }}
path: ./${{ steps.buildpkg.outputs.pkgfile }}
bazel_build:
name: Bazel build
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [macos]
include:
- build: macos
os: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Bazel cache
uses: actions/cache@v3
with:
path: |
~/.cache/bazel_build_cache
~/.cache/bazel_repo_cache
key: ${{ runner.os }}-bazel-${{ hashFiles('Cargo.Bazel.lock', 'WORKSPACE') }}
restore-keys: |
${{ runner.os }}-bazel-
- name: Bazel build
run: bazel build --disk_cache=~/.cache/bazel_build_cache --repository_cache=~/.cache/bazel_repo_cache //macos/app:ProxydetoxApp
format_check:
name: Rust lint
runs-on: ubuntu-20.04
strategy:
matrix:
lint: [clippy, fmt]
include:
- lint: clippy
flags: --all
- lint: fmt
flags: --all -- --check
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Install Linux dependency
run: sudo apt-get install libkrb5-dev
if: ${{ matrix.lint == 'clippy' }}
- name: Lint check
run: cargo ${{ matrix.lint }} ${{ matrix.flags }}