Xray-core/.github/workflows/test.yml
2024-12-12 12:02:24 +08:00

74 lines
1.6 KiB
YAML

name: Test
on:
workflow_dispatch:
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:
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
check-latest: true
- name: Restore Cache
uses: actions/cache/restore@v4
with:
path: resources
key: xray-geodat-
enableCrossOsArchive: true
- name: Test
run: go test -timeout 1h -v ./...
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 ./...'