I assume you have a Python project, but you can adapt it to any languages / frameworks.
Create the .github/workflows
folder and the yml file at the root of your project.
mkdir -p .github/workflows && touch .github/workflows/testing.yml
The testing.yml file:
name: test
on:
pull_request:
branches:
- main
# Add any branch
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: "x64"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
# Install necessary dependencies to run the tests
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run Tests
# Add command to run test
run: |
make test
Each time a PR is made to the main branch, the tests will run.
I am using a Python project, but you can easily find YAML template files for any language or framework.
You can then add a branch rule on GitHub to prevent merging a PR if the tests fail.
Top comments (2)
London locksmith training offers practical security expertise, while automating testing with GitHub Actions streamlines software development. GitHub Actions allows developers to automate workflows, including testing code on various platforms and environments. By setting up continuous integration, you can ensure that tests run automatically with every code push. This reduces errors, improves efficiency, and ensures the reliability of your software. GitHub Actions enhances collaboration and speeds up the development process.
Hello sir AoA
I am full newbie and trying to find an mentor can you please be my mentor