-
Notifications
You must be signed in to change notification settings - Fork 18
133 lines (113 loc) · 4.32 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
name: Build Compotes app.
on:
push:
branches: [ main ]
tags: [ 'v[0-9]+.*' ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: 🗄️ Setup Rust cache
uses: actions/cache@v2
with:
key: ${{ matrix.os }}-${{ hashFiles('src-tauri/Cargo.lock') }}
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
./src-tauri/target
- name: 🍃 Install Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: 🍃 Install Yarn
run: |
npm i -g npm yarn
- name: 🦀 Install Rust
uses: actions-rs/toolchain@v1
with: { toolchain: stable }
- name: 🌐 Update MSEdge webdriver (windowsonly)
if: matrix.os == 'windows-latest'
run: |
choco upgrade microsoft-edge
- name: 🌐 Install webkit2gtk (ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get upgrade -y --no-install-recommends -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0 libappindicator3-dev webkit2gtk-driver xvfb
- name: 🔌 Install Node.js dependencies
run: yarn install
- name: 🔌 Download Rust dependencies
run: cargo fetch --manifest-path=src-tauri/Cargo.toml
- name: 🏗️ 📄 Build frontend
run: yarn build
- name: 🏗️ 💽 Build application
run: yarn tauri build
- name: 🧪 Test application (linux)
if: matrix.os == 'ubuntu-latest'
continue-on-error: true
run: |
xvfb-run yarn test
- name: 🧪 Test application (non-linux)
if: matrix.os != 'ubuntu-latest'
continue-on-error: true
run: |
yarn test
- name: 🗃 Store artifacts (release only)
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v')
with:
name: compotes_artifacts
overwrite: true
path: |
src-tauri/target/release/compotes
src-tauri/target/release/bundle/deb/*.deb
- name: 🗃 Store Windows artifacts (release only)
uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/v')
with:
name: compotes_artifacts
overwrite: true
path: |
src-tauri/target/release/compotes.exe
src-tauri/target/release/bundle/msi/*.msi
release:
runs-on: ubuntu-latest
needs:
- build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: 🗃 Download built artifacts
uses: actions/download-artifact@v4
with:
name: compotes_artifacts
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
#body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload all artifacts
uses: softprops/action-gh-release@v2
with:
files: |
LICENSE
src-tauri/target/release/compotes.exe
src-tauri/target/release/bundle/msi/*.msi
src-tauri/target/release/compotes
src-tauri/target/release/bundle/deb/*.deb