2021-03-02 14:46:50 +00:00
|
|
|
name: Test
|
|
|
|
|
|
|
|
on:
|
2024-12-12 04:02:24 +00:00
|
|
|
workflow_dispatch:
|
2021-03-02 14:46:50 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- "**/*.go"
|
|
|
|
- "go.mod"
|
|
|
|
- "go.sum"
|
|
|
|
- ".github/workflows/*.yml"
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
paths:
|
|
|
|
- "**/*.go"
|
|
|
|
- "go.mod"
|
|
|
|
- "go.sum"
|
|
|
|
- ".github/workflows/*.yml"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2022-02-20 03:53:11 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2021-03-02 14:46:50 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
|
|
steps:
|
2024-02-20 01:25:22 +00:00
|
|
|
- name: Checkout codebase
|
|
|
|
uses: actions/checkout@v4
|
2021-03-02 14:46:50 +00:00
|
|
|
- name: Set up Go
|
2023-12-07 00:20:06 +00:00
|
|
|
uses: actions/setup-go@v5
|
2021-03-02 14:46:50 +00:00
|
|
|
with:
|
2024-08-26 02:30:38 +00:00
|
|
|
go-version: '1.23'
|
2022-02-21 14:13:35 +00:00
|
|
|
check-latest: true
|
2023-02-25 02:26:28 +00:00
|
|
|
- name: Restore Cache
|
2024-01-18 00:15:36 +00:00
|
|
|
uses: actions/cache/restore@v4
|
2023-02-24 17:29:45 +00:00
|
|
|
with:
|
2023-02-25 02:26:28 +00:00
|
|
|
path: resources
|
|
|
|
key: xray-geodat-
|
|
|
|
enableCrossOsArchive: true
|
2021-03-02 14:46:50 +00:00
|
|
|
- name: Test
|
|
|
|
run: go test -timeout 1h -v ./...
|
2024-12-12 04:02:24 +00:00
|
|
|
|
|
|
|
freebsd:
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
name: test (freebsd)
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout codebase
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restore Cache
|
|
|
|
uses: actions/cache/restore@v4
|
|
|
|
with:
|
|
|
|
path: resources
|
|
|
|
key: xray-geodat-
|
|
|
|
enableCrossOsArchive: true
|
|
|
|
- name: Start VM
|
|
|
|
id: vm
|
|
|
|
uses: vmactions/freebsd-vm@v1
|
|
|
|
with:
|
|
|
|
prepare: |
|
|
|
|
pkg install -y go123
|
|
|
|
pw user add -n action -m
|
|
|
|
- name: Test
|
|
|
|
shell: freebsd {0}
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
go123 version
|
|
|
|
su action -c 'go123 test -timeout 1h -v ./...'
|