Merge pull request 'Migrate CI/CD from GitHub Actions to Forgejo Actions' (#1) from chore/forgejo-actions into main
Reviewed-on: #1
This commit is contained in:
commit
85b3317f9a
3 changed files with 25 additions and 78 deletions
|
|
@ -5,21 +5,18 @@ on:
|
||||||
- main
|
- main
|
||||||
pull_request: {}
|
pull_request: {}
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
actions: write
|
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cancel:
|
|
||||||
name: 🛑 Cancel Previous Runs
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: styfle/cancel-workflow-action@0.12.1
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: 🧪 Test
|
name: 🧪 Test
|
||||||
needs: [cancel]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
|
|
@ -33,18 +30,10 @@ jobs:
|
||||||
--health-interval 10s
|
--health-interval 10s
|
||||||
--health-timeout 5s
|
--health-timeout 5s
|
||||||
--health-retries 5
|
--health-retries 5
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: ⬇️ Checkout repo
|
- name: ⬇️ Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: ⎔ Setup node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: 📥 Install dependencies
|
- name: 📥 Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -52,22 +41,16 @@ jobs:
|
||||||
- name: 🧪 Run unit tests
|
- name: 🧪 Run unit tests
|
||||||
run: npm run test:run
|
run: npm run test:run
|
||||||
env:
|
env:
|
||||||
DATABASE_URL: postgresql://test:test@localhost:5432/brackt_test
|
DATABASE_URL: postgresql://test:test@postgres:5432/brackt_test
|
||||||
NODE_OPTIONS: --max-old-space-size=4096
|
NODE_OPTIONS: --max-old-space-size=4096
|
||||||
|
|
||||||
typecheck:
|
typecheck:
|
||||||
name: ʦ TypeScript
|
name: ʦ TypeScript
|
||||||
needs: [cancel]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- name: ⬇️ Checkout repo
|
- name: ⬇️ Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: ⎔ Setup node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: 📥 Install dependencies
|
- name: 📥 Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -77,17 +60,11 @@ jobs:
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: 🔍 Lint
|
name: 🔍 Lint
|
||||||
needs: [cancel]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- name: ⬇️ Checkout repo
|
- name: ⬇️ Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: ⎔ Setup node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: 📥 Install dependencies
|
- name: 📥 Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -98,42 +75,42 @@ jobs:
|
||||||
build:
|
build:
|
||||||
name: 🐳 Build
|
name: 🐳 Build
|
||||||
needs: [test, typecheck, lint]
|
needs: [test, typecheck, lint]
|
||||||
# only build/deploy main branch on pushes
|
|
||||||
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- name: ⬇️ Checkout repo
|
- name: ⬇️ Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: 🐳 Set up Docker Buildx
|
- name: 🐳 Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: 🔓 Login to Container Registry
|
- name: 🔓 Login to Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: https://github.com/docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.CONTAINER_REGISTRY }}
|
registry: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
- name: 🗄️ Build and Push to Container Registry
|
- name: 🗄️ Build and Push to Container Registry
|
||||||
uses: docker/build-push-action@v5
|
uses: https://github.com/docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ vars.CONTAINER_REGISTRY }}/brackt:latest
|
tags: ${{ vars.CONTAINER_REGISTRY }}/brackt:latest
|
||||||
cache-from: type=gha
|
cache-from: type=registry,ref=${{ vars.CONTAINER_REGISTRY }}/brackt:buildcache
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=registry,ref=${{ vars.CONTAINER_REGISTRY }}/brackt:buildcache,mode=max
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: 🚀 Deploy
|
name: 🚀 Deploy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
needs: [build]
|
needs: [build]
|
||||||
# only deploy main branch on pushes
|
|
||||||
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 🚀 Deploy app to server
|
- name: 🚀 Deploy app to server
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
uses: https://github.com/appleboy/ssh-action@v1.0.3
|
||||||
env:
|
env:
|
||||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
35
.github/workflows/label-subissues.yaml
vendored
35
.github/workflows/label-subissues.yaml
vendored
|
|
@ -1,35 +0,0 @@
|
||||||
name: Label Subissues
|
|
||||||
on:
|
|
||||||
issues:
|
|
||||||
types: [opened, edited]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
apply-label:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
steps:
|
|
||||||
- name: Check for Parent and Label
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
ISSUE_NODE_ID: ${{ github.event.issue.node_id }}
|
|
||||||
run: |
|
|
||||||
# Use GraphQL to check if this issue has a parent
|
|
||||||
PARENT_ID=$(gh api graphql -f query='
|
|
||||||
query($id: ID!) {
|
|
||||||
node(id: $id) {
|
|
||||||
... on Issue {
|
|
||||||
parent {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}' -f id=$ISSUE_NODE_ID --jq '.data.node.parent.id')
|
|
||||||
|
|
||||||
# If PARENT_ID is not null, it is a subissue
|
|
||||||
if [ "$PARENT_ID" != "null" ] && [ -n "$PARENT_ID" ]; then
|
|
||||||
echo "Subissue detected. Applying label..."
|
|
||||||
gh issue edit ${{ github.event.issue.number }} --add-label "subissue"
|
|
||||||
else
|
|
||||||
echo "This is a top-level issue."
|
|
||||||
fi
|
|
||||||
5
oxlint.json
Normal file
5
oxlint.json
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"unicorn/no-array-sort": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue