Git Actions
Git Actions
This lab will create a basic Continuous Integration (CI) workflow for a Python project.
Steps:
o Go to GitHub and click on the "+" icon in the top right corner.
o Name it "python-ci-demo".
import unittest
from main import add
class TestAdd(unittest.TestCase):
def test_add(self):
self.assertEqual(add(2, 3), 5)
if __name__ == "__main__":
unittest.main()
git add .
git commit -m "Add Python script, tests, and CI workflow"
git push
7. Go to your GitHub repository, click on the "Actions" tab, and watch your workflow run.
Lab 2: Create a Release Workflow
This lab will create a workflow that creates a release when a new tag is pushed.
Steps:
1. Use the same repository from Lab 1 or create a new one.
2. Create a new file named CHANGELOG.md in the root of your repository with some sample
content:
# Changelog
## v1.0.0
- Initial release
git add .
git commit -m "Add release workflow"
git push
6. Go to your GitHub repository, click on the "Actions" tab, and watch your release workflow
run.
7. After the workflow completes, go to the "Releases" section of your repository to see the
newly created release.
These labs demonstrate two common use cases for GitHub Actions: running tests on push (CI)
and creating releases when tags are pushed. They provide a foundation for understanding how
to create and use GitHub Actions workflows[1][2].
1. https://spacelift.io/blog/github-actions-tutorial
2. https://docs.github.com/articles/getting-started-with-github-actions