Skip to content
Draft
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
29 changes: 29 additions & 0 deletions .ci/build-kit/scripts/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

TRAILBOOK_everest_IS_RELEASE=${TRAILBOOK_everest_IS_RELEASE:-"OFF"}
TRAILBOOK_everest_INSTANCE_NAME=${TRAILBOOK_everest_INSTANCE_NAME:-"nightly"}
TRAILBOOK_everest_OVERWRITE_EXISTING_INSTANCE=${TRAILBOOK_everest_OVERWRITE_EXISTING_INSTANCE:-"OFF"}

cmake \
-B "$EXT_MOUNT/build" \
-S "$EXT_MOUNT/source" \
-G Ninja \
-D EVC_ENABLE_CCACHE=ON \
-D EVEREST_ENABLE_COMPILE_WARNINGS=ON \
-D EVEREST_BUILD_DOCS=ON \
-D TRAILBOOK_everest_DOWNLOAD_ALL_VERSIONS=ON \
-D TRAILBOOK_everest_IS_RELEASE=$TRAILBOOK_everest_IS_RELEASE \

Check warning on line 15 in .ci/build-kit/scripts/build_docs.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.ci/build-kit/scripts/build_docs.sh#L15

Double quote to prevent globbing and word splitting.
-D TRAILBOOK_everest_INSTANCE_NAME="$TRAILBOOK_everest_INSTANCE_NAME" \
-D TRAILBOOK_everest_OVERWRITE_EXISTING_INSTANCE=$TRAILBOOK_everest_OVERWRITE_EXISTING_INSTANCE

Check warning on line 17 in .ci/build-kit/scripts/build_docs.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.ci/build-kit/scripts/build_docs.sh#L17

Double quote to prevent globbing and word splitting.
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Configuring failed with return code $retVal"
exit $retVal
fi

ninja -C "$EXT_MOUNT/build" trailbook_everest
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Compiling failed with return code $retVal"
exit $retVal
fi
2 changes: 1 addition & 1 deletion .ci/build-kit/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

ninja -C "$EXT_MOUNT/build" install
ninja -C "$EXT_MOUNT/build" install/strip
retVal=$?

if [ $retVal -ne 0 ]; then
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ jobs:
do_not_run_coverage_badge_creation: true
run_install_wheels: true
run_integration_tests: true
build-docs:
name: Call Build Documentation
needs:
- ci
uses: ./.github/workflows/build_docs.yaml
with:
runner: ${{ inputs.runner || 'ubuntu-24.04' }}
deploy_docs: false
ocpp-tests:
name: OCPP Tests
needs:
Expand Down
126 changes: 126 additions & 0 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Build Documentation
on:
workflow_call:
inputs:
runner:
description: 'Which runner to use'
required: false
default: 'ubuntu-24.04'
type: string
use_build_cache:
description: 'Whether to use build cache or not'
required: false
default: true
type: boolean
build_kit_scripts_directory:
description: 'Directory in the repository where the build kit scripts are located'
required: false
default: '.ci/build-kit/scripts'
type: string
deploy_docs:
description: 'Whether to deploy the built documentation to the target repository'
required: false
default: false
type: boolean


jobs:
build-docs:
name: Build EVerest Documentation
runs-on: ${{ inputs.runner }}
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
steps:
- name: Setup SSH Agent, optional with SSH key
env:
SSH_KEY: ${{ secrets.SA_GITHUB_SSH_KEY }}
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
if [ -z "${{ env.SSH_KEY }}" ]; then
echo "No SSH key provided, skipping SSH key setup"
exit 0
fi
mkdir -p ~/.ssh
echo "${{ env.SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# Check if github.com is already in known_hosts, if not, add it
if ! grep -q "^github.com " ~/.ssh/known_hosts; then
ssh-keyscan github.com >> ~/.ssh/known_hosts
fi
ssh-add ~/.ssh/id_ed25519
- name: Configure Git user
run: |
git config --global user.name "Pionix Github Service Account"
git config --global user.email "[email protected]"
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.BUILD_KIT_IMAGE_NAME }}
sep-tags: ","
- name: Set output tag
id: buildkit_tag
shell: python3 {0}
run: |
import os
tags = "${{ steps.meta.outputs.tags }}".split(",")
if len(tags) == 0:
print("No tags found!❌")
exit(1)
tag = f"local/build-kit-everest-core:{tags[0]}"
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"tag={tag}\n")
print(f"Set tag={tag}")
- name: Download build-kit image
uses: actions/download-artifact@v4
with:
name: build-kit
- name: Load build-kit image
run: |
docker load -i build-kit.tar
docker image tag ${{ steps.buildkit_tag.outputs.tag }} build-kit
- name: Format branch name for cache key
if: ${{ inputs.use_build_cache == 'true' }}
run: |
BRANCH_NAME_FOR_CACHE="${GITHUB_REF_NAME//-/_}"
echo "branch_name_for_cache=${BRANCH_NAME_FOR_CACHE}" >> "$GITHUB_ENV"
- name: Setup cache
if: ${{ inputs.use_build_cache == 'true' }}
uses: actions/cache@v4
with:
path: cache
key: compile-${{ env.branch_name_for_cache }}-${{ github.sha }}
restore-keys: |
compile-${{ env.branch_name_for_cache }}-
compile-
- name: Checkout repository
uses: actions/checkout@v4
with:
path: source
- name: Setup run scripts
run: |
mkdir scripts
rsync -a source/${{ inputs.build_kit_scripts_directory }}/ scripts
- name: Build Documentation
run: |
docker run \
--mount type=bind,source=$SSH_AUTH_SOCK,target=/ssh-agent \
--env SSH_AUTH_SOCK=/ssh-agent \
--env TRAILBOOK_everest_IS_RELEASE=OFF \
--env TRAILBOOK_everest_INSTANCE_NAME=nightly \
--env TRAILBOOK_everest_OVERWRITE_EXISTING_INSTANCE=ON \
--volume "${{ github.workspace }}:/ext" \
--name build-docs-container \
build-kit run-script build_docs
- name: Upload Documentation Artifact
uses: actions/[email protected]
with:
if-no-files-found: error
path: ${{ github.workspace }}/build/docs/deployed_docs_repo/docs/
name: docs-html
- name: Deploy Documentation
if: ${{ inputs.deploy_docs == true }}
run: |
cd ${{ github.workspace }}/build/docs/deployed_docs_repo
git commit -a -m "Update nightly documentation from commit ${{ github.sha }}"
git push
29 changes: 29 additions & 0 deletions .github/workflows/on_main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build, Lint and Test
on:
push:
branches:
- main

jobs:
ci:
name: Build, Lint and Test
uses: everest/everest-ci/.github/workflows/[email protected]
permissions:
contents: read
secrets:
coverage_deploy_token: ${{ secrets.SA_GITHUB_PAT }}
with:
runner: ${{ inputs.runner || 'ubuntu-22.04' }}
artifact_deploy_target_repo: EVerest/everest.github.io
run_coverage: false
do_not_run_coverage_badge_creation: true
run_install_wheels: true
run_integration_tests: true
build-docs:
name: Call Build Documentation
needs:
- ci
uses: ./.github/workflows/build_docs.yaml
with:
runner: ${{ inputs.runner || 'ubuntu-24.04' }}
deploy_docs: true
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ if(EVEREST_CORE_BUILD_TESTING)

if(EVEREST_ENABLE_DEBUG_BUILD)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
else()
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE)
endif()
endif()

Expand Down
12 changes: 11 additions & 1 deletion applications/utils/scripts/create_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def main():
parser.add_argument('--allow-relative-to-working-dir', action='store_true', help='Allow temporary directory to be relative to working dir (dangerous!)')
parser.add_argument('--post-process', action='store_true', help='Postprocess existing snapshot')
parser.add_argument('--include-external-deps', action='store_true', help='Include external dependencies in snapshot')
parser.add_argument('--exclude-dir', action='append', dest='excluded_dirs', type=str, help='Exclude specified directory from snapshot (can be used multiple times)', default=[])

args = parser.parse_args()

Expand All @@ -62,6 +63,12 @@ def main():
print(f'Temporary directory cannot be relative to working directory: {tmp_dir}')
return 1

excluded_paths = []
for excluded_dir in args.excluded_dirs:
excluded_path = working_dir / excluded_dir
excluded_path = excluded_path.expanduser().resolve()
excluded_paths.append(excluded_path)

if not args.post_process and tmp_dir.exists():
print(f'Temporary directory dir already exists, deleting it: {tmp_dir}')
shutil.rmtree(tmp_dir, ignore_errors=True)
Expand All @@ -77,6 +84,9 @@ def main():
if subdir_path == tmp_dir:
print(f'{subdir_path} is tmp dir, ignoring')
continue
if subdir_path in excluded_paths:
print(f'{subdir_path} is excluded, ignoring')
continue
print(f'Copying {subdir_path} to {tmp_dir}')
destdir = tmp_dir / subdir_path.name

Expand Down Expand Up @@ -113,7 +123,7 @@ def main():
for dep_versions in versions:
dependency, version = dep_versions.split(':')
if dependency in snapshot:
print(f'Overriding {dependency} version {snapshot[dependency]['git_tag']} to {version}')
print(f'Overriding {dependency} version {snapshot[dependency]["git_tag"]} to {version}')
snapshot[dependency]['git_tag'] = version
for dependency, entry in snapshot.items():
git_tag = ''
Expand Down
3 changes: 3 additions & 0 deletions cmake/trailbook-ext-everest/create-snapshot.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ function(trailbook_ev_create_snapshot)
--working-dir ${args_EVEREST_WORKSPACE_DIRECTORY}
--temp-dir ${CREATE_SNAPSHOT_TEMP_DIR}
--allow-relative-to-working-dir
--exclude-dir build/
--exclude-dir .vscode/
--exclude-dir dist/
COMMAND
${CMAKE_COMMAND} -E copy
${CREATE_SNAPSHOT_TEMP_DIR}/snapshot.yaml
Expand Down
Loading
Loading