DEV Community

Vishnu Das Puthukudi
Vishnu Das Puthukudi

Posted on

Setting up GitHub Actions CI Workflow for Text2page project

In the project root, I made a file called.github/workflows/ci.yml to configure GitHub Actions for Continuous Integration. This is how the YAML workflow file appeared:

name: CI

on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.8

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt

    - name: Run tests
      run: |
        python -m unittest discover -s tests -p 'test_*.py'

Enter fullscreen mode Exit fullscreen mode

This process checks out the repository, installs dependencies, installs Python, and runs the unit tests using unittest. It is triggered by each push to the main branch.

I provided tests for the processDirectory function in my partner's code as part of our collaborative testing experience. I became acquainted with their project structure by navigating their repository and looking through the README and CONTRIBUTING files. This partnership required me to adjust to their testing environment and any potential language or framework incompatibilities, unlike my original codebase. Understanding testing conventions and procedures required reading their documentation. Carefully examining the foreign codebase, identifying places lacking appropriate test coverage, and aligning with the project's objectives were necessary before adding tests. Clarity in communication was crucial, and prior to submitting the pull request, local tests were conducted to guarantee smooth integration and compliance with their continuous integration (CI) procedure. Overall, the experience highlighted flexibility, good communication, and the common objective of improving the codebase.

CI setup has proven to be a useful experience. It ensures that code updates don't create new defects and that the project stays in a deployable condition by automating the testing process. Any faults may be promptly identified with the aid of the visual feedback that CI pipelines in the GitHub Actions interface give.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️