Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
if_false: ${{ steps.bumpr.outputs.next_version }}

# Create release.
- uses: actions/create-release@v1
- uses: actions/create-release@v1.1.4
id: create_release
if: ${{ steps.tag.outputs.value != '' }}
env:
Expand All @@ -50,15 +50,15 @@ jobs:
with:
go-version: 1.24.x

# Build release
# Build release using Makefile
- name: Build project
if: ${{ steps.tag.outputs.value != '' }}
env:
RELEASE_VERSION: ${{ steps.tag.outputs.value }}
run: |
./scripts/build.sh
make build-all

# Deploy Docker release
# Deploy Docker release using Makefile
- name: Deploy Docker image
if: ${{ steps.tag.outputs.value != '' }}
env:
Expand All @@ -69,64 +69,64 @@ jobs:
GH_USER: ${{ github.actor }}
GH_PASS: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/deploy.sh
make docker-deploy

- name: Upload Linux 386
id: upload-release-l386
if: ${{ steps.tag.outputs.value != '' }}
uses: actions/upload-release-asset@v1
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./gulp.linux-386.tar.gz
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/gulp.linux-386.tar.gz
asset_name: gulp.linux-386.tar.gz
asset_content_type: application/gzip

- name: Upload Linux amd64
id: upload-release-l64
uses: actions/upload-release-asset@v1
uses: actions/upload-release-asset@v1.0.2
if: ${{ steps.tag.outputs.value != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./gulp.linux-amd64.tar.gz
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/gulp.linux-amd64.tar.gz
asset_name: gulp.linux-amd64.tar.gz
asset_content_type: application/gzip

- name: Upload Darwin amd64
id: upload-release-d64
if: ${{ steps.tag.outputs.value != '' }}
uses: actions/upload-release-asset@v1
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./gulp.darwin-amd64.tar.gz
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/gulp.darwin-amd64.tar.gz
asset_name: gulp.darwin-amd64.tar.gz
asset_content_type: application/gzip

- name: Upload Darwin arm64
id: upload-release-dArm64
if: ${{ steps.tag.outputs.value != '' }}
uses: actions/upload-release-asset@v1
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./gulp.darwin-arm64.tar.gz
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/gulp.darwin-arm64.tar.gz
asset_name: gulp.darwin-arm64.tar.gz
asset_content_type: application/gzip

- name: Upload Windows
id: upload-release-w
if: ${{ steps.tag.outputs.value != '' }}
uses: actions/upload-release-asset@v1
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./gulp.windows.zip
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/gulp.windows.zip
asset_name: gulp.windows.zip
asset_content_type: application/zip
36 changes: 35 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
- 'master'
pull_request:
workflow_dispatch:

name: Tests
jobs:
test:
Expand All @@ -19,6 +25,34 @@ jobs:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: ui/frontend/package-lock.json

- name: Install frontend dependencies
run: cd ui/frontend && npm ci

- name: Build frontend
run: cd ui/frontend && npm run build

- name: Copy frontend build to static directory
run: |
mkdir -p ui/static
cp -r ui/frontend/build/* ui/static/

- name: Lint and Vet
run: go vet ./...

Expand Down
48 changes: 46 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,49 @@
.glide/

.gulp.yml
*_test.*
gulp
gulp

coverage.txt
coverage.html

# Frontend / Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Production build
build/
dist/

# Generated frontend static files (served by Go backend)
ui/static/

# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# IDE files
.vscode/
.idea/
*.swp
*.swo

# macOS
.DS_Store

# Coverage directory used by tools like istanbul
coverage/

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed
*.pid.lock
160 changes: 160 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# GULP Build System v1.0+

This document describes the standardized build system for GULP v1.0 and later versions.

## Overview

Starting with v1.0, GULP uses a comprehensive Makefile-based build system that replaces the previous shell scripts. This provides better consistency, dependency management, and easier maintenance.

## Quick Start

```bash
# Build for current platform with timestamp snapshot
make build

# Build for all platforms
make build-all RELEASE_VERSION=1.2.3

# Full release pipeline
make release RELEASE_VERSION=1.2.3
```

## Build Targets

### Development Builds
- `make build` - Build for current platform with timestamp snapshot version
- `make snapshot` - Explicit snapshot build with timestamp
- `make build-version V=1.2.3` - Build with custom version
- `make run` - Build and run the application

### Release Builds
- `make build-all RELEASE_VERSION=1.2.3` - Build for all platforms
- `make release RELEASE_VERSION=1.2.3` - Complete release pipeline

### Docker
- `make docker-build RELEASE_VERSION=1.2.3` - Build Docker image
- `make docker-deploy RELEASE_VERSION=1.2.3` - Build and deploy to registries
- `make docker-clean` - Remove Docker images

### Development Tools
- `make test` - Run tests
- `make test-coverage` - Run tests with coverage report
- `make fmt` - Format code
- `make lint` - Run linter (requires golangci-lint)
- `make deps` - Install/update dependencies

### Utilities
- `make clean` - Remove build artifacts
- `make version` - Build and show version
- `make show-snapshot-version` - Show what snapshot version would be generated
- `make help` - Show all available targets

## Version Handling

### Snapshot Versions
Snapshot builds automatically generate timestamps in the format: `YYYYMMDD.HHMMAM/PM.TZ-SNAPSHOT`

Example: `20250602.1133AM.MDT-SNAPSHOT`

This is generated **at build time**, not runtime, ensuring consistent versions for each build.

### Release Versions
Release versions are specified via the `RELEASE_VERSION` environment variable:

```bash
make build-all RELEASE_VERSION=1.2.3
```

## Multi-Platform Builds

The `build-all` target creates binaries for:
- Linux 386 (`gulp.linux-386.tar.gz`)
- Linux AMD64 (`gulp.linux-amd64.tar.gz`)
- Darwin AMD64 (`gulp.darwin-amd64.tar.gz`)
- Darwin ARM64 (`gulp.darwin-arm64.tar.gz`)
- Windows AMD64 (`gulp.windows.zip`)

All builds are placed in the `./build/` directory.

## Docker Deployment

Docker deployment supports both Docker Hub and GitHub Container Registry:

```bash
# Set environment variables
export DOCKER_USER=your-dockerhub-username
export DOCKER_PASS=your-dockerhub-token
export GH_USER=your-github-username
export GH_PASS=your-github-token
export IMAGE_NAME=your-org/gulp

# Deploy
make docker-deploy RELEASE_VERSION=1.2.3
```

## CI/CD Integration

The GitHub Actions workflow (`.github/workflows/main.yml`) automatically uses the Makefile targets:

- **Build**: `make build-all`
- **Deploy**: `make docker-deploy`

## Migration from Shell Scripts

The following shell scripts have been replaced:

| Old Script | New Makefile Target |
|------------|-------------------|
| `scripts/build.sh` | `make build-all` |
| `scripts/deploy.sh` | `make docker-deploy` |

## Environment Variables

| Variable | Description | Required For |
|----------|-------------|--------------|
| `RELEASE_VERSION` | Version for releases | `build-all`, `docker-*`, `release` |
| `IMAGE_NAME` | Docker image name | `docker-deploy` |
| `DOCKER_USER` | Docker Hub username | `docker-deploy` |
| `DOCKER_PASS` | Docker Hub token | `docker-deploy` |
| `GH_USER` | GitHub username | `docker-deploy` |
| `GH_PASS` | GitHub token | `docker-deploy` |

## Example Workflows

### Local Development
```bash
# Start developing
make deps
make test
make build
make run

# Before committing
make fmt
make lint
make test-coverage
```

### Release Process
```bash
# Full release
make release RELEASE_VERSION=1.2.3

# Or step by step
make clean
make test
make build-all RELEASE_VERSION=1.2.3
make docker-deploy RELEASE_VERSION=1.2.3
```

### Snapshot Testing
```bash
# Show what version will be built
make show-snapshot-version

# Build snapshot
make snapshot

# Check version
make version
```
Loading
Loading