Skip to content

Commit

Permalink
chore(github): migrate CI/CD workflows to Deno
Browse files Browse the repository at this point in the history
Replaced Node.js and pnpm-based workflows with Deno equivalents across setup, testing, publishing, and release actions. Updated cache management, linter, and dependency installation steps to align with Deno's ecosystem. Simplified processes for consistency and modernized pipelines to better support the new toolchain.

Signed-off-by: suddenlyGiovanni <15946771+suddenlyGiovanni@users.noreply.github.com>
  • Loading branch information
suddenlyGiovanni committed Jan 28, 2025
1 parent d355737 commit 9ae4541
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 107 deletions.
24 changes: 24 additions & 0 deletions .github/CI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CI/CD

# Requirements:

- git `main` branch must only composed of released versions (tags)
- each change ending merged in main needs to:
- change the semver version number
- update the change log with corresponding description
- tag that commit with corresponding version number

```mermaid
graph TB
A[Start: Pull Request Created or Updated] --> B{Run Tests and Linters}
B -->|Tests Pass| C[Pull Request Merged]
B -->|Tests Fail| D[Fix Issues and Update Pull Request]
D --> B
C --> E[Increment Version Number and Update CHANGELOG.md]
E --> F[Commit and Tag with Version Number]
F --> G[New Tag Created]
G --> H[Trigger Deployment Process]
H --> I[Deployment Completed]
I --> J[Send Notification]
J --> K[End]
```
44 changes: 12 additions & 32 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,24 @@
name: πŸ’‰Setup the project
description: Perform standard setup and install dependencies using pnpm.
description: Perform standard setup and install dependencies using deno.
inputs:
github_token:
description: 'GitHub token'
required: true
deno_dir:
description: 'The directory where deno dependencies are stored.'
required: false
default: 'my_cache_directory' # Set DENO_DIR to an absolute or relative path on the runner.
runs:
using: composite
steps:
- name: πŸ› οΈ Install node
uses: actions/setup-node@v4
- name: πŸ› οΈ Install deno
uses: denoland/setup-deno@v2
with:
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'
deno-version: v2.x

- name: Configure .npmrc
shell: bash
run: echo "//npm.pkg.github.com/:_authToken=${{ inputs.github_token }}" >> ~/.npmrc


- name: πŸ—‚οΈ Install pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: 'package.json'
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
- name: Cache Deno dependencies
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
path: ${{ inputs.deno_dir }}
key: ${{ hashFiles('deno.lock') }}

- name: 🧩 Install dependencies
shell: bash
env:
NODE_AUTH_TOKEN: ${{ inputs.github_token }}
run: pnpm install --recursive --frozen-lockfile --prod=false
run: deno install
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 🎁 Publish
on:
workflow_dispatch:
release:
types: [ published ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: πŸ“₯ Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: πŸ“¦ Setup Deno and install deps
uses: ./.github/actions/setup

- name: πŸ“¦ Publish package to JSR
shell: bash
working-directory: ./packages/schema-resume
run: deno publish --dry-run
30 changes: 0 additions & 30 deletions .github/workflows/published.yml

This file was deleted.

45 changes: 39 additions & 6 deletions .github/workflows/pull-request-checks-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: πŸ”—Pull Request Checks Workflow

on:
pull_request:
branches:
Expand All @@ -14,16 +15,48 @@ jobs:
with:
fetch-depth: 0

- name: πŸ“¦ Setup Node, Pnpm and install deps
- name: πŸ“¦ Setup Deno and install deps
uses: ./.github/actions/setup

- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: latest

- name: type check
run: deno task --recursive typecheck

- name: type check docs
run: deno task --recursive typecheck --doc-only

- name: 🧬 check packages/resume code for errors (with Biome)
working-directory: ./packages/resume
run: |
biome ci \
--formatter-enabled=false \
--linter-enabled=true \
--organize-imports-enabled=false \
.
- name: 🧬 check packages/schema-resume code for errors (with Biome)
working-directory: ./packages/schema-resume
run: |
biome ci \
--formatter-enabled=false \
--linter-enabled=true \
--organize-imports-enabled=false \
.
- name: deno lint code
continue-on-error: true
run: deno lint packages/**/*.ts

- name: 🧬 check code for errors (with Biome)
run: pnpm run -r lint:ci --reporter=github
- name: deno lint docs
continue-on-error: true
run: deno doc --lint packages/**/*.ts

- name: πŸ§ͺ Run unit tests
run: pnpm exec vitest run --coverage
run: deno task test:all --coverage

- name: πŸ›« Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand All @@ -35,4 +68,4 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: πŸ¦‹ Require changesets
run: pnpm exec changeset status --since=origin/main
run: deno task changeset:status --since=origin/main
37 changes: 27 additions & 10 deletions .github/workflows/push-checks-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,36 @@ jobs:
with:
fetch-depth: 0

- name: πŸ‘£ Retrieve Git REF
run: echo "GIT_REF=$(git rev-parse origin/main)" >> $GITHUB_ENV

- name: πŸ“¦ Setup Node, Pnpm and install deps
uses: ./.github/actions/setup
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: latest

- name: πŸ’… Format packages/resume code (with Biome)
continue-on-error: false
run: |
biome check \
--vcs-enabled=true \
--vcs-use-ignore-file=true \
--vcs-root='.' \
--formatter-enabled=true \
--linter-enabled=false \
--organize-imports-enabled=true \
--write packages/resume
- name: πŸ’… Format code (with Biome)
continue-on-error: true
run: pnpm run -r format:write --since=${{ env.GIT_REF }}
- name: πŸ’… Format packages/schema-resume code (with Biome)
continue-on-error: false
run: |
biome check \
--vcs-enabled=true \
--vcs-use-ignore-file=true \
--vcs-root='.' \
--formatter-enabled=true \
--linter-enabled=false \
--organize-imports-enabled=true \
--write packages/schema-resume
- name: 🚦 Git Auto Commit Lint fixes (with Biome)
uses: stefanzweifel/git-auto-commit-action@v5.1.0
with:
commit_message: "chore: lint code with Biome [skip ci]"
commit_message: "chore: format code with Biome [skip ci]"
33 changes: 4 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,15 @@ jobs:
with:
fetch-depth: 0

- name: πŸ“¦ Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false

- name: πŸ—‚οΈ Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: πŸ› οΈ Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: "pnpm"

- name: πŸ—„οΈ Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 🧩 Install dependencies
run: pnpm install --frozen-lockfile --prod=false
- name: πŸ“¦ Setup Deno and install deps
uses: ./.github/actions/setup

- name: πŸ¦‹ Create a Changeset Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: "pnpm run changeset:version"
version: "deno task changeset:version"
commit: "chore(πŸ¦‹): update versions"
title: "chore(πŸ¦‹): Update Package Version"
createGithubReleases: true
createGithubReleases: false

0 comments on commit 9ae4541

Please sign in to comment.