2024-12-16 18:22:58 +00:00
|
|
|
name: CI
|
2024-12-16 15:38:02 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
codespell:
|
2024-12-16 18:22:58 +00:00
|
|
|
name: check for spelling errors
|
2024-12-16 15:38:02 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Annotate locations with typos
|
|
|
|
uses: "https://github.com/codespell-project/codespell-problem-matcher@v1"
|
|
|
|
- name: Codespell
|
|
|
|
uses: "https://github.com/codespell-project/actions-codespell@v2"
|
|
|
|
with:
|
|
|
|
check_filenames: true
|
|
|
|
check_hidden: true
|
|
|
|
skip: ./.git
|
|
|
|
|
2024-12-16 18:22:58 +00:00
|
|
|
codequality:
|
|
|
|
name: code quality (lint/tests)
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- codespell
|
|
|
|
if: ${{ success() }}
|
|
|
|
steps:
|
|
|
|
- name: pull
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: download golangci-lint
|
|
|
|
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
|
|
|
|
- name: install golangci-lint
|
|
|
|
run: sh ./install.sh -s v1.62.2
|
|
|
|
- name: lint
|
|
|
|
run: ./bin/golangci-lint run
|
|
|
|
|
2024-12-16 15:38:02 +00:00
|
|
|
compile:
|
2024-12-16 18:22:58 +00:00
|
|
|
name: make sure build does not fail
|
2024-12-16 15:38:02 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- codespell
|
2024-12-16 18:22:58 +00:00
|
|
|
- codequality
|
2024-12-16 15:38:02 +00:00
|
|
|
if: ${{ success() }}
|
|
|
|
steps:
|
2024-12-16 18:22:58 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-12-16 15:38:02 +00:00
|
|
|
name: checkout
|
|
|
|
- name: install alsa devel
|
|
|
|
run: apt update && apt install libasound2-dev -y
|
|
|
|
- uses: https://code.forgejo.org/actions/setup-go@v5
|
|
|
|
name: install go
|
|
|
|
with:
|
|
|
|
go-version-file: './go.mod'
|
|
|
|
- run: go version
|
|
|
|
name: Go version
|
|
|
|
- run: make dep
|
|
|
|
name: install dependencies
|
|
|
|
- run: make build
|
|
|
|
name: build app
|
|
|
|
|
|
|
|
notify-fail:
|
|
|
|
name: notify-fail
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- codespell
|
2024-12-16 18:22:58 +00:00
|
|
|
- codequality
|
2024-12-16 15:38:02 +00:00
|
|
|
- compile
|
|
|
|
if: ${{ failure() }}
|
|
|
|
env:
|
|
|
|
SERVER_URL: ${{ secrets.GOTIFY_SERVER_URL }}
|
|
|
|
TOKEN: ${{ secrets.GOTIFY_TOKEN }}
|
|
|
|
steps:
|
|
|
|
- name: gotify
|
|
|
|
run: |-
|
|
|
|
curl "${SERVER_URL}?token=${TOKEN}" \
|
|
|
|
-F "title='CI failed'" \
|
2024-12-16 18:22:58 +00:00
|
|
|
-F "message='Something failed at ${GITHUB_REPOSITORY}/${GITHUB_REF} for user ${GITHUB_ACTOR}'" \
|
2024-12-16 15:38:02 +00:00
|
|
|
-F "priority=7" &> /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
|