Here’s how to create a simple GitHub Action for running tests:
-Create a .github/workflows directory in your repository.
-Inside that directory, create a YAML file (e.g., test.yml).
-Add the following workflow configuration:
name: Run Tests
on:
push:
branches:
main
pull_request:
branches:
main
jobs:
test:
runs-on: ubuntu-latest
steps:
name: Checkout code
uses: actions/checkout@v2
name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
name: Install dependencies
run: npm install
name: Run tests
run: npm test
Key Steps in This Workflow:
Checkout code: Pulls your latest code.
Set up Node.js: Prepares the environment to run your tests.
Install dependencies: Installs necessary libraries or dependencies.
Run tests: Executes your test suite.
On this page of the site you can watch the video online Master GitHub Actions for Testers with a duration of hours minute second in good quality, which was uploaded by the user TechGuruX gol 16 January 2025, share the link with friends and acquaintances, this video has already been watched 11 times on youtube and it was liked by 2 viewers. Enjoy your viewing!