Go Build and Test / build-and-test (push) Successful in 29s
- Заменена filepath.Ext() на strings.HasSuffix() для корректной проверки расширений - Оптимизирована логика проверки исключаемых путей: - Упрощён pattern matching - Добавлена явная проверка префиксов путей - Улучшена обработка базовых имён файлов - Добавлен новый endpoint GET /backup: - Возвращает JSON-список файлов в директории бэкапов - Реализована фильтрация директорий
43 lines
1.1 KiB
YAML
43 lines
1.1 KiB
YAML
name: Go Build and Test
|
|
|
|
# This workflow runs on pushes and pull requests to the main branches.
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
build-and-test:
|
|
# You might need to change 'ubuntu-latest' to a tag that matches your self-hosted Gitea runner, e.g., 'linux', 'go', etc.
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Step 1: Check out the repository code
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# Step 2: Set up the Go environment
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
# Use a Go version that matches your project's go.mod file
|
|
go-version: "1.22"
|
|
|
|
# Step 3: Download Go module dependencies
|
|
- name: Tidy and Vendor
|
|
run: go mod tidy && go mod vendor
|
|
|
|
# Step 4: Build the application to ensure it compiles
|
|
- name: Build
|
|
run: go build -v ./...
|
|
|
|
# Step 5: Run tests to check for regressions
|
|
# This step will pass if no tests are found, which is fine for now.
|
|
- name: Test
|
|
run: go test -v ./...
|