-
-
Notifications
You must be signed in to change notification settings - Fork 42
104 lines (92 loc) · 2.85 KB
/
ci.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
on:
push:
branches:
- master
pull_request:
name: xbuild
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
with:
components: clippy, rustfmt
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace --examples --tests --all-features -- -D warnings
- run: cargo test
build:
strategy:
matrix:
host: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.host }}
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
- run: cargo install --path xbuild --root .
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.host }}-x
path: bin/x${{ matrix.host == 'windows-latest' && '.exe' || '' }}
build-template:
strategy:
fail-fast: false
matrix:
host:
- ubuntu-latest
- macos-latest
- windows-latest
opt:
- debug
- release
target:
- platform: linux
arch: x64
- platform: macos
arch: x64
- platform: windows
arch: x64
- platform: android
arch: arm64
- platform: ios
arch: arm64
runs-on: ${{ matrix.host }}
needs: build
steps:
- name: install rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
- name: install x
uses: actions/download-artifact@v3
with:
name: ${{ matrix.host }}-x
- run: chmod +x ./x
if: ${{ matrix.host == 'ubuntu-latest' || matrix.host == 'macos-latest' }}
- name: install llvm ubuntu
if: ${{ matrix.host == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install llvm
- name: install llvm macos
if: ${{ matrix.host == 'macos-latest' }}
run: |
brew install llvm
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
- name: install java
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11
- name: install linux dependencies
if: ${{ matrix.host == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install libwebkit2gtk-4.0-dev libgtk-3-dev squashfs-tools
- name: create project
run: ./x new template
# only linux can target linux as it is not clear what that even is exactly
# glibc/musl gtk/qt x11/wayland
# windows doesn't support posix symlinks so can't cross compile to macos/ios
- name: build project
if: >
!(matrix.host == 'macos-latest' && matrix.target.platform == 'linux' ||
matrix.host == 'windows-latest' && contains(fromJson('["linux", "macos", "ios"]'), matrix.target.platform))
run: ../x build --platform ${{ matrix.target.platform }} --arch ${{ matrix.target.arch }} --${{ matrix.opt }}
working-directory: template