-
Notifications
You must be signed in to change notification settings - Fork 5
148 lines (127 loc) · 4.25 KB
/
build.yml
File metadata and controls
148 lines (127 loc) · 4.25 KB
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: Build
permissions:
contents: write
discussions: write
on:
push:
branches: "*"
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo/config.toml"
- ".github/workflows/build.yml"
tags: "*"
pull_request:
branches: "*"
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo/config.toml"
- ".github/workflows/build.yml"
jobs:
build:
name: ${{ matrix.kind }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
# - ubuntu-24.04-arm
- macOS-13 # Intel
- macOS-latest # Apple Silicon
- windows-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install system dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y \
gcc g++ clang libfontconfig-dev libwayland-dev \
libwebkit2gtk-4.1-dev libxkbcommon-x11-dev \
libssl-dev libzstd-dev \
vulkan-validationlayers libvulkan1
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Log versions
run: |
rustc --version
cargo --version
- name: Cache
uses: actions/cache@v3
with:
path: |-
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/*/.*
target/*/build
target/*/deps
key:
${{ matrix.config.os }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ matrix.config.os }}-
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo check
run: cargo check --locked
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Run cargo test
run: cargo test --locked
- name: Build release
run: cargo build --release --locked
- name: Package release
run: |-
cargo install cargo-packager
cargo packager --release
- name: Pre-release (linux x86_64)
if: matrix.os == 'ubuntu-latest'
run: zip -r gpui-memory-game-x86_64-unknown-linux-gnu.zip gpui-memory-game
working-directory: target/release
- name: Pre-release (linux aarch64)
if: matrix.os == 'ubuntu-24.04-arm'
run: zip -r gpui-memory-game-aarch64-unknown-linux-gnu.zip gpui-memory-game
working-directory: target/release
- name: Pre-release (mac)
if: matrix.os == 'macOS-13'
run: zip -r gpui-memory-game-x86_64-apple-darwin.zip gpui-memory-game.app
working-directory: target/release
- name: Pre-release (aarch64-apple-darwin)
if: matrix.os == 'macOS-latest'
run: zip -r gpui-memory-game-aarch64-apple-darwin.zip gpui-memory-game.app
working-directory: target/release
- name: Pre-release (windows x86_64)
if: matrix.os == 'windows-latest'
run: |
Compress-Archive -CompressionLevel Optimal -Force -Path target/release/gpui-memory-game.exe -DestinationPath target/release/gpui-memory-game-x86_64-pc-windows-msvc.zip
- name: Release
uses: softprops/action-gh-release@v2
if: |
startsWith(github.repository, 'justjavac') &&
startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/release/gpui-memory-game-x86_64-pc-windows-msvc.zip
target/release/gpui-memory-game-x86_64-unknown-linux-gnu.zip
target/release/gpui-memory-game-x86_64-apple-darwin.zip
target/release/gpui-memory-game-aarch64-apple-darwin.zip
target/release/gpui-memory-game-aarch64-unknown-linux-gnu.zip
target/release/gpui-memory-game_*.dmg
target/release/gpui-memory-game_*.msi
target/release/gpui-memory-game_*.deb
draft: true