Skip to content

Add Continuous Integration workflow with Yarn support and security hardening#93

Merged
joe10832 merged 2 commits intomainfrom
copilot/fix-b77455d6-ecd5-4583-91ee-9e578b440dd4
Sep 30, 2025
Merged

Add Continuous Integration workflow with Yarn support and security hardening#93
joe10832 merged 2 commits intomainfrom
copilot/fix-b77455d6-ecd5-4583-91ee-9e578b440dd4

Conversation

Copy link
Contributor

Copilot AI commented Sep 29, 2025

This PR adds a comprehensive CI/CD pipeline to automate testing, linting, and building for the Onchain Test Kit project.

What's Added

New CI Workflow (.github/workflows/ci.yml):

  • Triggers on push and pull requests to the master branch
  • Runs on Ubuntu latest with proper Node.js 20 setup
  • Uses Yarn 4.9.2 via Corepack for consistent package management
  • Includes security hardening with step-security/harden-runner

CI Pipeline Steps

The workflow executes the following steps in order:

  1. Security Hardening - Uses step-security/harden-runner@v2 with egress policy auditing
  2. Source Checkout - Checks out the repository code
  3. Node.js Setup - Configures Node.js 20 environment
  4. Yarn Configuration - Enables Corepack and enforces Yarn 4.9.2
  5. Dependency Installation - Runs yarn install to install project dependencies
  6. Code Linting - Executes yarn lint using Biome for code quality checks
  7. Project Build - Runs yarn build to compile TypeScript to JavaScript
  8. Test Execution - Executes yarn test to run the Playwright test suite

Benefits

  • Automated Quality Assurance: Every push and PR is automatically tested
  • Consistent Environment: Uses the same Yarn version (4.9.2) specified in package.json
  • Security First: Implements security hardening and minimal permissions
  • Fast Feedback: Developers get immediate feedback on code changes
  • Build Verification: Ensures the project builds successfully before merging

Technical Details

The workflow properly handles the project's Yarn configuration by:

  • Enabling Corepack to manage Yarn versions
  • Setting the exact Yarn version (4.9.2) as specified in packageManager field
  • Using the existing npm scripts that are compatible with Yarn commands

All commands (lint, build, test) map directly to the scripts defined in package.json, ensuring consistency between local development and CI environments.

Original prompt

This section details on the original issue you should resolve

<issue_title>@copilot-setup-stepsname: Continuous Integration

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
ci:
runs-on: ubuntu-latest
environment: CI

steps:
  - name: Harden Runner
    uses: step-security/harden-runner@v2
    with:
      egress-policy: audit

  - name: Checkout Source
    uses: actions/checkout@v4

  - name: Set up Node.js
    uses: actions/setup-node@v4
    with:
      node-version: '20'

  - name: Enable Corepack and Enforce Yarn Version
    run: |
      corepack enable
      yarn set version 4.9.2

  - name: Install Dependencies
    run: yarn install

  - name: Run Linter
    run: yarn lint

  - name: Build Project
    run: yarn build

  - name: Run Tests
    run: yarn test</issue_title>

<issue_description>@copilot-setup-steps

Originally posted by @joe10832 in #79 (comment)</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #92

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: joe10832 <103850533+joe10832@users.noreply.github.com>
Copilot AI changed the title @copilot-setup-stepsname: Continuous Integration on: push: branches: [master] pull_request: branches: [master] permissions: contents: read jobs: ci: runs-on: ubuntu-latest environment: CI steps: - name: Harden Runn... Add Continuous Integration workflow with Yarn support and security hardening Sep 29, 2025
Copilot AI requested a review from joe10832 September 29, 2025 23:48
Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

@joe10832 joe10832 marked this pull request as ready for review September 30, 2025 01:41
Copilot AI review requested due to automatic review settings September 30, 2025 01:41
@joe10832 joe10832 merged commit 3e96feb into main Sep 30, 2025
3 checks passed
@joe10832 joe10832 removed their assignment Sep 30, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ Copilot-setup-steps Pull Request Overview

This PR adds a comprehensive CI/CD pipeline to automate testing, linting, and building for the Onchain Test Kit project. The workflow implements security hardening and uses Yarn 4.9.2 for consistent package management across environments.

Key Changes:

  • New GitHub Actions CI workflow that triggers on push/PR to master branch
  • Security hardening with step-security/harden-runner and minimal permissions
  • Automated pipeline with linting, building, and testing steps using Yarn commands

- name: Enable Corepack and Enforce Yarn Version
run: |
corepack enable
yarn set version 4.9.2
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The yarn set version command modifies the project's .yarnrc.yml file, which could cause issues in CI. Since the project already specifies packageManager: yarn@4.9.2 in package.json, consider using corepack prepare yarn@4.9.2 --activate instead to respect the existing configuration without modifying project files.

Suggested change
yarn set version 4.9.2
corepack prepare yarn@4.9.2 --activate

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Copilot

Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Copy link
Member

@joe10832 joe10832 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment