Exercise 4: Automating Builds with Github Actions
Objectives:Learn to set up a CI/CD pipeline using Github Actions to automate builds and tests.
Tasks
- In any existing repository, create a new file in the `.github/workflows` directory called
ci.yml.
Add a ci.yml with:
name: Python Testson: [push, pull_request]jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.8' - name: Install dependencies run: pip install -r requirements.txt - name: Run tests run: pytest- After pushing the changes, you should see the workflow running in the Actions tab of your GitHub repository.
- Push to Github and verify that a workflow run starts automatically
- Break a test intentionally and push again to observe the failed status.