feat: added first workflow
This commit is contained in:
120
.gitea/workflows/ci.yml
Normal file
120
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,120 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
jobs:
|
||||
install:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: oven/bun:alpine
|
||||
outputs:
|
||||
cache-key: ${{ steps.cache-key.outputs.key }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate cache key
|
||||
id: cache-key
|
||||
run: echo "key=bun-${{ hashFiles('**/bun.lock') }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ steps.cache-key.outputs.key }}
|
||||
restore-keys: |
|
||||
bun-
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
type-check:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: oven/bun:alpine
|
||||
needs: install
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Restore node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ needs.install.outputs.cache-key }}
|
||||
restore-keys: |
|
||||
bun-
|
||||
|
||||
- name: Run type checking
|
||||
run: bun run check
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: oven/bun:alpine
|
||||
needs: install
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Restore node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ needs.install.outputs.cache-key }}
|
||||
restore-keys: |
|
||||
bun-
|
||||
|
||||
- name: Run linting
|
||||
run: bun run lint
|
||||
|
||||
format-check:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: oven/bun:alpine
|
||||
needs: install
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Restore node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ needs.install.outputs.cache-key }}
|
||||
restore-keys: |
|
||||
bun-
|
||||
|
||||
- name: Check formatting
|
||||
run: bun exec prettier --check .
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: oven/bun:alpine
|
||||
needs: install
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Restore node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ needs.install.outputs.cache-key }}
|
||||
restore-keys: |
|
||||
bun-
|
||||
|
||||
- name: Build application
|
||||
run: bun run build
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-output
|
||||
path: build/
|
||||
retention-days: 7
|
||||
Reference in New Issue
Block a user