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
2 changes: 2 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ on:

jobs:
build:
name: Build Docker Image
permissions:
contents: read
uses: ./.github/workflows/docker-build.yml

publish:
name: Publish Docker Image
needs: build
permissions:
contents: read
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
pull_request:
push:
branches:
- main
workflow_dispatch:
Comment thread
IvanGodinez21 marked this conversation as resolved.

jobs:
coverage-collect:
name: Run tests and collect coverage
permissions:
contents: read
uses: ./.github/workflows/coverage-collect.yml

coverage-upload:
name: Upload coverage
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
permissions:
contents: read
needs: coverage-collect
uses: ./.github/workflows/coverage-upload.yml
secrets: inherit
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Coverage

on:
pull_request:
push:
branches:
- main
workflow_dispatch:
workflow_call:

jobs:
collect-and-upload-coverage:
name: Run tests, collect and upload coverage
collect-coverage:
name: Run tests and collect coverage
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: 🏗️ Setup repository
uses: actions/checkout@v4
Expand All @@ -22,7 +22,9 @@ jobs:
- name: 🧪 Run tests and collect coverage
run: bun test --coverage

- name: 📤 Upload coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@v1.3.0
- name: 📦 Upload coverage artifact
uses: actions/upload-artifact@v4
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
name: coverage-report
path: coverage
if-no-files-found: error
36 changes: 36 additions & 0 deletions .github/workflows/coverage-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Coverage Upload

on:
workflow_call:
secrets:
CODACY_PROJECT_TOKEN:
required: false

jobs:
upload-coverage:
name: Upload coverage to Codacy
runs-on: ubuntu-latest
permissions:
contents: read
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
steps:
- name: 📥 Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage

- name: ✅ Validate downloaded coverage files
run: |
test -d coverage && [ -n "$(find coverage -type f -print -quit)" ] || {
echo "Coverage artifact is missing or empty"
exit 1
}

- name: 📤 Upload coverage to Codacy
if: env.CODACY_PROJECT_TOKEN != ''
uses: codacy/codacy-coverage-reporter-action@v1.3.0
with:
project-token: ${{ env.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/**
4 changes: 2 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ on:

jobs:
build-image:
name: Build Docker Image
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: 🏗️ Checkout
uses: actions/checkout@v4
Expand All @@ -26,6 +25,7 @@ jobs:
type=ref,event=tag
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=raw,value=development,enable=${{ github.ref == 'refs/heads/main' }}
Comment thread
IvanGodinez21 marked this conversation as resolved.
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
type=sha

- name: 🏗️ Build image
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ on:

jobs:
publish-ghcr:
name: Publish to GHCR
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: 📦 Download image
uses: actions/download-artifact@v4
Expand Down
Loading