Skip to content

Commit

Permalink
ci: migrate to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
cseas committed Dec 22, 2024
1 parent 7b03ee8 commit db6dcd4
Show file tree
Hide file tree
Showing 9 changed files with 7,666 additions and 21,021 deletions.
25 changes: 25 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Install npm packages
description: Installs npm packages and manages it's cache

env:
NODE_VERSION: 22.9.0

runs:
using: composite
steps:
# https://github.com/pnpm/action-setup?tab=readme-ov-file#use-cache-to-reduce-installation-time
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Setup Node.js v${{ env.NODE_VERSION }} with pnpm cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- name: Install Dependencies
shell: bash
run: pnpm install --frozen-lockfile
11 changes: 3 additions & 8 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install Dependencies
run: npm install
- name: Setup Cache & Install Dependencies
uses: ./.github/actions/install-dependencies

- name: Create Release Pull Request
uses: changesets/action@v1
Expand Down
25 changes: 11 additions & 14 deletions .github/workflows/nextjs_bundle_analysis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

name: 'Next.js Bundle Analysis'
name: "Next.js Bundle Analysis"

on:
pull_request:
Expand All @@ -24,24 +24,21 @@ jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
uses: bahmutov/npm-install@v1
node-version: 22

# If pnpm is used, you need to switch the previous step with the following one. pnpm does not create a package-lock.json
# so the step above will fail to pull dependencies
# - uses: pnpm/action-setup@v2
# name: Install pnpm
# id: pnpm-install
# with:
# version: 7
# run_install: true
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 9
run_install: true

- name: Restore next build
uses: actions/cache@v3
Expand Down Expand Up @@ -110,7 +107,7 @@ jobs:
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: '<!-- __NEXTJS_BUNDLE -->'
body-includes: "<!-- __NEXTJS_BUNDLE -->"

- name: Create Comment
uses: peter-evans/create-or-update-comment@v2
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Validate

on:
pull_request:
types:
- opened
- reopened
- synchronize

env:
NODE_VERSION: 22.9.0

jobs:
validate:
name: Validate Source Code
if: |
!((github.actor == 'github-actions[bot]' || contains(github.event.pull_request.title, 'ci: update version & changelog')) && github.head_ref == 'changeset-release/main')
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v4

- name: Setup Cache & Install Dependencies
uses: ./.github/actions/install-dependencies

- name: Print timezone for timezone based tests
run: date

- name: Lint Source Code
run: pnpm run lint

- name: Run TypeScript Checks
run: pnpm run typecheck

- name: Build
run: pnpm run build

# test:
# name: Run Tests
# if: |
# !((github.actor == 'rzpcibot' || contains(github.event.pull_request.title, 'build(onboarding-sdk): update version')) && github.head_ref == 'changeset-release/master')
# runs-on: self-hosted
# steps:
# - name: Checkout Codebase
# uses: actions/checkout@v4
# - name: Use Node v${{ env.NODE_VERSION }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ env.NODE_VERSION }}
# - name: Setup Cache & Install Dependencies
# uses: ./.github/actions/install-dependencies
# - name: Run Unit Tests
# run: pnpm test:coverage
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,4 @@ Code for my personal blog, hosted at [blog.absingh.com][1].
- [ ] use Inter variable font from @next/font
- [ ] dig command, post: powershell-ip

### Runtime software versions

| Name | Version |
| ---- | ------- |
| node | v22.9.0 |
| npm | 10.8.3 |

[1]: https://blog.absingh.com/
Loading

0 comments on commit db6dcd4

Please sign in to comment.