Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge the Workflow #66

Open
wants to merge 3 commits into
base: f24
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/stryker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Done with help of AI chatgpt
name: Stryker Mutation Testing

on:
push:
branches: [f24]
pull_request:
branches: [f24]

permissions:
contents: read # for actions/checkout to fetch code

jobs:
mutation-testing:
runs-on: ubuntu-latest
env:
TEST_ENV: 'production'

services:
redis:
image: 'redis:7.2.4'
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
# Step 1: Check out repository code
- name: Checkout repository
uses: actions/checkout@v4

# Step 2: Copy package.json (adjust if needed)
- run: cp install/package.json package.json

# Step 3: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

# Step 4: Install dependencies
- name: Install dependencies
run: npm install

# Step 5: Setup Redis environment
- name: Setup for Redis
env:
SETUP: >-
{
"url": "http://127.0.0.1:4567/forum",
"secret": "abcdef",
"admin:username": "admin",
"admin:email": "[email protected]",
"admin:password": "hAN3Eg8W",
"admin:password:confirm": "hAN3Eg8W",
"database": "redis",
"redis:host": "127.0.0.1",
"redis:port": 6379,
"redis:password": "",
"redis:database": 0
}
CI: >-
{
"host": "127.0.0.1",
"database": 1,
"port": 6379
}
run: |
node app --setup="${SETUP}" --ci="${CI}"

# Step 6: Run tests to ensure they pass before running Stryker
- name: Run tests
run: npm test

# Step 7: Install Stryker
- name: Install Stryker
run: npm install --save-dev @stryker-mutator/core

# Step 8: Run Stryker Mutation Testing
- name: Run Stryker Mutation Testing
run: npx stryker run

# Step 9: Upload Stryker HTML Report as an artifact
- name: Upload Stryker Report
if: success() || failure()
uses: actions/upload-artifact@v2
with:
name: stryker-report
path: reports/mutation/html
Loading