Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update ci workflows and tests #8

Merged
merged 3 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Checklist

<!-- Put an `x` in each box when you have completed the items. -->

- [ ] App update process has been followed <!-- See comment below -->
- [ ] Target branch is `develop` <!-- unless you have a very good reason -->
- [ ] Application version has been bumped <!-- required if your changes are to be deployed -->
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ on:
jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1.40.0
with:
upload_app_binaries_artifact: "compiled_app_binaries"
run_for_devices: '["nanos", "nanox", "nanosp"]'

ragger_tests:
name: Run ragger tests using the reusable workflow
needs: build_application
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1.40.0
with:
download_app_binaries_artifact: "compiled_app_binaries"
test_dir: tests/functional
run_for_devices: '["nanos", "nanox", "nanosp"]'
21 changes: 11 additions & 10 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
Expand All @@ -16,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Parse short sha
uses: benjlevesque/short-sha@v2.2
uses: benjlevesque/short-sha@v3.0
id: short-sha
with:
length: 7
Expand All @@ -29,18 +30,18 @@ jobs:
needs: prepare

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:3.22.1

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

- name: Build
run: |
make

- name: Upload app binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.3.3
with:
name: app-solar-nanos-${{ needs.prepare.outputs.sha7 }}
path: bin
Expand All @@ -51,18 +52,18 @@ jobs:
needs: prepare

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:3.22.1

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

- name: Build
run: |
make BOLOS_SDK=$NANOSP_SDK

- name: Upload app binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.3.3
with:
name: app-solar-nanosp-${{ needs.prepare.outputs.sha7 }}
path: bin
Expand All @@ -73,18 +74,18 @@ jobs:
needs: prepare

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:3.22.1

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

- name: Build
run: |
make BOLOS_SDK=$NANOX_SDK

- name: Upload app binary
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.3.3
with:
name: app-solar-nanox-${{ needs.prepare.outputs.sha7 }}
path: bin
8 changes: 4 additions & 4 deletions .github/workflows/codeql_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
language: [ 'cpp' ]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:3.22.1

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3.25.5
with:
languages: ${{ matrix.language }}
queries: security-and-quality
Expand All @@ -43,4 +43,4 @@ jobs:
make BOLOS_SDK=${{ matrix.sdk }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3.25.5
2 changes: 1 addition & 1 deletion .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
jobs:
check_linting:
name: Check linting using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1.40.0
with:
source: './src'
extensions: 'h,c'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/documentation_generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
name: Generate project documentation
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:3.22.1

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

- name: HTML documentation
run: doxygen .doxygen/Doxyfile

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4.3.3
with:
name: app-solar-docs
path: doc/html
4 changes: 1 addition & 3 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ on:
jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
with:
run_for_devices: '["nanos", "nanosp", "nanox"]'
uses: LedgerHQ/ledger-app-workflows/.github/workflows/[email protected]
4 changes: 2 additions & 2 deletions .github/workflows/misspellings_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

- name: Check misspellings
uses: codespell-project/actions-codespell@v1
uses: codespell-project/actions-codespell@v2.0
with:
builtin: clear,rare
check_filenames: true
41 changes: 0 additions & 41 deletions .github/workflows/static_analysis.yml

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
Expand All @@ -14,13 +15,12 @@ jobs:
job_unit_test:
name: Unit test
runs-on: ubuntu-latest

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:3.22.1

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4.1.5

- name: Build unit tests
run: |
Expand All @@ -36,17 +36,17 @@ jobs:
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info && \
genhtml coverage.info -o coverage

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4.3.3
with:
name: code-coverage
path: tests/unit-tests/coverage

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v3.1.6
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/unit-tests/coverage.info
fail_ci_if_error: true
files: ./tests/unit-tests/coverage.info
flags: unittests
name: codecov-app-solar
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
4 changes: 4 additions & 0 deletions ledger_app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
build_directory = "./"
sdk = "C"
devices = ["nanos", "nanox", "nanos+"]

[tests]
unit_directory = "./tests/unit-tests/"
pytest_directory = "./tests/functional"
File renamed without changes.
2 changes: 1 addition & 1 deletion src/transaction/deserialise.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#include "constants.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"
#include "transaction/transaction_utils.h"
#include "transaction/types.h"

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/transaction/types/burn.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "constants.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"

parser_status_e burn_type_deserialise(buffer_t *buf, burn_transaction_asset_t *tx) {
// amount
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/types/burn.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "buffer.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"

typedef struct {
uint64_t amount; /// amount (8 bytes)
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/types/ipfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "constants.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"

parser_status_e ipfs_type_deserialise(buffer_t *buf, ipfs_transaction_asset_t *tx) {
// ipfs
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/types/ipfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "buffer.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"

typedef struct {
uint8_t ipfs_length; /// ipfs length (1 byte)
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/types/transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "constants.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"

parser_status_e transfer_type_deserialise(buffer_t *buf, transfer_transaction_asset_t *tx) {
// length
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/types/transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "buffer.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"

#define MIN_NUM_TRANSFERS 1
#define MAX_NUM_TRANSFERS 40 // Limited respect to protocol maximum due to SRAM limitations
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/types/vote.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "constants.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"
#include "transaction/transaction_utils.h"

parser_status_e vote_type_deserialise(buffer_t *buf, vote_transaction_asset_t *tx) {
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/types/vote.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "buffer.h"

#include "transaction/errors.h"
#include "transaction/transaction_errors.h"

#define MAX_NUM_VOTES 53
#define MIN_USERNAME_LENGTH 1
Expand Down
22 changes: 21 additions & 1 deletion tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from ragger.conftest import configuration

from ragger.navigator import NavInsID
import pytest
###########################
### CONFIGURATION START ###
###########################
Expand All @@ -13,3 +14,22 @@

# Pull all features from the base ragger conftest using the overridden configuration
pytest_plugins = ("ragger.conftest.base_conftest", )

# Notes :
# 1. Remove this fixture once the pending review screen is removed from the app
# 2. This fixture clears the pending review screen before each test
# 3. The scope should be the same as the one configured by BACKEND_SCOPE in
# ragger/conftest/configuration.py
@pytest.fixture(scope="class", autouse=True)
def clear_pending_review(firmware, navigator):
print("Clearing pending review")
# Press a button to clear the pending review
if firmware.device.startswith("nano"):
instructions = [
NavInsID.BOTH_CLICK,
]
else:
instructions = [
NavInsID.TAPPABLE_CENTER_TAP,
]
navigator.navigate(instructions,screen_change_before_first_instruction=False)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading