ci: run pre-commit on pr + push
This commit is contained in:
parent
d55d4b0f00
commit
ead94055c9
2 changed files with 108 additions and 0 deletions
41
.forgejo/workflows/pull-request.yml
Normal file
41
.forgejo/workflows/pull-request.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: Pull-Request
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
static-analysis:
|
||||||
|
runs-on: runner-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.23
|
||||||
|
- name: Validate Yaml
|
||||||
|
run: pipx run pre-commit run check-yaml -a
|
||||||
|
- name: Validate shell scripts
|
||||||
|
run: pipx run pre-commit run shellcheck -a
|
||||||
|
- name: Check formatting
|
||||||
|
run: pipx run pre-commit run go-fmt -a
|
||||||
|
- name: Check code patterns
|
||||||
|
run: pipx run pre-commit run go-vet-mod -a
|
||||||
|
tests:
|
||||||
|
runs-on: runner-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.23
|
||||||
|
- name: Tests
|
||||||
|
run: pipx run pre-commit run go-test-mod -a
|
||||||
|
post-run:
|
||||||
|
runs-on: runner-latest
|
||||||
|
needs: [static-analysis,tests]
|
||||||
|
if: ${{ always() }}
|
||||||
|
steps:
|
||||||
|
- name: Export trace
|
||||||
|
uses: https://forge.karnov.club/marc/opentelemetry-trace-export-forgejo-action@main
|
||||||
|
with:
|
||||||
|
otlp-endpoint: "http://otel.home.karnov.club:4318"
|
||||||
|
forgejo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
forgejo-base-url: ${{ env.GITHUB_SERVER_URL }}
|
||||||
|
run-id: ${{ env.GITHUB_RUN_NUMBER }}
|
||||||
|
repo-name: ${{ env.GITHUB_REPOSITORY }}
|
67
.forgejo/workflows/push.yml
Normal file
67
.forgejo/workflows/push.yml
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
name: Push
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre-run:
|
||||||
|
runs-on: runner-latest
|
||||||
|
steps:
|
||||||
|
- uses: https://forge.karnov.club/marc/push-status-to-discord-action@main
|
||||||
|
with:
|
||||||
|
webhook-url: ${{secrets.DISCORD_WEBHOOK_URL}}
|
||||||
|
status: "Started"
|
||||||
|
init: true
|
||||||
|
static-analysis:
|
||||||
|
runs-on: runner-latest
|
||||||
|
needs: [pre-run]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.23
|
||||||
|
- name: Validate Yaml
|
||||||
|
run: pipx run pre-commit run check-yaml -a
|
||||||
|
- name: Validate shell scripts
|
||||||
|
run: pipx run pre-commit run shellcheck -a
|
||||||
|
- name: Check formatting
|
||||||
|
run: pipx run pre-commit run go-fmt -a
|
||||||
|
- name: Check code patterns
|
||||||
|
run: pipx run pre-commit run go-vet-mod -a
|
||||||
|
tests:
|
||||||
|
runs-on: runner-latest
|
||||||
|
needs: [pre-run]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.23
|
||||||
|
- name: Tests
|
||||||
|
run: pipx run pre-commit run go-test-mod -a
|
||||||
|
post-run:
|
||||||
|
runs-on: runner-latest
|
||||||
|
needs: [static-analysis,tests]
|
||||||
|
steps:
|
||||||
|
- name: Export trace
|
||||||
|
uses: https://forge.karnov.club/marc/opentelemetry-trace-export-forgejo-action@main
|
||||||
|
with:
|
||||||
|
otlp-endpoint: "http://otel.home.karnov.club:4318"
|
||||||
|
forgejo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
forgejo-base-url: ${{ env.GITHUB_SERVER_URL }}
|
||||||
|
run-id: ${{ env.GITHUB_RUN_NUMBER }}
|
||||||
|
repo-name: ${{ env.GITHUB_REPOSITORY }}
|
||||||
|
- name: Notify success
|
||||||
|
uses: https://forge.karnov.club/marc/push-status-to-discord-action@main
|
||||||
|
if: ${{always() && success()}}
|
||||||
|
with:
|
||||||
|
webhook-url: ${{secrets.DISCORD_WEBHOOK_URL}}
|
||||||
|
status: "Success"
|
||||||
|
variant: "success"
|
||||||
|
- name: Notify failure
|
||||||
|
uses: https://forge.karnov.club/marc/push-status-to-discord-action@main
|
||||||
|
if: ${{always() && failure()}}
|
||||||
|
with:
|
||||||
|
webhook-url: ${{secrets.DISCORD_WEBHOOK_URL}}
|
||||||
|
status: "Failure"
|
||||||
|
variant: "failure"
|
||||||
|
|
Loading…
Reference in a new issue