Skip to content

Commit

Permalink
Merge pull request #1616 from oscal-compass/develop
Browse files Browse the repository at this point in the history
chore: Trestle release
  • Loading branch information
AleJo2995 authored Jul 15, 2024
2 parents 2baa327 + 7dabaee commit 11e1a06
Show file tree
Hide file tree
Showing 25 changed files with 589 additions and 200 deletions.
81 changes: 51 additions & 30 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,60 +13,81 @@ name: "CodeQL"

on:
push:
branches: [ develop, main ]
branches: [ "develop", "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
branches: [ "develop" ]
schedule:
- cron: '44 7 * * 3'
- cron: '39 21 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

include:
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
# moved from v1 to v2 20230301
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# 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
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ 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
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/conventional-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install dependencies
run: npm install @commitlint/cli @commitlint/config-conventional
Expand Down
44 changes: 23 additions & 21 deletions .github/workflows/python-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Trestle Deploy



on:
push:
branches:
Expand All @@ -20,20 +22,20 @@ jobs:
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
python-version: ['3.9', '3.10', '3.11']
python-version: ['${{ vars.PYTHON_MIN }}', '${{ vars.PYTHON_MAX }}']

steps:
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('setup.cfg') }}
Expand All @@ -44,39 +46,39 @@ jobs:
run: |
make develop
- name: Setup pre-commit
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
run: |
make pre-commit
- name: Install dependencies
run: |
make install
- name: Run md document formatting (mdformat)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
run: |
make mdformat
- name: Run code formatting (yapf)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
run: |
make code-format
- name: Run code linting (flake8)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
run: |
make code-lint
- name: Run code typing check (mypy)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
continue-on-error: true
run: |
make code-typing
- name: Validate website content (mkdocs)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
run: |
make docs-validate
- name: Pytest Fast
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
run: |
make test
- name: Pytest Cov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX }}
run: |
make test-cov
deploy:
Expand All @@ -90,15 +92,15 @@ jobs:
url: https://pypi.org/p/compliance-trestle
if: github.ref == 'refs/heads/main' && github.repository == 'oscal-compass/compliance-trestle'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.ADMIN_PAT }}
- name: Set up Python 3.10
uses: actions/setup-python@v2
- name: Set up Python ${{ vars.PYTHON_MAX }}
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ vars.PYTHON_MAX }}
- name: Install build tools
run: |
make develop
Expand Down Expand Up @@ -131,16 +133,16 @@ jobs:
# Temporary hack: allow develop as well as master to deploy docs.
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.ADMIN_PAT }}
- name: Set up Python 3.10
uses: actions/setup-python@v2
- name: Set up Python ${{ vars.PYTHON_MAX }}
uses: actions/setup-python@v5
# This is deliberately not using a custom credential as it relies on native github actions token to have push rights.
with:
python-version: '3.10'
python-version: ${{ vars.PYTHON_MAX }}
- name: Install build tools
run: |
make develop
Expand All @@ -158,7 +160,7 @@ jobs:
cancel-in-progress: true
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
ref: main
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/cache@v2
python-version: ${{ vars.PYTHON_MAX }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ubuntu-latest-3.10-pip-${{ hashFiles('setup.cfg') }}
key: ubuntu-latest-${{ vars.PYTHON_MAX }}-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
ubuntu-latest-3.10-pip-
ubuntu-latest-${{ vars.PYTHON_MAX }}-pip-
- name: Install build tools
run: |
make develop
Expand Down Expand Up @@ -66,19 +66,19 @@ jobs:
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/cache@v2
python-version: ${{ vars.PYTHON_MAX }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ubuntu-latest-3.10-pip-${{ hashFiles('setup.cfg') }}
key: ubuntu-latest-${{ vars.PYTHON_MAX }}-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
ubuntu-latest-3.10-pip-
ubuntu-latest-${{ vars.PYTHON_MAX }}-pip-
- name: Install build tools
run: |
make develop
Expand All @@ -92,7 +92,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11']
python-version: [ '${{ vars.PYTHON_MIN }}', '${{ vars.PYTHON_MAX }}' ]
include:
- os: ubuntu-latest
path: ~/.cache/pip
Expand All @@ -104,15 +104,15 @@ jobs:
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('setup.cfg') }}
Expand All @@ -122,16 +122,16 @@ jobs:
run: |
make develop
- name: Pytest Fast
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10') }}
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX) }}
run: |
make test
- name: Pytest Cov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX }}
run: |
make test-cov
- name: Upload artifact
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == vars.PYTHON_MAX }}
uses: actions/upload-artifact@v2
with:
name: coverage
Expand All @@ -148,19 +148,19 @@ jobs:
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/cache@v2
python-version: ${{ vars.PYTHON_MAX }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ubuntu-latest-3.10-pip-${{ hashFiles('setup.cfg') }}
key: ubuntu-latest-${{ vars.PYTHON_MAX }}-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
ubuntu-latest-3.10-pip-
ubuntu-latest-${{ vars.PYTHON_MAX }}-pip-
- name: Install build tools
run: |
make develop
Expand All @@ -178,7 +178,7 @@ jobs:
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.tests=tests/
-Dsonar.sources=trestle/
-Dsonar.python.version='3.10'
-Dsonar.python.version=${{ vars.PYTHON_MAX }}
-Dsonar.projectKey=compliance-trestle
-Dsonar.organization=compliance-trestle
-Dsonar.cpd.exclusions=trestle/oscal/*.py
Expand Down
Loading

0 comments on commit 11e1a06

Please sign in to comment.