From b99bcacce417c8b735e22209d513f5a6ab9cbf69 Mon Sep 17 00:00:00 2001 From: Joss Moffatt Date: Sat, 11 Nov 2023 16:25:01 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=F0=9F=8F=BB=20Adding=20Mutation=20?= =?UTF-8?q?Testing=20to=20CI/CD=20Process=20(#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adding mutation tests to pipeline * Updating gitignore for mutmut files * Updating mutmut to not show progress during pipeline run * Updating mutmut to use CI options * Setting pipeline to be 3.11 * Update action versions to v4 * Using cache action to access across build * Updating cache emoji * Fixing caching actions * Fixing branch name * Fixing typo * Trying different environment variable * Update emoji * Fixing key path * Using hash of files for cache key * Fixing hash path * Fixing save path * Update cicd.yaml * Update cicd.yaml * Update cicd.yaml * Rename mutation testing stage --- .github/workflows/cicd.yaml | 31 +++++++++++++++++++++++++++---- .gitignore | 5 ++++- requirements-dev.txt | 3 ++- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 743b076..6dfc4bf 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -12,12 +12,12 @@ jobs: steps: - name: 🔄 Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: 🐍 Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.x # Specify your desired Python version + python-version: 3.11 - name: 📦 Install dependencies run: pip install -r requirements-dev.txt # Replace with your requirements file @@ -31,4 +31,27 @@ jobs: - name: ☂️ Upload coverage reports to Codecov uses: codecov/codecov-action@v3 env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + - name: 🗃️ Uncache Mutation Testing Artifacts + uses: actions/cache/restore@v3 + with: + path: .mutmut-cache + key: ${{ runner.os }}-mutmut-cache-${{ hashFiles('bookshelf/*.py') }} + + - name: 🦠 Run Mutation Tests + run: | + mutmut run --no-progress --CI + mutmut html + + - name: 📤 Upload Mutation Test Report + uses: actions/upload-artifact@v2 + with: + name: mutmut-html-report + path: html/bookshelf + + - name: 🗃️ Cache Mutation Test Cache + uses: actions/cache/save@v3 + with: + path: .mutmut-cache + key: ${{ runner.os }}-mutmut-cache-${{ hashFiles('bookshelf/*.py') }} diff --git a/.gitignore b/.gitignore index 489eb25..05eeb9a 100644 --- a/.gitignore +++ b/.gitignore @@ -180,4 +180,7 @@ docs/.env docs/.env.production # macOS-specific files -docs/.DS_Store \ No newline at end of file +docs/.DS_Store + +html/ +.mutmut-cache \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 0445f91..8750e5b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,4 +4,5 @@ assertpy~=1.1.0 pytest==7.4.3 pytest-cov==4.1.0 setuptools==68.2.2 -flake8~=6.1.0 \ No newline at end of file +flake8~=6.1.0 +mutmut~=2.4.4 \ No newline at end of file