mirror of
https://github.com/krahets/hello-algo.git
synced 2026-10-22 05:55:18 +08:00
44 lines
1.0 KiB
YAML
44 lines
1.0 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- ".github/workflows/go.yml"
|
|
- "codes/go/**/*.go"
|
|
- "en/codes/go/**/*.go"
|
|
pull_request:
|
|
branches: ["main"]
|
|
paths:
|
|
- ".github/workflows/go.yml"
|
|
- "codes/go/**/*.go"
|
|
- "en/codes/go/**/*.go"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
name: Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ matrix.code-dir }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
go-version: ["1.19.x"]
|
|
code-dir: ["codes/go", "en/codes/go"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Setup Go ${{ matrix.go-version }}
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Check out code into the Go module directory
|
|
run: go get -v -t -d ./...
|
|
- name: Build
|
|
run: go build -v ./...
|
|
- name: Test with Go
|
|
run: go test -v ./...
|