본문 바로가기

개발

github actions

 

github actions 파일 작성을 해볼 기회가 생겼다!

아마 린트, 타입체크 정도 하게 될 것 같고

배포 관련해서도 작성할 수 있을듯.

 

 

🔎 참고하기 좋은 깃헙

순서대로 어려워짐

https://github.com/humonnom/size-table/blob/main/.github/workflows/test.yaml

 

size-table/.github/workflows/test.yaml at main · humonnom/size-table

Contribute to humonnom/size-table development by creating an account on GitHub.

github.com

 

https://github.com/testing-library/react-testing-library/blob/main/.github/workflows/validate.yml

 

react-testing-library/.github/workflows/validate.yml at main · testing-library/react-testing-library

🐐 Simple and complete React DOM testing utilities that encourage good testing practices. - testing-library/react-testing-library

github.com

 

https://github.com/vercel/next.js/blob/canary/.github/workflows/build_and_test.yml

 

next.js/.github/workflows/build_and_test.yml at canary · vercel/next.js

The React Framework. Contribute to vercel/next.js development by creating an account on GitHub.

github.com

 

 

💡 아이디어

🤔 CI, CD 따로 yaml(야믈 이라고 읽는다.) 파일 작성해볼까?

 

📖 더 찾아보고 싶은 내용

IaC: Infrastructure as Code

 

💊 본문

 

 

 

🏃 Jobs

needs: 의존성. 순차 실행 가능

if: 조건부 실행

secrets: 민감한 정보 👉 settings > security > Secrets and variables > Actions > Repository secrets 에서 설정

 

마켓플레이스에 있는 github actions 예시

https://github.com/marketplace/actions/close-stale-issues

 

Close Stale Issues - GitHub Marketplace

Close issues and pull requests with no recent activity

github.com

오래된 PR을 지워주는 action이다.

permissions 부분을 주의해야 한다.

실제 사용 예시

https://github.com/jestjs/jest/blob/main/.github/workflows/close-stale.yml

 

jest/.github/workflows/close-stale.yml at main · jestjs/jest

Delightful JavaScript Testing. Contribute to jestjs/jest development by creating an account on GitHub.

github.com

 

 

강사님이 추천해주신 코드 커버리지 관련 action

https://github.com/marketplace/codecov

https://github.com/marketplace/actions/codecov

 

Codecov - GitHub Marketplace

GitHub Action that uploads coverage reports for your repository to codecov.io

github.com

 

codecov 쓸거면 package.json에서 "test": "jest --coverage"로 바꿔줘야 한다. 관련 설명

https://jestjs.io/docs/cli#--coverageboolean

 

Jest CLI Options · Jest

The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of the options shown below can also be used together to run tests exactly the way you want. Every one of Jest's Configuration options c

jestjs.io

 

root에 codecov.yml 만들어서 pr시 자동으로 comment 받도록 하기

https://docs.codecov.com/docs/quick-start#tips-and-tricks

 

Codecov Documentation

A quick start guide for those that are brand new to Codecov.

docs.codecov.com

 

개인적으로 husky는 로컬에서 특정 git 이벤트가 발생했을 때 특정 스크립트를 실행하는 것이고, github actions는 레포지토리에서 특정 이벤트가 발생했을 때 특정 작업들을 실행한다...?고 대충 이해하고 있다...

 

 

 

'개발' 카테고리의 다른 글

Optimistic Updates 원리의 이해  (0) 2024.07.20
nvm  (0) 2024.07.18
vercel 배포 시 주의사항 (vite)  (0) 2024.07.16
git hooks, husky를 활용한 초기 세팅 + Jira  (2) 2024.07.16
yarn berry, zero install  (0) 2024.07.16