fix: fix linting issues in main,benchmark, and generate #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic workflow | |
name: build | |
# Use more columns for terminal output | |
env: | |
COLUMNS: 120 | |
PYTHONIOENCODING: utf8 | |
# Controls when the action will run | |
# Workflow begins with push or PR events | |
# Focuses on the master branch only | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Create one single job | |
# This job performs all of the necessary checks | |
jobs: | |
build: | |
# Use the latest version of Ubuntu, MacOS, and Windows | |
# Use the latest and most stable version of Python | |
# Important: test coverage monitoring and reporting | |
# through a badge and the GitHub Actions job summary | |
# only takes place with the Linux operating system. | |
# Important: the MacOS and Windows operating systems | |
# have test coverage calculation take place but they | |
# do not report the test coverage beyond its display | |
# inside of the GitHub Actions panel for that job. | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
include: | |
- os: macos-latest | |
python-version: "3.11" | |
- os: windows-latest | |
python-version: "3.11" | |
# Define the workflow steps | |
steps: | |
# Checkout the code of the repository | |
- name: Check out Repository Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Run the mdl linting tool | |
# Refers to .mdlrc file in repository | |
- name: Run Markdown Linting | |
if: matrix.os == 'ubuntu-latest' | |
uses: actionshub/markdownlint@main | |
# Setup Python for the current language version | |
- name: Setup Python ${{ matrix.python-version }} | |
if: always() | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install pip | |
- name: Install Pip | |
if: always() | |
run: | | |
python -m pip install --upgrade pip | |
# Install poetry | |
- name: Install Poetry | |
if: always() | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: 1.4.0 | |
# Install dependencies | |
- name: Install dependencies | |
if: always() | |
run: | | |
poetry install | |
# Run the linters | |
- name: Run Linters | |
if: always() | |
run: | | |
poetry run task lint | |
# Run the program | |
#- name: Run program | |
# if: always() | |
# run: | | |
# poetry run bosco | |
# Run the tests | |
- name: Run Tests | |
if: always() | |
run: | | |
poetry run task test | |
# Run and collect the test coverage | |
# Important: only run and collect test coverage monitoring on Linux | |
- name: Run and Collect Test Coverage - Linux Only | |
if: always() && matrix.os == 'ubuntu-latest' | |
run: | | |
poetry run task test-coverage-silent > coverage.txt | |
# Display the Coverage Report | |
# Important: only report the monitored test coverage on Linux | |
- name: Display Collected Test Coverage - Linux Only | |
if: always() && matrix.os == 'ubuntu-latest' | |
run: | | |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
echo "total=$TOTAL" >> $GITHUB_ENV | |
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | |
CURRENT_GITHUB_STEP_SUMMARY="\`\`\`\n$(cat coverage.txt)\n\`\`\`" | |
echo "$CURRENT_GITHUB_STEP_SUMMARY" >> $GITHUB_STEP_SUMMARY | |
# Run and display the test coverage | |
# If the current operating system is MacOS, then only run test | |
# coverage monitoring and display it inside of the GitHub Actions | |
# panel. This allows for test coverage to be calculated for each | |
# operating system. However, coverage is only reported for Linux | |
# through the badge and through the GitHub job summary. Do not | |
# run any test coverage monitoring in Windows | |
- name: Run and Report Test Coverage - MacOS Only | |
if: always() && matrix.os == 'macOS' | |
run: | | |
poetry run task test-coverage |