Skip to content
Merged
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
35 changes: 0 additions & 35 deletions .github/workflows/beta_docker_build_and_push.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/build_and_release.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/docker_build_and_push.yaml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/pull_request_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: pull request checks

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review

jobs:
cli-test:
name: CLI Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/cli
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: apps/cli/go.mod

- name: Run CLI tests
run: go test ./...

pwa-test:
name: PWA Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/pwa
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: apps/pwa/package-lock.json

- name: Install dependencies
run: npm ci

- name: Type-check PWA
run: npm run typecheck

- name: Build PWA
run: npm run build

- name: Run PWA tests
run: npm run test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

tmp/
build/
apps/cli/internal/ffmpeg/generated/
apps/cli/internal/ffmpeg/zz_bundle_*.go

# claude
.claude/
.claude/
90 changes: 63 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,55 +1,91 @@
.DEFAULT_GOAL := release

VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null || echo dev)
VERSION := $(shell node scripts/build_version.mjs latest-tag 2>/dev/null || echo unknown)
ROOT_DIR := $(CURDIR)
BUILD_DIR := $(ROOT_DIR)/build
CLI_DIR := $(ROOT_DIR)/apps/cli
FFMPEG_VERSION ?= unknown

define build_cli
cd $(CLI_DIR) && CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -tags prod -o $(3) .
cd $(CLI_DIR) && CGO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -tags prod -ldflags "-X cicada/internal/version.Version=$(VERSION)" -o $(3) .
endef

.PHONY: pwa release docker clean
define stage_ffmpeg_bundle
node scripts/prepare_ffmpeg_bundle.mjs --target $(1) --version "$(FFMPEG_VERSION)" $(if $($(2)),--archive "$($(2))") $(if $($(3)),--sha256 "$($(3))")
endef

.PHONY: pwa release docker clean ffmpeg-bundles ffmpeg-bundle-darwin-arm64 ffmpeg-bundle-darwin-amd64 ffmpeg-bundle-windows-amd64 ffmpeg-bundle-windows-arm64 ffmpeg-bundle-linux-amd64 ffmpeg-bundle-linux-arm64

## 构建 PWA 并嵌入 CLI
pwa:
npm ci --prefix apps/pwa
npm run build --prefix apps/pwa
CICADA_VERSION=$(VERSION) npm run build --prefix apps/pwa
rm -rf $(CLI_DIR)/pwa/dist
cp -R apps/pwa/dist $(CLI_DIR)/pwa/dist

ffmpeg-bundle-darwin-arm64:
$(call stage_ffmpeg_bundle,darwin-arm64,FFMPEG_ARCHIVE_DARWIN_ARM64,FFMPEG_SHA256_DARWIN_ARM64)

ffmpeg-bundle-darwin-amd64:
$(call stage_ffmpeg_bundle,darwin-amd64,FFMPEG_ARCHIVE_DARWIN_AMD64,FFMPEG_SHA256_DARWIN_AMD64)

ffmpeg-bundle-windows-amd64:
$(call stage_ffmpeg_bundle,windows-amd64,FFMPEG_ARCHIVE_WINDOWS_AMD64,FFMPEG_SHA256_WINDOWS_AMD64)

ffmpeg-bundle-windows-arm64:
$(call stage_ffmpeg_bundle,windows-arm64,FFMPEG_ARCHIVE_WINDOWS_ARM64,FFMPEG_SHA256_WINDOWS_ARM64)

ffmpeg-bundle-linux-amd64:
$(call stage_ffmpeg_bundle,linux-amd64,FFMPEG_ARCHIVE_LINUX_AMD64,FFMPEG_SHA256_LINUX_AMD64)

ffmpeg-bundle-linux-arm64:
$(call stage_ffmpeg_bundle,linux-arm64,FFMPEG_ARCHIVE_LINUX_ARM64,FFMPEG_SHA256_LINUX_ARM64)

ffmpeg-bundles: \
ffmpeg-bundle-darwin-arm64 \
ffmpeg-bundle-darwin-amd64 \
ffmpeg-bundle-windows-amd64 \
ffmpeg-bundle-windows-arm64 \
ffmpeg-bundle-linux-amd64 \
ffmpeg-bundle-linux-arm64

## 全平台构建发布包 (默认目标)
release: pwa
release: pwa ffmpeg-bundles
rm -rf $(BUILD_DIR)
mkdir -p $(BUILD_DIR)
$(call build_cli,darwin,arm64,$(BUILD_DIR)/cicada-darwin-arm64)
$(call build_cli,darwin,amd64,$(BUILD_DIR)/cicada-darwin-amd64)
$(call build_cli,windows,amd64,$(BUILD_DIR)/cicada-windows-amd64.exe)
$(call build_cli,windows,arm64,$(BUILD_DIR)/cicada-windows-arm64.exe)
$(call build_cli,linux,amd64,$(BUILD_DIR)/cicada-linux-amd64)
$(call build_cli,linux,arm64,$(BUILD_DIR)/cicada-linux-arm64)
cd $(BUILD_DIR) && \
tar -zcf cicada-macos-arm-$(VERSION).tar.gz cicada-darwin-arm64 && \
tar -zcf cicada-macos-x64-$(VERSION).tar.gz cicada-darwin-amd64 && \
tar -zcf cicada-windows-x64-$(VERSION).tar.gz cicada-windows-amd64.exe && \
tar -zcf cicada-windows-arm-$(VERSION).tar.gz cicada-windows-arm64.exe && \
tar -zcf cicada-linux-x64-$(VERSION).tar.gz cicada-linux-amd64 && \
tar -zcf cicada-linux-arm-$(VERSION).tar.gz cicada-linux-arm64
rm \
$(BUILD_DIR)/cicada-darwin-arm64 \
$(BUILD_DIR)/cicada-darwin-amd64 \
$(BUILD_DIR)/cicada-windows-amd64.exe \
$(BUILD_DIR)/cicada-windows-arm64.exe \
$(BUILD_DIR)/cicada-linux-amd64 \
$(BUILD_DIR)/cicada-linux-arm64
mkdir -p $(BUILD_DIR)/darwin-arm64
$(call build_cli,darwin,arm64,$(BUILD_DIR)/darwin-arm64/cicada)
cd $(BUILD_DIR)/darwin-arm64 && tar -zcf ../cicada-$(VERSION)-darwin-arm64.tar.gz cicada
mkdir -p $(BUILD_DIR)/darwin-amd64
$(call build_cli,darwin,amd64,$(BUILD_DIR)/darwin-amd64/cicada)
cd $(BUILD_DIR)/darwin-amd64 && tar -zcf ../cicada-$(VERSION)-darwin-amd64.tar.gz cicada
mkdir -p $(BUILD_DIR)/windows-amd64
$(call build_cli,windows,amd64,$(BUILD_DIR)/windows-amd64/cicada.exe)
cd $(BUILD_DIR)/windows-amd64 && tar -zcf ../cicada-$(VERSION)-windows-amd64.tar.gz cicada.exe
mkdir -p $(BUILD_DIR)/windows-arm64
$(call build_cli,windows,arm64,$(BUILD_DIR)/windows-arm64/cicada.exe)
cd $(BUILD_DIR)/windows-arm64 && tar -zcf ../cicada-$(VERSION)-windows-arm64.tar.gz cicada.exe
mkdir -p $(BUILD_DIR)/linux-amd64
$(call build_cli,linux,amd64,$(BUILD_DIR)/linux-amd64/cicada)
cd $(BUILD_DIR)/linux-amd64 && tar -zcf ../cicada-$(VERSION)-linux-amd64.tar.gz cicada
mkdir -p $(BUILD_DIR)/linux-arm64
$(call build_cli,linux,arm64,$(BUILD_DIR)/linux-arm64/cicada)
cd $(BUILD_DIR)/linux-arm64 && tar -zcf ../cicada-$(VERSION)-linux-arm64.tar.gz cicada
rm -rf \
$(BUILD_DIR)/darwin-arm64 \
$(BUILD_DIR)/darwin-amd64 \
$(BUILD_DIR)/windows-amd64 \
$(BUILD_DIR)/windows-arm64 \
$(BUILD_DIR)/linux-amd64 \
$(BUILD_DIR)/linux-arm64

## 构建 Linux x64 二进制 (供 Docker 使用, 不压缩)
docker: pwa
docker: pwa ffmpeg-bundle-linux-amd64
rm -rf $(BUILD_DIR)
mkdir -p $(BUILD_DIR)
$(call build_cli,linux,amd64,$(BUILD_DIR)/cicada)
@echo 'skip compression on docker building.'

## 清理构建产物
clean:
rm -rf $(BUILD_DIR) apps/cli/pwa/dist apps/pwa/dist
rm -rf $(BUILD_DIR) apps/cli/pwa/dist apps/pwa/dist apps/cli/internal/ffmpeg/generated apps/cli/internal/ffmpeg/zz_bundle_*.go
3 changes: 3 additions & 0 deletions apps/apple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.xcuserstate
xcuserdata/
.derivedData/
Loading
Loading