ci: split into dedicated scraper and ui workflows
This commit is contained in:
76
.gitea/workflows/ci-scraper.yaml
Normal file
76
.gitea/workflows/ci-scraper.yaml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: CI / Scraper
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main", "master"]
|
||||||
|
paths:
|
||||||
|
- "scraper/**"
|
||||||
|
- ".gitea/workflows/ci-scraper.yaml"
|
||||||
|
pull_request:
|
||||||
|
branches: ["main", "master"]
|
||||||
|
paths:
|
||||||
|
- "scraper/**"
|
||||||
|
- ".gitea/workflows/ci-scraper.yaml"
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: scraper
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ── lint & vet ───────────────────────────────────────────────────────────────
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: scraper/go.mod
|
||||||
|
cache-dependency-path: scraper/go.sum
|
||||||
|
|
||||||
|
- name: go vet
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
|
- name: staticcheck
|
||||||
|
run: go tool staticcheck ./...
|
||||||
|
|
||||||
|
# ── tests ────────────────────────────────────────────────────────────────────
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: scraper/go.mod
|
||||||
|
cache-dependency-path: scraper/go.sum
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -race -count=1 -timeout=60s ./...
|
||||||
|
|
||||||
|
# ── build binary ─────────────────────────────────────────────────────────────
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint, test]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: scraper/go.mod
|
||||||
|
cache-dependency-path: scraper/go.sum
|
||||||
|
|
||||||
|
- name: Build binary
|
||||||
|
run: |
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||||
|
go build -ldflags="-s -w" -o bin/scraper ./cmd/scraper
|
||||||
|
|
||||||
|
- name: Upload binary artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: scraper-linux-amd64
|
||||||
|
path: scraper/bin/scraper
|
||||||
|
retention-days: 7
|
||||||
40
.gitea/workflows/ci-ui.yaml
Normal file
40
.gitea/workflows/ci-ui.yaml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: CI / UI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main", "master"]
|
||||||
|
paths:
|
||||||
|
- "ui/**"
|
||||||
|
- ".gitea/workflows/ci-ui.yaml"
|
||||||
|
pull_request:
|
||||||
|
branches: ["main", "master"]
|
||||||
|
paths:
|
||||||
|
- "ui/**"
|
||||||
|
- ".gitea/workflows/ci-ui.yaml"
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ui
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ── type-check & build ───────────────────────────────────────────────────────
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: ui/package-lock.json
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
run: npm run check
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ["main", "master"]
|
|
||||||
paths:
|
|
||||||
- "scraper/**"
|
|
||||||
- "ui/**"
|
|
||||||
- ".gitea/workflows/**"
|
|
||||||
pull_request:
|
|
||||||
branches: ["main", "master"]
|
|
||||||
paths:
|
|
||||||
- "scraper/**"
|
|
||||||
- "ui/**"
|
|
||||||
- ".gitea/workflows/**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# ── scraper: lint & vet ──────────────────────────────────────────────────────
|
|
||||||
lint:
|
|
||||||
name: Lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: scraper
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version-file: scraper/go.mod
|
|
||||||
cache-dependency-path: scraper/go.sum
|
|
||||||
|
|
||||||
- name: go vet
|
|
||||||
run: go vet ./...
|
|
||||||
|
|
||||||
- name: staticcheck
|
|
||||||
run: go tool staticcheck ./...
|
|
||||||
|
|
||||||
# ── scraper: tests ───────────────────────────────────────────────────────────
|
|
||||||
test:
|
|
||||||
name: Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: scraper
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version-file: scraper/go.mod
|
|
||||||
cache-dependency-path: scraper/go.sum
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: go test -race -count=1 -timeout=60s ./...
|
|
||||||
|
|
||||||
# ── scraper: build binary ────────────────────────────────────────────────────
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [lint, test]
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: scraper
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version-file: scraper/go.mod
|
|
||||||
cache-dependency-path: scraper/go.sum
|
|
||||||
|
|
||||||
- name: Build binary
|
|
||||||
run: |
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
||||||
go build -ldflags="-s -w" -o bin/scraper ./cmd/scraper
|
|
||||||
|
|
||||||
- name: Upload binary artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: scraper-linux-amd64
|
|
||||||
path: scraper/bin/scraper
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
# ── ui: type-check & build ───────────────────────────────────────────────────
|
|
||||||
ui:
|
|
||||||
name: UI
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: ui
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "22"
|
|
||||||
cache: npm
|
|
||||||
cache-dependency-path: ui/package-lock.json
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Type check
|
|
||||||
run: npm run check
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
# ── docker build (& push) ────────────────────────────────────────────────────
|
|
||||||
# Uncomment once the runner has Docker available and a registry is configured.
|
|
||||||
#
|
|
||||||
# docker:
|
|
||||||
# name: Docker
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# needs: [lint, test]
|
|
||||||
# # Only push images on commits to the default branch, not on PRs.
|
|
||||||
# # if: github.event_name == 'push'
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v4
|
|
||||||
#
|
|
||||||
# - name: Log in to Gitea registry
|
|
||||||
# uses: docker/login-action@v3
|
|
||||||
# with:
|
|
||||||
# registry: gitea.kalekber.cc
|
|
||||||
# username: ${{ secrets.REGISTRY_USER }}
|
|
||||||
# password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
#
|
|
||||||
# - name: Build and push
|
|
||||||
# uses: docker/build-push-action@v5
|
|
||||||
# with:
|
|
||||||
# context: ./scraper
|
|
||||||
# push: true
|
|
||||||
# tags: |
|
|
||||||
# gitea.kalekber.cc/kamil/libnovel:latest
|
|
||||||
# gitea.kalekber.cc/kamil/libnovel:${{ gitea.sha }}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Release
|
name: Release / Scraper
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -43,36 +43,11 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test -race -count=1 -timeout=60s ./...
|
run: go test -race -count=1 -timeout=60s ./...
|
||||||
|
|
||||||
# ── ui: type-check & build ───────────────────────────────────────────────────
|
# ── build & publish release ──────────────────────────────────────────────────
|
||||||
ui:
|
|
||||||
name: UI
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: ui
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "22"
|
|
||||||
cache: npm
|
|
||||||
cache-dependency-path: ui/package-lock.json
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Type check
|
|
||||||
run: npm run check
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
# ── build & release ──────────────────────────────────────────────────────────
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [lint, test, ui]
|
needs: [lint, test]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
33
.gitea/workflows/release-ui.yaml
Normal file
33
.gitea/workflows/release-ui.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Release / UI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ui
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ── type-check & build ───────────────────────────────────────────────────────
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: ui/package-lock.json
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
run: npm run check
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
Reference in New Issue
Block a user