Skip to content
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
1 change: 1 addition & 0 deletions .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ mbed
MBED
mbedcrypto
MBEDTLSSL
mbedx
Merkle
misra
Misra
Expand Down
173 changes: 18 additions & 155 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,167 +1,30 @@
name: Release automation

permissions:
contents: write
pull-requests: write

on:
workflow_dispatch:
inputs:
commit_id:
description: 'Commit ID to tag and create a release for'
required: true
version_number:
description: 'Release Version Number (Eg, v1.0.0)'
required: true
branch:
description: 'Branch to release from'
required: false
default: 'main'

jobs:
tag-commit:
name: Tag commit
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit_id }}
- name: Configure git identity
env:
ACTOR: ${{ github.actor }}
run: |
git config --global user.name "$ACTOR"
git config --global user.email "$ACTOR"@users.noreply.github.com
- name: create a new branch that references commit id
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
COMMIT_ID: ${{ github.event.inputs.commit_id }}
run: git checkout -b "$VERSION_NUMBER" "$COMMIT_ID"
- name: Generate SBOM
uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main
with:
repo_path: ./
source_path: ./source
- name: commit SBOM file
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
git add .
git commit -m 'Update SBOM'
git push -u origin "$VERSION_NUMBER"
- name: Tag Commit and Push to remote
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
git tag "$VERSION_NUMBER" -a -m "corePKCS11 Library $VERSION_NUMBER"
git push origin --tags
- name: Verify tag on remote
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
COMMIT_ID: ${{ github.event.inputs.commit_id }}
run: |
git tag -d "$VERSION_NUMBER"
git remote update
git checkout tags/"$VERSION_NUMBER"
git diff "$COMMIT_ID" tags/"$VERSION_NUMBER"
create-zip:
needs: tag-commit
name: Create ZIP and verify package for release asset.
runs-on: ubuntu-latest
steps:
- name: Install ZIP tools
run: sudo apt-get install zip unzip
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commit_id }}
path: corePKCS11
submodules: recursive
- name: Checkout disabled submodules
run: |
cd corePKCS11
git submodule update --init --checkout --recursive
- name: Create ZIP
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
zip -r corePKCS11-"$VERSION_NUMBER".zip corePKCS11 -x "*.git*"
ls ./
- name: Validate created ZIP
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
mkdir zip-check
mv corePKCS11-"$VERSION_NUMBER".zip zip-check
cd zip-check
unzip corePKCS11-"$VERSION_NUMBER".zip -d corePKCS11-"$VERSION_NUMBER"
ls corePKCS11-"$VERSION_NUMBER"
diff -r -x "*.git*" corePKCS11-"$VERSION_NUMBER"/corePKCS11/ ../corePKCS11/
cd ../
- name: Build
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
cd zip-check/corePKCS11-"$VERSION_NUMBER"/corePKCS11
sudo apt-get install -y lcov
cmake -S test -B build/ \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_CLONE_SUBMODULES=ON \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
make -C build/ all
- name: Test
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
cd zip-check/corePKCS11-"$VERSION_NUMBER"/corePKCS11/build/
ctest -E system --output-on-failure
cd ..
- name: Create artifact of ZIP
uses: actions/upload-artifact@v4
with:
name: corePKCS11-${{ github.event.inputs.version_number }}.zip
path: zip-check/corePKCS11-${{ github.event.inputs.version_number }}.zip
deploy-doxygen:
needs: tag-commit
name: Deploy doxygen documentation
runs-on: ubuntu-latest
steps:
- name: Doxygen generation
uses: FreeRTOS/CI-CD-Github-Actions/doxygen-generation@main
with:
ref: ${{ github.event.inputs.version_number }}
add_release: "true"
create-release:
permissions:
id-token: write
needs:
- create-zip
- deploy-doxygen
name: Create Release and Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version_number }}
release_name: ${{ github.event.inputs.version_number }}
body: Release ${{ github.event.inputs.version_number }} of the corePKCS11 Library.
draft: false
prerelease: false
- name: Download ZIP artifact
uses: actions/download-artifact@v4
with:
name: corePKCS11-${{ github.event.inputs.version_number }}.zip
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./corePKCS11-${{ github.event.inputs.version_number }}.zip
asset_name: corePKCS11-${{ github.event.inputs.version_number }}.zip
asset_content_type: application/zip
- name: Backup Release Asset
id: backup_release_asset
uses: FreeRTOS/CI-CD-Github-Actions/artifact-backup@main
with:
artifact_path: ./corePKCS11-${{ github.event.inputs.version_number }}.zip
release_tag: ${{ github.event.inputs.version_number }}
- name: Release
uses: FreeRTOS/CI-CD-Github-Actions/release@main
with:
version_number: ${{ github.event.inputs.version_number }}
branch: ${{ github.event.inputs.branch }}
github_token: ${{ secrets.GITHUB_TOKEN }}
repo_build_command: rm -rf ../build && cmake -S. -B ../build -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DSTANDALONE_TEST_BUILD_UNIX=1 && make -C ../build all
run_test_command: 'sudo apt-get install -y lcov && export CFLAGS="-Wall -Wextra -DNDEBUG" && rm -rf ../build && cmake -S test -B ../build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DUNITTEST=1 -DSYSTEM_TESTS=0 -DCMAKE_C_FLAGS="${CFLAGS}" && make -C ../build all && ctest --test-dir ../build/ -E system --output-on-failure'
52 changes: 52 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.15)

project(corePKCS11 LANGUAGES C)

# ------------------------------------------------------------------------------
# Includes
# ------------------------------------------------------------------------------

include(${CMAKE_CURRENT_LIST_DIR}/pkcsFilePaths.cmake)

# ------------------------------------------------------------------------------
# Library targets
# ------------------------------------------------------------------------------

add_library( core_pkcs )


target_sources( core_pkcs PUBLIC ${PKCS_SOURCES}
${PKCS_PAL_POSIX_SOURCES} )

target_include_directories( core_pkcs PUBLIC ${PKCS_INCLUDE_PUBLIC_DIRS}
${PKCS_PAL_INCLUDE_PUBLIC_DIRS} )

if(STANDALONE_TEST_BUILD_UNIX)
include(FetchContent)

FetchContent_Declare( pkcs11
GIT_REPOSITORY https://github.com/oasis-tcs/pkcs11.git
GIT_TAG 478bfc5077901865993e3a193777c1a9f6516cdf
)
FetchContent_MakeAvailable( pkcs11 )

set( ENABLE_PROGRAMS OFF CACHE BOOL "" FORCE )
set( ENABLE_TESTING OFF CACHE BOOL "" FORCE )

FetchContent_Declare( mbedtls
GIT_REPOSITORY https://github.com/Mbed-TLS/mbedtls.git
GIT_TAG mbedtls-3.6.5
)
FetchContent_MakeAvailable( mbedtls )

target_compile_definitions( mbedcrypto PUBLIC MBEDTLS_THREADING_C MBEDTLS_THREADING_PTHREAD )
target_compile_definitions( core_pkcs PUBLIC MBEDTLS_THREADING_C MBEDTLS_THREADING_PTHREAD )

target_include_directories( core_pkcs PUBLIC ${CMAKE_CURRENT_LIST_DIR}/test/include
${pkcs11_SOURCE_DIR}/published/2-40-errata-1
${mbedtls_SOURCE_DIR}/include
${mbedtls_SOURCE_DIR}/library
${mbedtls_SOURCE_DIR}/include/mbedtls )

target_link_libraries( core_pkcs PUBLIC mbedtls mbedcrypto mbedx509 )
endif()
Loading