chore(refactor): fixed code quality issues #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| paths-ignore: | |
| - "badges/coverage.svg" | |
| pull_request: | |
| branches: [ "**" ] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Lint | |
| run: bun run lint | |
| - name: Test with coverage (text + lcov) | |
| run: bun test --coverage --coverage-reporter=text --coverage-reporter=lcov | |
| - name: Build | |
| run: bun run build | |
| - name: Generate coverage badge | |
| uses: GoogleCloudPlatform/lcov-coverage-badge@v1.0.0 | |
| with: | |
| file: coverage/lcov.info | |
| - name: Place badge where we want it | |
| run: | | |
| mkdir -p badges | |
| if [ -f coverage.svg ]; then | |
| mv -f coverage.svg badges/coverage.svg | |
| elif [ -f coverage/coverage.svg ]; then | |
| mv -f coverage/coverage.svg badges/coverage.svg | |
| elif ls *.svg 1> /dev/null 2>&1; then | |
| mv -f $(ls -t *.svg | head -n1) badges/coverage.svg | |
| else | |
| echo "No coverage badge found; skipping move" | |
| fi | |
| - name: Commit coverage badge | |
| if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} | |
| run: | | |
| if [ -n "$(git status --porcelain badges/coverage.svg)" ]; then | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@users.noreply.github.com" | |
| git add badges/coverage.svg | |
| git commit -m "ci: update coverage badge" | |
| git push || true | |
| fi | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-lcov | |
| path: coverage/lcov.info |