2023-06-08 14:44:53 +03:00
|
|
|
---
|
|
|
|
name: Go
|
2023-06-08 12:51:42 +03:00
|
|
|
on:
|
|
|
|
pull_request:
|
2023-06-08 14:44:53 +03:00
|
|
|
push:
|
2023-06-08 12:51:42 +03:00
|
|
|
branches:
|
|
|
|
- main
|
2023-08-11 13:27:52 +03:00
|
|
|
- "release-*"
|
2023-06-08 12:51:42 +03:00
|
|
|
|
2023-06-19 11:53:04 +03:00
|
|
|
# Minimal permissions to be inherited by any job that don't declare it's own permissions
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-06-08 12:51:42 +03:00
|
|
|
jobs:
|
|
|
|
test:
|
2023-06-08 14:44:53 +03:00
|
|
|
name: Tests
|
2023-06-08 12:51:42 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-02-23 20:59:23 +03:00
|
|
|
go_version: ["1.20", "1.21", "1.22"]
|
2023-06-08 12:51:42 +03:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-01-08 19:45:44 +03:00
|
|
|
uses: actions/checkout@v4.1.1
|
2023-06-08 12:51:42 +03:00
|
|
|
|
|
|
|
- name: Set up Go ${{ matrix.go_version }}
|
2024-01-08 19:45:44 +03:00
|
|
|
uses: actions/setup-go@v5.0.0
|
2023-06-08 12:51:42 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go_version }}
|
|
|
|
|
|
|
|
- name: Cache Go modules
|
|
|
|
id: cache
|
2024-02-01 12:19:29 +03:00
|
|
|
uses: actions/cache@v4
|
2023-06-08 12:51:42 +03:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: v1-go${{ matrix.go_version }}
|
|
|
|
|
|
|
|
- name: Run tests and check license
|
|
|
|
run: make check_license test
|
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
|
|
|
|
- name: Run style and unused
|
|
|
|
if: ${{ matrix.go_version == '1.20' }}
|
2023-06-19 11:53:04 +03:00
|
|
|
run: make style unused
|