Skip to content

Commit

Permalink
Merge branch 'ci'
Browse files Browse the repository at this point in the history
Fixes #9

Handles pushes, tagging, and sends Matrix messages.
  • Loading branch information
eras committed May 22, 2021
2 parents 1bec6d2 + 58d0fed commit 758dcdb
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Build started notification
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "ClickMuteJack build started. [Progress.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
- uses: actions/checkout@v2
- name: Install build deps
run: sudo apt-get install libglvnd-dev libxi-dev libjack-jackd2-dev
- uses: actions-rs/toolchain@v1
with:
# non-stable needed to use -Z unstable-options --config
toolchain: nightly
- run: 'cargo +nightly -Z unstable-options --config rustc-link-search=\"/usr/lib/x86_64-linux-gnu\" build'
- name: Build succeeded notification
if: ${{ success() }}
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "ClickMuteJack build complete. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
- name: Build failed notification
if: ${{ !success() }}
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "ClickMuteJack build failed. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
84 changes: 84 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
on:
push:
tags:
- 'v*'

name: tag
jobs:
build_and_test:
name: ClickMuteJack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# https://stackoverflow.com/a/58178121
- name: Set release information
id: vars
run: echo ::set-output name=git_describe::"$(git describe --tags)"
- name: Cancel if no tag
if: ${{ steps.vars.outputs.git_describe == '' }}
run: false
- name: Build started notification
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build started. [Progress.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
- name: Install build deps
run: sudo apt-get install libglvnd-dev libxi-dev libjack-jackd2-dev
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- name: Set annotated tag info information
id: vars2
run: echo ::set-output name=git_message::"$(git tag -n999 -l $(git describe --tags))"
- name: build
env:
GIT_DESCRIBE: ${{ steps.vars.outputs.git_describe }}
run: 'cargo +nightly -Z unstable-options --config rustc-link-search=\"/usr/lib/x86_64-linux-gnu\" build --release'
- run: strip target/release/click_mute
- uses: actions/upload-artifact@v2
with:
name: click-mute
path: |
target/release/click_mute
# https://github.com/actions/create-release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.vars2.outputs.git_message}}
draft: false
prerelease: false
# https://github.com/actions/upload-release-asset
- name: Upload Release Asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/release/click_mute
asset_name: click-mute-${{ steps.vars.outputs.git_describe }}-linux-x86_64.bin
asset_content_type: application/octet-stream
- name: Build succeeded notification
if: ${{ success() }}
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build complete. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
- name: Build failed notification
if: ${{ !success() }}
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ secrets.MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "ClickMuteJack release ${{ steps.vars.outputs.git_describe }} build failed. [Logs.](https://github.com/eras/ClickMuteJack/actions/runs/${{github.run_id}})"
server: ${{ secrets.MATRIX_SERVER }}
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(format_args_capture)]

mod click_info;
mod click_mute;
mod clicky_events;
Expand Down

0 comments on commit 758dcdb

Please sign in to comment.