envoid/.forgejo/workflows/ci.yml
Sagi Dayan dec2da64de
Some checks failed
ci/ci / Check for spelling errors (pull_request) Successful in 28s
ci/ci / Code quality (pull_request) Failing after 58s
ci/ci / Make sure build does not fail (pull_request) Failing after 15m47s
ci/ci / notify-fail (pull_request) Has been cancelled
Added lint to the CI. formatted all code accordingly
Signed-off-by: Sagi Dayan <sagidayan@gmail.com>
2024-12-16 22:51:34 +02:00

87 lines
2.2 KiB
YAML

name: ci/ci
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://github.com/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
code_quality:
name: Code quality
runs-on: ubuntu-latest
needs:
- codespell
if: ${{ success() }}
steps:
- name: pull
uses: https://github.com/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
compile:
name: Make sure build does not fail
runs-on: ubuntu-latest
needs:
- codespell
- lint
if: ${{ success() }}
steps:
- uses: https://github.com/actions/checkout@v4
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
- lint
- 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'" \
-F "message='Something failed at ${GITHUB_REPOSITORY} for user ${GITHUB_ACTOR}'" \
-F "priority=7" &> /dev/null