Add GitHub Actions CI workflows
Avelyn Hyunjeong Choi
Posted on November 19, 2023
Issue
- Add a GitHub Actions workflow to run the
test
script on each push and pull request. - Issue
Process
Added a .github/workflows/ci.yml
file for creating a GitHub Actions CI workflow as below.
name: CI
on:
pull_request:
push:
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
Outcome
What I Learned
This week at school, I learned new skills in setting up Continuous Integration (CI) pipelines. It presented an great opportunity to apply this knowledge where it was needed. In particular, I worked on the ci.yml
file, maintaining a consistent structure while accommodating specific requests from the repo owner. For example, the owner wanted the CI workflow to run on all pull requests and pushes, not just on the main branch. Therefore, I removed the branch restriction. Another adjustment involved splitting the process into two steps: one for installing dependencies and the other for running tests.
Progress from release 0.2
This PR was my first attempt at creating a pull request from scratch. Unlike other PRs I've worked on, this one lacked an existing codebase for the CI workflows. So, it could have been a more challenging task. Fortunately, my recent learning of CI pipeline concepts made the process feel familiar, as the knowledge was still fresh in my memory. As a result, achieving the same goal for a different repository wasn't as challenging as I initially thought.
My previous PRs in release 0.2
Posted on November 19, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.