Archived
feat(ci): add GitHub Actions workflows for CI/CD
Adds automated build, test, and release pipelines: - build.yml: Run tests and build native images on push/PR - release.yml: Build and publish releases on tag push - update-homebrew.yml: Auto-update Homebrew formula on release Also adds CHANGELOG.md for tracking releases. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f046bfd48
commit
767a941ac3
4 files changed
+300
No files matched your search
@@ -0,0 +1,97 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Run tests
|
||||
run: mvn verify -Dspotbugs.skip=true -Dpmd.skip=true
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: test-results
|
||||
path: target/surefire-reports/
|
||||
|
||||
build-jar:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Build JAR
|
||||
run: mvn package -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true
|
||||
|
||||
- name: Upload JAR
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: barn-jar
|
||||
path: target/barn-*.jar
|
||||
retention-days: 7
|
||||
|
||||
build-native:
|
||||
needs: test
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
artifact: barn-linux-x64
|
||||
- os: macos-latest
|
||||
artifact: barn-macos-arm64
|
||||
- os: macos-13
|
||||
artifact: barn-macos-x64
|
||||
- os: windows-latest
|
||||
artifact: barn-windows-x64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GraalVM
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'graalvm-community'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Build native image (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
mvn package -Pnative -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true
|
||||
mv target/barn target/${{ matrix.artifact }}
|
||||
|
||||
- name: Build native image (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
mvn package -Pnative -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true
|
||||
mv target/barn.exe target/${{ matrix.artifact }}.exe
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: target/${{ matrix.artifact }}*
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,96 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-native:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
artifact: barn-linux-x64
|
||||
- os: macos-latest
|
||||
artifact: barn-macos-arm64
|
||||
- os: macos-13
|
||||
artifact: barn-macos-x64
|
||||
- os: windows-latest
|
||||
artifact: barn-windows-x64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GraalVM
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'graalvm-community'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Build native image (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
mvn package -Pnative -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true
|
||||
mv target/barn target/${{ matrix.artifact }}
|
||||
|
||||
- name: Build native image (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
mvn package -Pnative -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true
|
||||
mv target/barn.exe target/${{ matrix.artifact }}.exe
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: target/${{ matrix.artifact }}*
|
||||
|
||||
release:
|
||||
needs: build-native
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts/
|
||||
|
||||
- name: Prepare release files
|
||||
run: |
|
||||
mkdir release
|
||||
find artifacts -type f -exec mv {} release/ \;
|
||||
cd release
|
||||
sha256sum * > SHA256SUMS
|
||||
ls -la
|
||||
|
||||
- name: Extract version
|
||||
id: version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Extract changelog
|
||||
id: changelog
|
||||
run: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
if [ -f CHANGELOG.md ]; then
|
||||
sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | head -n -1 > release_notes.md || true
|
||||
fi
|
||||
if [ ! -s release_notes.md ]; then
|
||||
echo "Release $VERSION" > release_notes.md
|
||||
fi
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
body_path: release_notes.md
|
||||
files: release/*
|
||||
draft: false
|
||||
prerelease: ${{ contains(github.ref, '-') }}
|
||||
@@ -0,0 +1,82 @@
|
||||
name: Update Homebrew
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
update-homebrew:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get release info
|
||||
id: release
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get checksums from release
|
||||
curl -sL "https://github.com/${{ github.repository }}/releases/download/v${VERSION}/SHA256SUMS" -o SHA256SUMS
|
||||
|
||||
MACOS_ARM64_SHA=$(grep barn-macos-arm64 SHA256SUMS | awk '{print $1}')
|
||||
MACOS_X64_SHA=$(grep barn-macos-x64 SHA256SUMS | awk '{print $1}')
|
||||
|
||||
echo "macos_arm64_sha=$MACOS_ARM64_SHA" >> $GITHUB_OUTPUT
|
||||
echo "macos_x64_sha=$MACOS_X64_SHA" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Checkout homebrew tap
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: samson-media/homebrew-barn
|
||||
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
||||
path: homebrew-tap
|
||||
|
||||
- name: Update formula
|
||||
run: |
|
||||
cat > homebrew-tap/Formula/barn.rb << 'EOF'
|
||||
class Barn < Formula
|
||||
desc "Cross-platform job daemon for media processing"
|
||||
homepage "https://github.com/samson-media/barn"
|
||||
version "${{ steps.release.outputs.version }}"
|
||||
license "MIT"
|
||||
|
||||
on_macos do
|
||||
on_arm do
|
||||
url "https://github.com/samson-media/barn/releases/download/v${{ steps.release.outputs.version }}/barn-macos-arm64"
|
||||
sha256 "${{ steps.release.outputs.macos_arm64_sha }}"
|
||||
|
||||
def install
|
||||
bin.install "barn-macos-arm64" => "barn"
|
||||
end
|
||||
end
|
||||
|
||||
on_intel do
|
||||
url "https://github.com/samson-media/barn/releases/download/v${{ steps.release.outputs.version }}/barn-macos-x64"
|
||||
sha256 "${{ steps.release.outputs.macos_x64_sha }}"
|
||||
|
||||
def install
|
||||
bin.install "barn-macos-x64" => "barn"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
service do
|
||||
run [opt_bin/"barn", "service", "run"]
|
||||
keep_alive true
|
||||
log_path var/"log/barn.log"
|
||||
error_log_path var/"log/barn.error.log"
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match "barn", shell_output("#{bin}/barn --version")
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
cd homebrew-tap
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "actions@github.com"
|
||||
git add Formula/barn.rb
|
||||
git commit -m "Update barn to ${{ steps.release.outputs.version }}"
|
||||
git push
|
||||
@@ -0,0 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Initial release
|
||||
- Job daemon with filesystem-based state management
|
||||
- Cross-platform support (Windows, macOS, Linux)
|
||||
- Service management (install, start, stop, status)
|
||||
- Job management (run, status, describe, kill, clean)
|
||||
- Resource usage monitoring
|
||||
- IPC communication between CLI and service
|
||||
- Shell autocompletion (bash, zsh)
|
||||
- Retry mechanism with exponential backoff
|
||||
|
||||
### Fixed
|
||||
- Jobs that fail to start now properly transition to FAILED state
|
||||
- Startup errors are written to stderr.log for visibility
|
||||
|
||||
[Unreleased]: https://github.com/samson-media/barn/compare/main...HEAD
|
||||
Reference in new issue
Block a user