Skip to content

Optimization: logs query #33

Optimization: logs query

Optimization: logs query #33

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- 'v*'
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'web/**'
- 'ent/**'
- 'Dockerfile'
- '.github/workflows/ci.yml'
pull_request:
branches: [ main ]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'web/**'
- 'ent/**'
- '.github/workflows/ci.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache-dependency-path: go.sum
- name: Install pnpm
run: npm install -g pnpm
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
cache-dependency-path: web/pnpm-lock.yaml
- name: Frontend install
working-directory: web
run: pnpm install --frozen-lockfile
- name: Frontend lint
working-directory: web
run: pnpm lint
- name: Frontend format check
working-directory: web
run: pnpm format:check
- name: Frontend build
working-directory: web
run: pnpm build
- name: Download Go dependencies
run: go mod download
- name: Install swag
run: go install github.com/swaggo/swag/cmd/swag@latest
- name: Generate code (ent & swagger)
run: go generate ./...
- name: Go fmt check
run: |
DIFF=$(gofmt -l .)
if [ -n "$DIFF" ]; then
echo "Files not formatted:"
echo "$DIFF"
exit 1
fi
- name: Go vet
run: go vet ./...
- name: Run tests
run: go test -v ./...
release:
runs-on: ubuntu-latest
needs: [ check ]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.VERSION }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max