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

Adds new GitHub action to run unit tests #146

Merged
merged 13 commits into from
Aug 28, 2023
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
34 changes: 34 additions & 0 deletions .github/workflows/build-test-virtual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Build/test (virtual)"
on: [push]
jobs:
build-test:
runs-on: ubuntu-20.04
ivarprudnikov marked this conversation as resolved.
Show resolved Hide resolved
defaults:
run:
shell: bash
container:
image: mcr.microsoft.com/ccf/app/dev:3.0.9-virtual
env:
# Helps to distinguish between CI and local builds.
SCITT_CI: 1
# Additional CMake flags.
PLATFORM: virtual
CMAKE_BUILD_TYPE: Debug
ENABLE_PREFIX_TREE: ON
ENABLE_CLANG_TIDY: ON
ivarprudnikov marked this conversation as resolved.
Show resolved Hide resolved
# These make CI print all the errors, rather than stopping early.
CXXFLAGS: -ferror-limit=0
NINJA_FLAGS: -k 0
steps:
- name: Checkout repository with tags
uses: actions/checkout@v3
with:
fetch-depth: 0
# Work-around for https://github.com/actions/runner/issues/2033
- name: Work around git safe.directory in container
run: chown -R $(id -u):$(id -g) $PWD
- run: apt-get update && apt-get install -y libcurl4-openssl-dev faketime clang-tidy-10
- run: ./scripts/ci-checks.sh
- run: ./build.sh
- run: ./run_unit_tests.sh
- run: ./run_functional_tests.sh --enable-prefix-tree --enable-faketime
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# scitt-ccf-ledger

[![Build/test (virtual)](https://github.com/microsoft/scitt-ccf-ledger/actions/workflows/build-test-virtual.yml/badge.svg)](https://github.com/microsoft/scitt-ccf-ledger/actions/workflows/build-test-virtual.yml)

This repository contains the source code for scitt-ccf-ledger, an application
that runs on top of [CCF](https://ccf.dev/) implementing draft standards developed within the [IETF SCITT WG](https://datatracker.ietf.org/wg/scitt/about/). Its purpose is to provide provenance for artefacts in digital supply chains, increasing trust in those artefacts. scitt-ccf-ledger achieves this by allowing signed claims about artefacts to be submitted to a secure immutable ledger, and returning receipts which prove claims have been stored and registration policies applied.

Expand Down
2 changes: 2 additions & 0 deletions docker/start-app.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# This configuration is a temporary workaround until we migrate to CCF 4.0.3, which supports
# a cchost "config-timeout" option to accomplish a similar result. This logic is required when
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ then
fi

source scripts/venv/bin/activate
pip install --disable-pip-version-check -q -U black isort mypy
pip install --disable-pip-version-check -q -U black isort mypy wheel
pip install --disable-pip-version-check -q -e ./pyscitt
pip install --disable-pip-version-check -q -r test/requirements.txt

Expand Down
12 changes: 9 additions & 3 deletions test/load_test/locustfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@

CLIENT_WAIT_TIME = 0.01


@events.init_command_line_parser.add_listener
def init_parser(parser):
parser.add_argument("--scitt-claims", help="Path to claims directory")
parser.add_argument(
"--skip-confirmation",
"--skip-confirmation",
help="Whether to skip claim submission confirmation or not",
action="store_true",
action="store_true",
default=False,
)

Expand Down Expand Up @@ -56,4 +57,9 @@ def on_start(self):
@task
def submit_claim(self):
claim = self._claims[random.randrange(len(self._claims))]
self.trace("submit_claim", lambda: self.client.submit_claim(claim, skip_confirmation=self.skip_confirmation))
self.trace(
"submit_claim",
lambda: self.client.submit_claim(
claim, skip_confirmation=self.skip_confirmation
),
)
1 change: 1 addition & 0 deletions test/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
LOCUST_USERS_SPAWN_RATE = 10
LOCUST_RUNTIME_SEC = 60


@pytest.mark.perf
@pytest.mark.disable_proxy
class TestLoad:
Expand Down
3 changes: 2 additions & 1 deletion test/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

import pytest

from pyscitt import crypto, governance
from pyscitt import crypto

DEFAULT_ITERATIONS_NUM = 10
CLIENT_WAIT_TIME = 0.01


def measure_latency(fn, arg_fn=None, n=DEFAULT_ITERATIONS_NUM):
if arg_fn is None:

Expand Down
Loading