Skip to content

Commit 758dcdb

Browse files
committed
Merge branch 'ci'
Fixes #9 Handles pushes, tagging, and sends Matrix messages.
2 parents 1bec6d2 + 58d0fed commit 758dcdb

File tree

3 files changed

+124
-2
lines changed

3 files changed

+124
-2
lines changed

.github/workflows/build.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Build started notification
11+
uses: s3krit/[email protected]
12+
with:
13+
room_id: ${{ secrets.MATRIX_ROOM_ID }}
14+
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
15+
message: "ClickMuteJack build started. [Progress.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
16+
server: ${{ secrets.MATRIX_SERVER }}
17+
- uses: actions/checkout@v2
18+
- name: Install build deps
19+
run: sudo apt-get install libglvnd-dev libxi-dev libjack-jackd2-dev
20+
- uses: actions-rs/toolchain@v1
21+
with:
22+
# non-stable needed to use -Z unstable-options --config
23+
toolchain: nightly
24+
- run: 'cargo +nightly -Z unstable-options --config rustc-link-search=\"/usr/lib/x86_64-linux-gnu\" build'
25+
- name: Build succeeded notification
26+
if: ${{ success() }}
27+
uses: s3krit/[email protected]
28+
with:
29+
room_id: ${{ secrets.MATRIX_ROOM_ID }}
30+
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
31+
message: "ClickMuteJack build complete. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
32+
server: ${{ secrets.MATRIX_SERVER }}
33+
- name: Build failed notification
34+
if: ${{ !success() }}
35+
uses: s3krit/[email protected]
36+
with:
37+
room_id: ${{ secrets.MATRIX_ROOM_ID }}
38+
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
39+
message: "ClickMuteJack build failed. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
40+
server: ${{ secrets.MATRIX_SERVER }}

.github/workflows/tag.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: tag
7+
jobs:
8+
build_and_test:
9+
name: ClickMuteJack
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
# https://stackoverflow.com/a/58178121
14+
- name: Set release information
15+
id: vars
16+
run: echo ::set-output name=git_describe::"$(git describe --tags)"
17+
- name: Cancel if no tag
18+
if: ${{ steps.vars.outputs.git_describe == '' }}
19+
run: false
20+
- name: Build started notification
21+
uses: s3krit/[email protected]
22+
with:
23+
room_id: ${{ secrets.MATRIX_ROOM_ID }}
24+
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
25+
message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build started. [Progress.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
26+
server: ${{ secrets.MATRIX_SERVER }}
27+
- name: Install build deps
28+
run: sudo apt-get install libglvnd-dev libxi-dev libjack-jackd2-dev
29+
- uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: nightly
32+
- name: Set annotated tag info information
33+
id: vars2
34+
run: echo ::set-output name=git_message::"$(git tag -n999 -l $(git describe --tags))"
35+
- name: build
36+
env:
37+
GIT_DESCRIBE: ${{ steps.vars.outputs.git_describe }}
38+
run: 'cargo +nightly -Z unstable-options --config rustc-link-search=\"/usr/lib/x86_64-linux-gnu\" build --release'
39+
- run: strip target/release/click_mute
40+
- uses: actions/upload-artifact@v2
41+
with:
42+
name: click-mute
43+
path: |
44+
target/release/click_mute
45+
# https://github.com/actions/create-release
46+
- name: Create Release
47+
id: create_release
48+
uses: actions/create-release@v1
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
51+
with:
52+
tag_name: ${{ github.ref }}
53+
release_name: Release ${{ github.ref }}
54+
body: ${{ steps.vars2.outputs.git_message}}
55+
draft: false
56+
prerelease: false
57+
# https://github.com/actions/upload-release-asset
58+
- name: Upload Release Asset
59+
id: upload_release_asset
60+
uses: actions/upload-release-asset@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
65+
upload_url: ${{ steps.create_release.outputs.upload_url }}
66+
asset_path: ./target/release/click_mute
67+
asset_name: click-mute-${{ steps.vars.outputs.git_describe }}-linux-x86_64.bin
68+
asset_content_type: application/octet-stream
69+
- name: Build succeeded notification
70+
if: ${{ success() }}
71+
uses: s3krit/[email protected]
72+
with:
73+
room_id: ${{ secrets.MATRIX_ROOM_ID }}
74+
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
75+
message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build complete. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
76+
server: ${{ secrets.MATRIX_SERVER }}
77+
- name: Build failed notification
78+
if: ${{ !success() }}
79+
uses: s3krit/[email protected]
80+
with:
81+
room_id: ${{ secrets.MATRIX_ROOM_ID }}
82+
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
83+
message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build failed. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
84+
server: ${{ secrets.MATRIX_SERVER }}

src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(format_args_capture)]
2-
31
mod click_info;
42
mod click_mute;
53
mod clicky_events;

0 commit comments

Comments
 (0)