Skip to content

feat: server-side pagination for job list APIs (#193) #183

feat: server-side pagination for job list APIs (#193)

feat: server-side pagination for job list APIs (#193) #183

Workflow file for this run

# Copyright 2025 RAIDS Lab
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Backend PR Check
on:
pull_request:
branches: [main]
paths:
- "backend/**"
- ".github/workflows/backend-pr.yml"
env:
GOLANGCI_LINT_VERSION: v2.6.2
jobs:
backend-lint-check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: "backend/go.mod"
cache-dependency-path: backend/go.sum
- name: Download dependencies
run: |
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go mod download
- name: Prepare upstream base for lint-diff
run: |
if ! git remote get-url upstream >/dev/null 2>&1; then
git remote add upstream https://github.com/raids-lab/crater.git
fi
git fetch upstream main --depth=1
- name: Run make lint
run: make lint
backend-build-check:
runs-on: ubuntu-latest
needs: backend-lint-check
defaults:
run:
working-directory: backend
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: "backend/go.mod"
cache-dependency-path: backend/go.sum
- name: Download dependencies
run: |
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go mod download
- name: Swag
run: make docs
shell: bash
- name: Set version variables
id: set-version
run: |
COMMIT_SHA="${{ github.sha }}"
SHORT_SHA="${COMMIT_SHA:0:7}"
# PR builds are always development builds
APP_VERSION="$SHORT_SHA"
BUILD_TYPE="development"
# Set outputs
echo "app_version=$APP_VERSION" >> $GITHUB_OUTPUT
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
echo "build_type=$BUILD_TYPE" >> $GITHUB_OUTPUT
echo "build_time=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
- name: Build backend binaries
run: |
mkdir -p bin/linux_amd64
go build -ldflags="-X main.AppVersion=${{ steps.set-version.outputs.app_version }} -X main.CommitSHA=${{ steps.set-version.outputs.commit_sha }} -X main.BuildType=${{ steps.set-version.outputs.build_type }} -X main.BuildTime=${{ steps.set-version.outputs.build_time }} -w -s" -o bin/linux_amd64/migrate cmd/gorm-gen/models/migrate.go
go build -ldflags="-X main.AppVersion=${{ steps.set-version.outputs.app_version }} -X main.CommitSHA=${{ steps.set-version.outputs.commit_sha }} -X main.BuildType=${{ steps.set-version.outputs.build_type }} -X main.BuildTime=${{ steps.set-version.outputs.build_time }} -w -s" -o bin/linux_amd64/controller cmd/crater/main.go
env:
CGO_ENABLED: 0