Welcome to the GitHub Actions Workshop! This repository is designed to help you learn about GitHub Actions through hands-on exercises.
- Understand the basics of Continuous Integration (CI)
- Learn how to create and customize GitHub Actions workflows
- Experience real-world CI scenarios
- Master GitHub Actions concepts through practical exercises
- Fork this repository
- Look at the failing tests in the Actions tab
- Fix the Calculator class in
app.js:- The
addfunction should add numbers (not subtract) - The
multiplyfunction should multiply (not add) - The
dividefunction should return 'Cannot divide by zero' when b is 0
- The
- Commit your changes and watch the Actions tab
- All tests should pass when you're done
- Open
.github/workflows/main.yml - Add a new job called
lintthat:- Runs after the test job
- Uses the
npm run lintcommand to check code style - Only runs when files in
src/ortests/change
- Add these environment variables to the workflow:
NODE_ENV: 'test'LOG_LEVEL: 'debug'
- Add a step that creates a comment on the PR with the test results
- Also add a step that makes this workflow run on both push and pull requests
- Create a new file
.github/workflows/deploy.yml - This workflow should:
- Run only when code is pushed to
main - Build the application
- Create a release using GitHub's API
- Upload the built code as a release asset
- Run only when code is pushed to
- Add branch protection rules:
- Require the CI workflow to pass
- Require code review
- No direct pushes to main
- Fork this repository
- Clone your fork locally
- Install dependencies:
npm install
- Run tests locally:
npm test
- Watch the Actions tab in your GitHub repository to see your workflows in action
- Each failed test provides hints about what needs to be fixed
- Try to complete each exercise before looking at the solutions branch