-
Notifications
You must be signed in to change notification settings - Fork 5
133 lines (112 loc) · 3.67 KB
/
cargo-build.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
# Runs on push to main, basically the "release" version since we don't really do releases (that's bad right)
name: Cargo Build
on:
push:
branches: [main]
paths-ignore:
- "README.md"
- "**.json"
- "**.yml"
- "LICENSE"
- "!.github/workflows/cargo-build.yml"
- "installer/**"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
include:
- os: ubuntu-latest
file-name: qpm
prefix: linux
- os: macos-13
file-name: qpm
prefix: macos
- os: windows-latest
file-name: qpm.exe
prefix: windows
steps:
- uses: actions/checkout@v2
#! Windows 2022/Ubutnu 22.04/MacOS 14 include cargo now
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: nightly
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Get libdbus if Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y libdbus-1-dev
- name: Get OpenSSL if MacOS
if: ${{ matrix.os == 'macos-13' }}
run: |
brew install openssl@3
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --release
- uses: actions-rs/toolchain@v1
if: ${{matrix.os == 'macos-13' }}
with:
toolchain: nightly
target: aarch64-apple-darwin
- name: Double check
if: ${{ matrix.os == 'macos-13' }}
run: |
rustup target add aarch64-apple-darwin
rustup show
- name: Cargo build for aarch64 Mac
if: ${{matrix.os == 'macos-13' }}
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target aarch64-apple-darwin
- name: Make M1 Universal binary
if: ${{matrix.os == 'macos-13' }}
run: lipo -create -output qpm-universal target/release/${{matrix.file-name}} target/aarch64-apple-darwin/release/${{matrix.file-name}}
- name: Artifact Upload
uses: actions/upload-artifact@v4
if: ${{matrix.os == 'macos-13' }}
with:
name: qpm-universal
path: qpm-universal
if-no-files-found: error
- name: Download Inno Setup
if: ${{matrix.os == 'windows-latest' }}
uses: suisei-cn/actions-download-file@v1
with:
url: https://jrsoftware.org/download.php/is.exe
target: ../
- name: Install Inno Setup
if: ${{matrix.os == 'windows-latest' }}
run: "../is.exe /VERYSILENT /NORESTART /ALLUSERS"
- name: Compile Installer
if: ${{matrix.os == 'windows-latest' }}
run: '& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /f installer/installer.iss'
- name: Artifact Upload
uses: actions/upload-artifact@v4
if: ${{matrix.os == 'windows-latest' }}
with:
name: qpm-installer.exe
path: ./installer/qpm-installer.exe
if-no-files-found: error
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.prefix }}-${{ matrix.file-name }}
path: ./target/release/${{ matrix.file-name }}
if-no-files-found: error