-
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 1.75 KB
/
rust.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
name: Rust
on:
pull_request:
push:
branches:
- main
tags:
- v*
schedule:
- cron: '00 01 * * *'
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install pre-deps
run: sudo apt-get install libasound2-dev libdbus-1-dev
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run rustfmt
run: cargo fmt -- --check
- name: Run Clippy Correctness lints
run: cargo clippy -- -D clippy::correctness
- name: Build Release
if: startsWith(github.ref, 'refs/tags/')
uses: actions-rs/cargo@v1
with:
command: build
args: --release -Z strip=symbols
- name: Set GIT_TAG env
run: echo "GIT_TAG=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
- name: Create tmp dir
if: startsWith(github.ref, 'refs/tags/')
run: mkdir /tmp/build_result
- name: Package Release
if: startsWith(github.ref, 'refs/tags/')
run: cd target/release && tar -czvf pomo-break.tar.gz pomo-break
- name: Copy Package
if: startsWith(github.ref, 'refs/tags/')
run: cp target/release/pomo-break.tar.gz /tmp/build_result/pomo-break-$GIT_TAG.tar.gz
- name: Publish release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
with:
files: /tmp/build_result/pomo-break*.tar.gz