Skip to content

Commit

Permalink
[clean] Single script entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
lpascal-ledger committed Nov 24, 2023
1 parent f9b9ffa commit 29a0e56
Show file tree
Hide file tree
Showing 21 changed files with 290 additions and 288 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ jobs:
uses: actions/checkout@v3

- name: Split input into 10 files
run: |
python3 scripts/split_input/split_input.py --input_file input_files/input.json
run: |
python3 scripts/entrypoint.py split_input --input_file input_files/input.json
- name: Archive output file
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -186,17 +186,17 @@ jobs:

- name: Setup repos
if: ${{ inputs.use_sha1_from_live }}
run: |
python3 scripts/build_and_test/main.py --input_file input_${{ matrix.index }}.json --use_sha1_from_live --provider ${{ inputs.provider }} --device ${{ inputs.device }} --version ${{ inputs.version }}
run: |
python3 scripts/entrypoint.py build_and_test --input_file input_${{ matrix.index }}.json --use_sha1_from_live --provider ${{ inputs.provider }} --device ${{ inputs.device }} --version ${{ inputs.version }}
- name: Setup repos
if: ${{ !inputs.use_sha1_from_live }}
run: |
python3 scripts/build_and_test/main.py --input_file input_${{ matrix.index }}.json
run: |
python3 scripts/entrypoint.py build_and_test --input_file input_${{ matrix.index }}.json
- name: Launch build
run: |
python3 scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref || 'master' }} --input_file input_${{ matrix.index }}.json --build --${{ matrix.device }} --skip_setup --output_file build_${{ matrix.device }}_${{ matrix.index }}.json --logs_file log_${{ matrix.device }}_${{ matrix.index }}.txt
run: |
python3 scripts/entrypoint.py build_and_test --sdk_ref ${{ inputs.sdk_ref || 'master' }} --input_file input_${{ matrix.index }}.json --build --${{ matrix.device }} --skip_setup --output_file build_${{ matrix.device }}_${{ matrix.index }}.json --logs_file log_${{ matrix.device }}_${{ matrix.index }}.txt
#- name: Push info to DB
# run: |
Expand Down Expand Up @@ -534,8 +534,8 @@ jobs:
name: build_${{ matrix.device }}_10.json

- name: Merge output files
run: |
python3 scripts/output_scripts/merge.py --input_pattern "build_"${{ matrix.device }}"_*.json" --output_file merged_build_${{ matrix.device }}.json --key "build"
run: |
python3 scripts/entrypoint.py merge_output --input_pattern "build_"${{ matrix.device }}"_*.json" --output_file merged_build_${{ matrix.device }}.json --key "build"
- name: Archive output file
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -577,20 +577,20 @@ jobs:
name: merged_build_stax.json

- name: Merge output files
run: |
python3 scripts/output_scripts/merge.py --input_pattern "merged_build_*.json" --output_file full_build_output.json --key "build"
run: |
python3 scripts/entrypoint.py merge_output --input_pattern "merged_build_*.json" --output_file full_build_output.json --key "build"
- name: Convert to markdown
run: |
python3 scripts/output_scripts/convert.py --input_file full_build_output.json --output_file out.md --key build
python3 scripts/entrypoint.py convert_output --input_file full_build_output.json --output_file out.md --key build
cat out.md >> $GITHUB_STEP_SUMMARY
- name: Echo GHA url
run: echo "url"=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_ENV

- name: Convert to slack json
run: |
python3 scripts/output_scripts/slack.py --input_file full_build_output.json --output_file slack.json --key build --devices ${{ needs.setup-devices.outputs.names }} --url ${{ env.url }}
python3 scripts/entrypoint.py slack_output --input_file full_build_output.json --output_file slack.json --key build --devices ${{ needs.setup-devices.outputs.names }} --url ${{ env.url }}
- name: Send custom JSON data to Slack workflow
if: ${{ github.event_name == 'schedule' || inputs.send_to_slack == true }}
Expand All @@ -603,7 +603,7 @@ jobs:

- name: Set job status
run: |
python3 scripts/output_scripts/status.py --input_file full_build_output.json --key build
python3 scripts/entrypoint.py status_output --input_file full_build_output.json --key build
- name: Archive output file
if: always()
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/fast-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,26 @@ jobs:
lint:
strategy:
fail-fast: false
matrix:
directory:
- build_and_test
- create_app_list
- output_scripts
- split_input
name: Linting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- run: pip install flake8
- name: Flake8 lint Python code
run: find scripts/${{ matrix.directory }} -type f -name '*.py' -exec flake8 --max-line-length=120 '{}' '+'
run: find scripts/ -type f -name '*.py' -exec flake8 --max-line-length=120 '{}' '+'

mypy:
strategy:
fail-fast: false
matrix:
directory:
- build_and_test
- create_app_list
- output_scripts
- split_input
name: Type checking
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- run: pip install mypy types-requests
- name: Mypy type checking
run: mypy scripts/${{ matrix.directory }}
run: mypy scripts/

misspell:
strategy:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/refresh_inputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

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

- name: Build db
run: |
python3 scripts/create_app_list/main.py --full_output_file out.json --access_token ${{ secrets.GH_ACCESS_TOKEN }}
run: |
python3 scripts/entrypoint.py create_app_list --full_output_file out.json --access_token ${{ secrets.GH_ACCESS_TOKEN }}
- name: Upload file
uses: actions/upload-artifact@v3
with:
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/scan_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ jobs:
uses: actions/checkout@v3

- name: Split input into 10 files
run: |
python3 scripts/split_input/split_input.py --input_file input_files/input.json
run: |
python3 scripts/entrypoint.py split_input --input_file input_files/input.json
- name: Archive output file
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -168,12 +168,12 @@ jobs:
name: input_${{ matrix.index }}.json

- name: Setup repos
run: |
python3 scripts/build_and_test/main.py --input_file input_${{ matrix.index }}.json
run: |
python3 scripts/entrypoint.py build_and_test --input_file input_${{ matrix.index }}.json
- name: Launch scan
run: |
python3 scripts/build_and_test/main.py --sdk_ref ${{ inputs.sdk_ref || 'master' }} --input_file input_${{ matrix.index }}.json --scan --${{ matrix.device }} --skip_setup --output_file scan_${{ matrix.device }}_${{ matrix.index }}.json --logs_file log_${{ matrix.device }}_${{ matrix.index }}.txt
run: |
python3 scripts/entrypoint.py build_and_test --sdk_ref ${{ inputs.sdk_ref || 'master' }} --input_file input_${{ matrix.index }}.json --scan --${{ matrix.device }} --skip_setup --output_file scan_${{ matrix.device }}_${{ matrix.index }}.json --logs_file log_${{ matrix.device }}_${{ matrix.index }}.txt
#- name: Push info to DB
# run: |
Expand Down Expand Up @@ -254,8 +254,8 @@ jobs:
name: scan_${{ matrix.device }}_10.json

- name: Merge output files
run: |
python3 scripts/output_scripts/merge.py --input_pattern "scan_"${{ matrix.device }}"_*.json" --output_file merged_scan_${{ matrix.device }}.json --key "scan"
run: |
python3 scripts/entrypoint.py merge_output --input_pattern "scan_"${{ matrix.device }}"_*.json" --output_file merged_scan_${{ matrix.device }}.json --key "scan"
- name: Archive output file
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -554,20 +554,20 @@ jobs:
name: merged_scan_stax.json

- name: Merge output files
run: |
python3 scripts/output_scripts/merge.py --input_pattern "merged_scan_*.json" --output_file full_scan_output.json --key "scan"
run: |
python3 scripts/entrypoint.py merge_output --input_pattern "merged_scan_*.json" --output_file full_scan_output.json --key "scan"
- name: Convert to markdown
run: |
python3 scripts/output_scripts/convert.py --input_file full_scan_output.json --output_file out.md --key scan
python3 scripts/entrypoint.py convert_output --input_file full_scan_output.json --output_file out.md --key scan
cat out.md >> $GITHUB_STEP_SUMMARY
- name: Echo GHA url
run: echo "url"=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_ENV

- name: Convert to slack json
run: |
python3 scripts/output_scripts/slack.py --input_file full_scan_output.json --output_file slack.json --key scan --devices ${{ needs.setup-devices.outputs.names }} --url ${{ env.url }}
python3 scripts/entrypoint.py slack_output --input_file full_scan_output.json --output_file slack.json --key scan --devices ${{ needs.setup-devices.outputs.names }} --url ${{ env.url }}
- name: Send custom JSON data to Slack workflow
if: ${{ github.event_name == 'schedule' || inputs.send_to_slack == true }}
Expand All @@ -580,7 +580,7 @@ jobs:

- name: Set job status
run: |
python3 scripts/output_scripts/status.py --input_file full_scan_output.json --key scan
python3 scripts/entrypoint.py status_output --input_file full_scan_output.json --key scan
- name: Archive output file
uses: actions/upload-artifact@v3
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/test_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ jobs:
uses: actions/checkout@v3

- name: Split input into 10 files
run: |
python3 scripts/split_input/split_input.py --input_file input_files/input.json
run: |
python3 scripts/entrypoint.py split_input --input_file input_files/input.json
- name: Archive output file
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -136,8 +136,8 @@ jobs:
name: input_${{ matrix.index }}.json

- name: Setup repos
run: |
python3 scripts/build_and_test/main.py --input_file input_${{ matrix.index }}.json
run: |
python3 scripts/entrypoint.py build_and_test --input_file input_${{ matrix.index }}.json
- name: Install tests dependencies
run: |
Expand Down Expand Up @@ -167,22 +167,22 @@ jobs:
- name: Launch test nanosp
if: ${{ env.test_nanosp }}
run: |
python scripts/build_and_test/main.py --sdk_ref ${{ env.api_level_nanosp }} --input_file input_${{ matrix.index }}.json --test --nanosp --skip_setup --output_file test_nanosp_${{ matrix.index }}.json --logs_file log_nanosp.txt
run: |
python scripts/entrypoint.py build_and_test --sdk_ref ${{ env.api_level_nanosp }} --input_file input_${{ matrix.index }}.json --test --nanosp --skip_setup --output_file test_nanosp_${{ matrix.index }}.json --logs_file log_nanosp.txt
- name: Launch test nanox
if: ${{ env.test_nanox }}
run: |
python scripts/build_and_test/main.py --sdk_ref ${{ env.api_level_nanox }} --input_file input_${{ matrix.index }}.json --test --nanox --skip_setup --output_file test_nanox_${{ matrix.index }}.json --logs_file log_nanox.txt
run: |
python scripts/entrypoint.py build_and_test --sdk_ref ${{ env.api_level_nanox }} --input_file input_${{ matrix.index }}.json --test --nanox --skip_setup --output_file test_nanox_${{ matrix.index }}.json --logs_file log_nanox.txt
- name: Launch test stax
if: ${{ env.test_stax }}
run: |
python scripts/build_and_test/main.py --sdk_ref ${{ env.api_level_stax }} --input_file input_${{ matrix.index }}.json --test --stax --skip_setup --output_file test_stax_${{ matrix.index }}.json --logs_file log_stax.txt
run: |
python scripts/entrypoint.py build_and_test --sdk_ref ${{ env.api_level_stax }} --input_file input_${{ matrix.index }}.json --test --stax --skip_setup --output_file test_stax_${{ matrix.index }}.json --logs_file log_stax.txt
- name: Merge output files
run: |
python scripts/output_scripts/merge.py --input_pattern "test_*.json" --output_file test_output_${{ matrix.index }}.json --key "test"
run: |
python scripts/entrypoint.py merge_output --input_pattern "test_*.json" --output_file test_output_${{ matrix.index }}.json --key "test"
- name: Archive output file
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -339,8 +339,8 @@ jobs:
name: test_output_10.json

- name: Merge output files
run: |
python scripts/output_scripts/merge.py --input_pattern "test_output_*.json" --output_file test_output.json --key "test"
run: |
python scripts/entrypoint.py merge_output --input_pattern "test_output_*.json" --output_file test_output.json --key "test"
- name: Archive output file
uses: actions/upload-artifact@v3
Expand All @@ -351,15 +351,15 @@ jobs:

- name: Convert to markdown
run: |
python scripts/output_scripts/convert.py --input_file test_output.json --output_file out.md --key test
python scripts/entrypoint.py convert_output --input_file test_output.json --output_file out.md --key test
cat out.md >> $GITHUB_STEP_SUMMARY
- name: Echo GHA url
run: echo "url"=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $GITHUB_ENV

- name: Convert to slack json
run: |
python scripts/output_scripts/slack.py --input_file test_output.json --output_file slack.json --key test --url ${{ env.url }}
python scripts/entrypoint.py slack_output --input_file test_output.json --output_file slack.json --key test --url ${{ env.url }}
- name: Send custom JSON data to Slack workflow
if: ${{ github.event_name == 'schedule' || inputs.send_to_slack == true }}
Expand All @@ -372,4 +372,4 @@ jobs:

- name: Set job status
run: |
python scripts/output_scripts/status.py --input_file test_output.json --key test
python scripts/entrypoint.py status_output --input_file test_output.json --key test
Loading

0 comments on commit 29a0e56

Please sign in to comment.