Skip to content

Commit

Permalink
Submodule updates, linting updates, and added github actions (#13)
Browse files Browse the repository at this point in the history
* APP-3926 - updating submodules
* APP-3926 - updating submodule and adding github actions
* APP-3926 - added missing dep
  • Loading branch information
bsummers-tc authored Jul 26, 2023
1 parent 6993523 commit e47e960
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 9 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: "17 11 * * 4"

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

strategy:
fail-fast: false
matrix:
language: ["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@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
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.
# 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@v1

# ℹ️ 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@v1
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Lint Project

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11']

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,test]
pip freeze
- name: Lint with pre-commit
run: |
pre-commit --version
pre-commit install
pre-commit run --all-files
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers = [
dependencies = [
"arrow",
"black",
"debugpy",
"inflect",
"isort",
"paho.mqtt",
Expand Down
12 changes: 6 additions & 6 deletions tcex_cli/cli/run/launch_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ def create_input_config(self, inputs: BaseModel):
encrypted_data = self.util.encrypt_aes_cbc(key, data)

# ensure that the in directory exists
inputs.tc_in_path.mkdir(parents=True, exist_ok=True)
inputs.tc_in_path.mkdir(parents=True, exist_ok=True) # type: ignore

# write the file in/.app_params.json
app_params_json = inputs.tc_in_path / '.test_app_params.json'
app_params_json = inputs.tc_in_path / '.test_app_params.json' # type: ignore
with app_params_json.open(mode='wb') as fh:
fh.write(encrypted_data)

# TODO: [high] TEMP - DELETE THIS
app_params_json_decrypted = inputs.tc_in_path / '.test_app_params-decrypted.json'
with app_params_json_decrypted.open(mode='w') as fh:
fh.write(data)
# Test code to write decrypted file for debugging
# app_params_json_decrypted = inputs.tc_in_path / '.test_app_params-decrypted.json'
# with app_params_json_decrypted.open(mode='w') as fh:
# fh.write(data)

# when the App is launched the tcex.input module reads the encrypted
# file created above # for inputs. in order to decrypt the file, this
Expand Down
4 changes: 2 additions & 2 deletions tcex_cli/cli/run/playbook_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def validate_value(self):

def transform(self) -> str:
"""Return a string value from bytes."""
value = base64.b64decode(self.value)
value = base64.b64decode(self.value) # type: ignore
return base64.b64encode(value).decode('utf-8')


Expand All @@ -148,7 +148,7 @@ def transform(self) -> list[str]:
"""Return a list of string values from a list bytes."""
values = []
for v in self.value:
v = base64.b64decode(v)
v = base64.b64decode(v) # type: ignore
values.append(base64.b64encode(v).decode('utf-8'))

return values
Expand Down
2 changes: 1 addition & 1 deletion tcex_cli/util

0 comments on commit e47e960

Please sign in to comment.