-
Notifications
You must be signed in to change notification settings - Fork 35
134 lines (114 loc) · 4.16 KB
/
build_and_upload.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
name: Build and Upload
on: [push]
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-musl
dir: musl
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
dir: gnu
- os: windows-latest
target: i686-pc-windows-msvc
dir: windows
- os: macos-latest
target: x86_64-apple-darwin
dir: macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install musl-tools (Linux)
if: matrix.dir == 'musl'
run: sudo apt-get install -y musl-tools
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Set default host
shell: bash
run: rustup set default-host ${{ matrix.target }}
# - name: Cache cargo registry
# uses: actions/cache@v2
# with:
# path: ~/.cargo/registry
# key: ${{ matrix.target }}-cargo-registry-${{ github.sha }}
# restore-keys: |
# ${{ matrix.target }}-cargo-registry-
# - name: Cache cargo index
# uses: actions/cache@v2
# with:
# path: ~/.cargo/git
# key: ${{ matrix.target }}-cargo-index-${{ github.sha }}
# restore-keys: |
# ${{ matrix.target }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.target }}-cargo-build-${{ github.sha }}
restore-keys: |
${{ matrix.target }}-cargo-build-
- name: Build client
run: cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-client/Cargo.toml
- name: Move client binaries to artifacts directory
shell: bash
run: |
mkdir -p artifacts/${{ matrix.dir }}
mv target/${{ matrix.target }}/release/geph5-client artifacts/${{ matrix.dir }}/
- name: Build bridge and exit
if: matrix.os == 'ubuntu-20.04'
run: |
cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-bridge/Cargo.toml
cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-exit/Cargo.toml
- name: Move client binaries to artifacts directory
if: matrix.os == 'ubuntu-20.04'
run: |
mkdir -p artifacts/${{ matrix.dir }}
mv target/${{ matrix.target }}/release/geph5-bridge artifacts/${{ matrix.dir }}/
mv target/${{ matrix.target }}/release/geph5-exit artifacts/${{ matrix.dir }}/
- name: Build client GUI
if: matrix.dir != 'musl'
run: cargo build --locked --release --target ${{ matrix.target }} --manifest-path binaries/geph5-client-gui/Cargo.toml
- name: Move client GUI binaries to artifacts directory
if: matrix.dir != 'musl'
shell: bash
run: |
mkdir -p artifacts/${{ matrix.dir }}
mv target/${{ matrix.target }}/release/geph5-client-gui artifacts/${{ matrix.dir }}/
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.dir }}-latest
path: artifacts/${{ matrix.dir }}
upload:
if: github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- dir: gnu
- dir: musl
- dir: macos
- dir: windows
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Upload to Cloudflare R2
uses: ryand56/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
r2-bucket: geph5
source-dir: artifacts/${{ matrix.dir }}-latest
destination-dir: ./${{ matrix.dir }}-latest