-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1470 from CounterpartyXCP/github
GitHub Workflows
- Loading branch information
Showing
24 changed files
with
1,485 additions
and
436 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[bandit] | ||
exclude = counterparty-lib/counterpartylib/test/ | ||
skips = B101 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# Bandit is a security linter designed to find common security issues in Python code. | ||
# This action will run Bandit on your codebase. | ||
# The results of the scan will be found under the Security tab of your repository. | ||
|
||
# https://github.com/marketplace/actions/bandit-scan is ISC licensed, by abirismyname | ||
# https://pypi.org/project/bandit/ is Apache v2.0 licensed, by PyCQA | ||
|
||
name: Bandit | ||
on: | ||
push: | ||
branches: [ "master", "develop" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master", "develop" ] | ||
|
||
jobs: | ||
bandit: | ||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | ||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Bandit Scan | ||
uses: shundor/python-bandit-scan@9cc5aa4a006482b8a7f91134412df6772dbda22c | ||
with: # optional arguments | ||
# exit with 0, even with results found | ||
exit_zero: true # optional, default is DEFAULT | ||
# Github token of the repository (automatically created by Github) | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information. | ||
# File or directory to run bandit on | ||
# path: # optional, default is . | ||
# Report only issues of a given severity level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything) | ||
# level: # optional, default is UNDEFINED | ||
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything) | ||
# confidence: # optional, default is UNDEFINED | ||
# comma-separated list of paths (glob patterns supported) to exclude from scan (note that these are in addition to the excluded paths provided in the config file) (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg) | ||
# excluded_paths: # optional, default is DEFAULT | ||
# comma-separated list of test IDs to skip | ||
# skips: # optional, default is DEFAULT | ||
# path to a .bandit file that supplies command line arguments | ||
# ini_path: # optional, default is DEFAULT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
name: Build, Install then Test | ||
|
||
on: | ||
push: | ||
branches: [ "master", "develop" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master", "develop" ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PYTHON_VERSION: "3.10" | ||
COUNTERPARTY_RS_DIR: "./counterparty-rs" | ||
|
||
jobs: | ||
macos-x86_64: | ||
runs-on: macos-12 #x86_64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Install dependencies | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: 'pip' | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
default: true | ||
|
||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
|
||
- name: Install leveldb | ||
run: | | ||
brew install leveldb | ||
- name: Install pytest and build module | ||
run: | | ||
pip install pytest | ||
python -m pip install --upgrade build | ||
# Build counterparty packages | ||
|
||
- name: Build counterparty-rs | ||
uses: messense/maturin-action@v1 | ||
with: | ||
args: --release --out dist --sdist -m ${{ env.COUNTERPARTY_RS_DIR }}/Cargo.toml | ||
|
||
- name: Build counterparty-lib | ||
run: | | ||
cd counterparty-lib && python -m build --out ../dist | ||
- name: Build counterparty-cli | ||
run: | | ||
cd counterparty-cli && python -m build --out ../dist | ||
# Install counterparty packages | ||
|
||
- name: Install wheels | ||
run: | | ||
pip install dist/*.whl --force-reinstall | ||
# Run counterparty-lib tests | ||
|
||
- name: Run counterparty-lib tests | ||
run: | | ||
cd counterparty-lib | ||
pytest | ||
# Upload wheels | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
macos-m1: | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Install dependencies | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
default: true | ||
|
||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
|
||
- name: Install Python 3.10 and leveldb | ||
run: | | ||
brew install [email protected] leveldb | ||
echo '/opt/homebrew/opt/[email protected]/libexec/bin' >> $GITHUB_PATH | ||
- name: Install pytest and build module | ||
run: | | ||
pip3.10 install pytest | ||
python3.10 -m pip install --upgrade build | ||
# Build counterparty packages | ||
|
||
- name: Build counterparty-rs | ||
uses: messense/maturin-action@v1 | ||
with: | ||
args: --release --out dist --sdist -m ${{ env.COUNTERPARTY_RS_DIR }}/Cargo.toml | ||
|
||
- name: Build counterparty-lib | ||
run: | | ||
cd counterparty-lib && python3.10 -m build --out ../dist | ||
- name: Build counterparty-cli | ||
run: | | ||
cd counterparty-cli && python3.10 -m build --out ../dist | ||
# Install counterparty packages | ||
|
||
- name: Install wheels | ||
run: | | ||
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib" | ||
export CPATH="$CPATH:$(brew --prefix)/include" | ||
pip3.10 install dist/*.whl --force-reinstall | ||
# Run counterparty-lib tests | ||
|
||
- name: Run counterparty-lib tests | ||
run: | | ||
cd counterparty-lib | ||
pytest | ||
# Upload wheels | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist | ||
|
||
ubuntu-22-04: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Install dependencies | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: 'pip' | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
default: true | ||
|
||
- name: Install leveldb | ||
run: | | ||
sudo apt-get install -y libleveldb-dev | ||
- name: Install pytest and build module | ||
run: | | ||
pip install pytest | ||
python -m pip install --upgrade build | ||
# Build counterparty packages | ||
|
||
- name: Build counterparty-rs | ||
uses: messense/maturin-action@v1 | ||
with: | ||
args: --release --out dist --sdist -m ${{ env.COUNTERPARTY_RS_DIR }}/Cargo.toml | ||
|
||
- name: Build counterparty-lib | ||
run: | | ||
cd counterparty-lib && python -m build --out ../dist | ||
- name: Build counterparty-cli | ||
run: | | ||
cd counterparty-cli && python -m build --out ../dist | ||
# Install counterparty packages | ||
|
||
- name: Install wheels | ||
run: | | ||
pip install dist/*.whl --force-reinstall | ||
# Run counterparty-lib tests | ||
|
||
- name: Run counterparty-lib tests | ||
run: | | ||
cd counterparty-lib | ||
pytest | ||
# Upload wheels | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: wheels | ||
path: dist |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "master", "develop" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master", "develop" ] | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
# 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 | ||
# Consider using larger runners for possible analysis time improvements. | ||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} | ||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'python' ] | ||
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] | ||
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both | ||
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/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 }} | ||
# 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. | ||
|
||
# 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 | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). | ||
# 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. | ||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
|
||
# If the Autobuild fails above, remove it and uncomment the following three lines. | ||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. | ||
|
||
# - run: | | ||
# echo "Run, Build Application using script" | ||
# ./location_of_script_within_repo/buildscript.sh | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:${{matrix.language}}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: License Scanner | ||
|
||
on: | ||
push: | ||
branches: [ "master", "develop" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master", "develop" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
default: true | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y libgirepository1.0-dev libleveldb-dev | ||
python -m pip install --upgrade pip | ||
pip install license_scanner maturin sh | ||
pip install -e counterparty-rs | ||
pip install -e counterparty-lib | ||
pip install -e counterparty-cli | ||
pip install evdev | ||
- name: Analysing dependencies with licence_scanner | ||
run: | | ||
python counterparty-lib/tools/checklicences.py | ||
- name: Upload SARIF | ||
uses: github/codeql-action/upload-sarif/@v2 | ||
with: | ||
sarif_file: license_scanner.sarif |
Oops, something went wrong.