2022-11-05 06:04:13 +03:00
|
|
|
name: Go Tests
|
2020-07-15 02:37:41 +03:00
|
|
|
|
2022-06-30 00:34:37 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- 'web/**'
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- 'web/**'
|
|
|
|
|
2020-07-15 02:37:41 +03:00
|
|
|
jobs:
|
|
|
|
test:
|
2021-08-28 01:24:21 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-04-22 23:23:52 +03:00
|
|
|
go-version: [1.21.x, 1.22.x]
|
2021-11-01 00:01:22 +03:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2021-08-28 01:24:21 +03:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-07-15 02:37:41 +03:00
|
|
|
steps:
|
2023-10-07 23:52:25 +03:00
|
|
|
- uses: actions/checkout@v4
|
2020-07-15 02:37:41 +03:00
|
|
|
|
2024-07-11 21:44:23 +03:00
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files-yaml
|
2024-09-17 18:24:24 +03:00
|
|
|
uses: tj-actions/changed-files@v45
|
2024-07-11 21:44:23 +03:00
|
|
|
with:
|
|
|
|
files_yaml: |
|
|
|
|
src:
|
|
|
|
- '**/*.{go,mod,sum}'
|
|
|
|
|
2024-03-04 05:45:28 +03:00
|
|
|
- uses: actions/cache@v4
|
2024-07-11 21:44:23 +03:00
|
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
2023-06-14 00:33:17 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: go-test-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
go-test-
|
|
|
|
|
2020-07-15 02:37:41 +03:00
|
|
|
- name: Install go
|
2024-07-11 21:44:23 +03:00
|
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
2023-12-20 04:51:40 +03:00
|
|
|
uses: actions/setup-go@v5
|
2020-07-15 02:37:41 +03:00
|
|
|
with:
|
2022-06-30 00:34:37 +03:00
|
|
|
go-version: '^1'
|
2023-02-16 02:01:14 +03:00
|
|
|
cache: true
|
2020-07-15 02:37:41 +03:00
|
|
|
|
|
|
|
- name: Run tests
|
2024-07-11 21:44:23 +03:00
|
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
2020-11-13 00:29:38 +03:00
|
|
|
run: go test ./...
|
2021-08-28 01:34:22 +03:00
|
|
|
|
|
|
|
test-bsds:
|
2022-07-28 00:17:35 +03:00
|
|
|
runs-on: macos-latest
|
2021-08-28 01:34:22 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- name: freebsd
|
|
|
|
version: 12.2
|
|
|
|
- name: openbsd
|
|
|
|
version: 6.8
|
|
|
|
|
|
|
|
steps:
|
2023-10-07 23:52:25 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-08-28 01:34:22 +03:00
|
|
|
|
2024-07-11 21:53:35 +03:00
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files-yaml
|
2024-09-17 18:24:24 +03:00
|
|
|
uses: tj-actions/changed-files@v45
|
2024-07-11 21:53:35 +03:00
|
|
|
with:
|
|
|
|
files_yaml: |
|
|
|
|
src:
|
|
|
|
- '**/*.{go,mod,sum}'
|
|
|
|
|
2024-03-04 05:45:28 +03:00
|
|
|
- uses: actions/cache@v4
|
2023-06-14 00:33:17 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: go-test-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
go-test-
|
|
|
|
|
2021-08-28 01:34:22 +03:00
|
|
|
- name: Install go
|
2024-07-11 21:53:35 +03:00
|
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
2023-12-20 04:51:40 +03:00
|
|
|
uses: actions/setup-go@v5
|
2021-08-28 01:34:22 +03:00
|
|
|
with:
|
2022-06-30 00:34:37 +03:00
|
|
|
go-version: '^1'
|
2023-02-16 02:01:14 +03:00
|
|
|
cache: true
|
2021-08-28 01:34:22 +03:00
|
|
|
|
|
|
|
- name: Run tests
|
2024-07-11 21:53:35 +03:00
|
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
2021-08-28 01:34:22 +03:00
|
|
|
run: go test ./...
|