Skip to content

Commit

Permalink
Delete old workflow, test reusable workflow for running tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sydseter committed Apr 15, 2024
1 parent 8fd9953 commit e6d83fd
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 186 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cflite_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
paths:
- 'scripts/convert**'
- 'test/scripts/convert**'
- '.clusterfuzzlite/Dockerfile'
- '.clusterfuzzlite/build.sh'
permissions: read-all
jobs:
PR:
Expand Down
148 changes: 0 additions & 148 deletions .github/workflows/push-tests-update-output.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/run-tests-for-patches.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Run Tests for patches and ci changes.
# Runs tests when updating patches or the ci pipeline
on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request:
branches:
- master
paths:
- '.github/workflows/**'
- 'Pipfile'
- 'Pipfile.lock'
- 'Dockerfile'
- 'requirements.txt'
- 'Makefile'
- 'tests/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
jobs:
call-run-tests:
uses: ./.github/workflows/run-tests.yaml
43 changes: 5 additions & 38 deletions .github/workflows/run-tests-generate-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@ on:
- 'sources/**'
- 'scripts/convert**'
- 'resources/templates/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read

jobs:
runtests:
name: Run Tests
hardening:
name: Hardening
runs-on: ubuntu-latest
steps:
# Make sure we have some code to test
- name: Harden Runner
- name: Run harden runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: block
Expand All @@ -41,38 +38,8 @@ jobs:
d3iz1jjs17r6kg.cloudfront.net:443
keys.openpgp.org:443
api.codeclimate.com:443
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
# Set the pip environment up
- name: Get Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.10'
cache: 'pipenv' # caching pip dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt --require-hashes
pipenv install --ignore-pipfile --dev
# Run the tests
- name: Run unit tests
run: pipenv run python -m unittest discover -s "tests/scripts" -p "*_utest.py"
- name: Run integration
run: pipenv run python -m unittest discover -s "tests/scripts" -p "*_itest.py"
# Test coverage reports
- name: Check test coverage - run tests
run: pipenv run coverage run -m unittest discover -s "tests/scripts" -p "*_*test.py"
- name: Check test coverage - generate xml
run: pipenv run coverage xml
- name: Check test coverage - Report
run: pipenv run coverage report --fail-under 85 scripts/convert*
# Check formatting of files
- name: Check formatting of files with Black
run: pipenv run black --line-length=120 --check .
- name: Check formatting of files with flake
run: pipenv run flake8 --max-line-length=120 --max-complexity=10 --ignore=E203,W503
- name: Check formatting of files for correct spelling and namespace names
run: pipenv run mypy --namespace-packages --strict ./scripts/

runtests:
uses: ./.github/workflows/run-tests.yaml
# If Tests pass, generate new output files
uploadoutputfiles:
name: Upload Output Files
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
runtests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
# Set the pip environment up
- name: Get Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.10'
cache: 'pipenv' # caching pip dependencies
- name: Install dependencies
run: |
pip install -r requirements.txt --require-hashes
pipenv install --ignore-pipfile --dev
# Run the tests
- name: Run unit tests
run: pipenv run python -m unittest discover -s "tests/scripts" -p "*_utest.py"
- name: Run integration
run: pipenv run python -m unittest discover -s "tests/scripts" -p "*_itest.py"
# Test coverage reports
- name: Check test coverage - run tests
run: pipenv run coverage run -m unittest discover -s "tests/scripts" -p "*_*test.py"
- name: Check test coverage - generate xml
run: pipenv run coverage xml
- name: Check test coverage - Report
run: pipenv run coverage report --fail-under 85 scripts/convert*
# Check formatting of files
- name: Check formatting of files with Black
run: pipenv run black --line-length=120 --check .
- name: Check formatting of files with flake
run: pipenv run flake8 --max-line-length=120 --max-complexity=10 --ignore=E203,W503
- name: Check formatting of files for correct spelling and namespace names
run: pipenv run mypy --namespace-packages --strict ./scripts/


0 comments on commit e6d83fd

Please sign in to comment.