discordo/.github/workflows/ci.yml
2026-10-15 21:42:34 -04:00

74 lines
2.3 KiB
YAML

name: ci
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v9
with:
version: latest
build:
strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners
os:
[
ubuntu-latest,
ubuntu-24.04-arm,
windows-latest,
windows-11-arm,
macos-latest,
macos-26-intel,
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
# Voice support requires a C compiler, and the one on this runner targets x64.
- if: ${{ matrix.os == 'windows-11-arm' }}
run: |
C:\msys64\usr\bin\pacman -Sy --noconfirm mingw-w64-clang-aarch64-clang
echo "C:\msys64\clangarm64\bin" >> $env:GITHUB_PATH
echo "CC=clang" >> $env:GITHUB_ENV
- name: Check that docs/config.md is up to date
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
go generate ./internal/config
git diff --exit-code docs/config.md
# -race is not supported on windows/arm64.
- name: Test
run: |
go test ${{ matrix.os != 'windows-11-arm' && '-race' || '' }} -v ./...
go test ${{ matrix.os != 'windows-11-arm' && '-race' || '' }} -v -tags no_spoof_tls_fingerprint,no_voice ./...
- name: Build
run: go build -trimpath -ldflags=-s .
- uses: actions/upload-artifact@v7
if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
with:
name: discordo_${{ runner.os }}_${{ runner.arch }}
path: |
discordo
discordo.exe
- name: Send repository dispatch
if: ${{ runner.os == 'Windows' && github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
gh api --method POST -H "Accept: application/vnd.github+json" -f "event_type=discordo-ci-completed" /repos/vvirtues/bucket/dispatches