-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (114 loc) · 3.32 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
create:
tags:
- v*
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build for the web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- uses: Swatinem/rust-cache@v1
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install trunk
uses: baptiste0928/cargo-install@v1
with:
crate: trunk
- name: Build for web
run: trunk build --release --public-url mpc_valet
- name: Upload site
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- uses: Swatinem/rust-cache@v1
- name: Run tests
run: cargo test --verbose
style:
name: style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- uses: Swatinem/rust-cache@v1
- name: Run clippy
run: cargo clippy
dependabot:
name: 'Dependabot automerge'
needs:
- build
- test
- style
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} # Detect that the PR author is dependabot
steps:
- uses: fastify/github-action-merge-dependabot@v3.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release:
needs:
- build
- test
- style
runs-on: ubuntu-latest
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
release_web:
name: release web
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v3
- name: Download dist
uses: actions/download-artifact@v4.1.7
with:
name: dist
path: dist
- name: Deploy to github pages
uses: JamesIves/github-pages-deploy-action@v4.3.0
with:
branch: gh-pages
folder: dist
release_crate:
name: release crate
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v1
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- name: Publish crate
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}