An Interest In:
Web News this Week
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
Lab 9 - GitHub Actions Workflow
Intro
For my ninth lab, I have to set up GitHub Action for my text ssg project. Then pick another student that has GitHub Actions setup and create a PR to his repo.
In my previous I had a bit of experience with GitHub Action, I had a chance to set up with my mentor a GitHub Action to enable e2e testing with Cypress on the new build application when a PR is created, to have continuous integration.
Setup GitHub Action
First of all, I create a folder called .github/workflows
, this folder contains the file for setup for GitHub Action.
I created a file called ci_workflow.yml
and put
name: CIon: push: branches: [ main ] pull_request: branches: [ main ]jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [16.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} cache: 'npm' - name: npm install and test run: | npm install npm run test-silent
To make it simple, this file means, on push to main or create PR to be pushed to main will run this workflow.
The job of this workflow is to run a node-version 16.x on a ubuntu-latest system, and install all my application dependencies and run a test.
If test fails it will return -1, if pass it will return 0.
Add more test cases to another student repo
I pick Andre repo, I created an issue stating, to separate generate HTML into a function, then add test case for that function.
After finishing my fix. I created a PR, I see that the workflow Andre setup is working correctly.
Conclusion
GitHub action is a powerful tool, it enables developers to shift some manual work into automation. Yet I still have a lot to learn of GitHub Actions.
Original Link: https://dev.to/pandanoxes/lab-9-github-actions-workflow-joi
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To