用 GitHub Actions 做 CI/CD:做 unit test, 生成 coverage, 並且上傳到 coveralls.io
可以在這個 branch 看到範例: https://github.com/sunpochin/pf-audiophile/tree/github-action-cicd
我是請 chatGPT 做出來的。
重點是我在這邊生成 coverage 資料。
- name: Run tests
run: yarn test:unit --coverage
在這邊上傳到 coveralls app:
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.2.3
with: github-token: ${{ secrets.GITHUB_TOKEN }}
就這樣了。
這裡可以看到正式的範例教學:https://github.com/marketplace/actions/coveralls-github-action