Skip to content

feat(spec): add build-time custom step types #3601

feat(spec): add build-time custom step types

feat(spec): add build-time custom step types #3601

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-*"
paths:
- "**.go"
- "go.mod"
- "go.sum"
- "Makefile"
- ".github/workflows/ci.yaml"
pull_request:
# Keep this workflow directly rerunnable from PR-only maintenance commits.
types:
- opened
- reopened # new commits are pushed to the branch that the PR is based on
- synchronize # new commits are pushed to the branch that the PR is based on
- ready_for_review # PR is ready for review
paths:
- "**.go"
- "go.mod"
- "go.sum"
- "Makefile"
- ".github/workflows/ci.yaml"
env:
GO_VERSION: "1.26"
jobs:
# Lint Go code
golint:
name: Go Linter
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Check formatting (go fmt)
run: |
go fmt ./...
# Fail if formatting changed any files
git diff --exit-code || (echo "Go files are not formatted. Please run 'make fmt'" && exit 1)
- name: Check modernize (go fix)
run: |
diff=$(go fix -diff ./... 2>&1) || true
if [ -n "$diff" ]; then
echo "Go files need modernization. Please run 'make fmt'"
echo "$diff"
exit 1
fi
- name: Run golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v2.9.0
args: --timeout=10m
# Test Go code on multiple platforms
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - windows-latest
steps:
- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
if: runner.os != 'Windows'
run: |
make bin
- name: Build (Windows)
if: runner.os == 'Windows'
run: |
go build -o .\.local\bin\dagu.exe .\cmd
- name: Test
if: runner.os != 'Windows'
run: |
make test-coverage
- name: Test (Windows)
if: runner.os == 'Windows'
run: |
go test -v -race .\...
- name: Upload coverage
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
files: ./coverage.out
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}