Skip to content

Commit

Permalink
Add a simple unit test framework
Browse files Browse the repository at this point in the history
  • Loading branch information
dbutenhof committed Dec 6, 2024
1 parent 6717f4d commit a32100a
Show file tree
Hide file tree
Showing 9 changed files with 668 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .github/codeql/javascript-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "CodeQL config for Javascript"

paths:
- frontend/src/**
1 change: 1 addition & 0 deletions .github/codeql/python-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: "CodeQL config for Python"
58 changes: 58 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "CodeQL"

on:
push:
branches: [ main, 'b[0-9].[0-9]+' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, 'b[0-9].[0-9]+' ]

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/${{ matrix.language }}-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
#- name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
38 changes: 38 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run Unit Test via Pytest

on:
push:
branches: ["main"]
tags-ignore: ["**"]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9.20"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox>=4.19
- name: Check for lint
run: |
tox -e format,isort,lint
- name: Run unit tests
run: |
tox -e python3.9.20
- name: Publish coverage data
uses: actions/upload-artifact@v4
with:
name: Coverage for ${{ github.event.head_commit.id }}
path: .tox/unit/tmp/coverage.db
if-no-files-found: warn
retention-days: 30
Loading

0 comments on commit a32100a

Please sign in to comment.