From 688eebbd1ad2748ad87be5ea2ec47d34d718fbfe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2024 03:30:06 +0000 Subject: [PATCH] add Renovate and custom workflow files --- .github/CODEOWNERS | 46 ----- .github/ISSUE_TEMPLATE/bug_report.yaml | 57 ------- .github/ISSUE_TEMPLATE/feature_request.yaml | 60 ------- .github/pull_request_template.md | 9 - .github/workflows/bazel_build_and_test.yaml | 22 --- .github/workflows/build_and_test.yaml | 161 ------------------ .github/workflows/dco-check.yaml | 20 --- .github/workflows/sync-fork.yml | 89 ++++++++++ .../trivy-dependencies-submission.yml | 27 +++ .github/workflows/unit_test.yml | 28 --- .gitignore | 7 - renovate.json5 | 12 ++ 12 files changed, 128 insertions(+), 410 deletions(-) delete mode 100644 .github/CODEOWNERS delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.yaml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.yaml delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/bazel_build_and_test.yaml delete mode 100644 .github/workflows/build_and_test.yaml delete mode 100644 .github/workflows/dco-check.yaml create mode 100644 .github/workflows/sync-fork.yml create mode 100644 .github/workflows/trivy-dependencies-submission.yml delete mode 100644 .github/workflows/unit_test.yml delete mode 100644 .gitignore create mode 100644 renovate.json5 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index d43ddb76bb..0000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,46 +0,0 @@ -# default option unless later match takes precedence -* @pietfried @hikinggrass @corneliusclaussen - -# .github -/.github/ @pietfried @corneliusclaussen - -# cmake -/cmake/ @hikinggrass @a-w50 @corneliusclaussen - -# lib -/lib/3rd_party/nanopb/ @a-w50 @corneliusclaussen @hikinggrass -/lib/staging/can_dpm1000/ @a-w50 @corneliusclaussen @hikinggrass -/lib/staging/gpio/ @corneliusclaussen @hikinggrass @hikinggrass -/lib/staging/ocpp/ @hikinggrass @pietfried @corneliusclaussen -/lib/staging/slac/ @a-w50 @corneliusclaussen @SebaLukas -/lib/staging/tls/ @james-ctc @AssemblyJohn @corneliusclaussen @SebaLukas - -# modules -/modules/API/ @hikinggrass @pietfried @corneliusclaussen -/modules/Auth/ @pietfried @corneliusclaussen @hikinggrass -/modules/Energymanager/ @corneliusclaussen @hikinggrass @pietfried -/modules/EnergyNode/ @corneliusclaussen @hikinggrass @pietfried -/modules/EvseManager/ @corneliusclaussen @SebaLukas @hikinggrass @pietfried -/modules/EvManager/ @SebaLukas @pietfried @MarzellT -/modules/EvseSecurity/ @AssemblyJohn @pietfried @hikinggrass -/modules/EvseV2G/ @corneliusclaussen @SebaLukas @james-ctc -/modules/EvseSlac/ @a-w50 @corneliusclaussen @SebaLukas -/modules/OCPP/ @hikinggrass @pietfried @maaikez -/modules/OCPP201/ @hikinggrass @pietfried @maaikez -/modules/PacketSniffer @corneliusclaussen @SebaLukas @hikinggrass -/modules/PyEvJosev @SebaLukas @corneliusclaussen @pietfried -/modules/Setup @hikinggrass @corneliusclaussen @pietfried -/modules/YetiDriver @corneliusclaussen @hikinggrass -/modules/simulation/ @SebaLukas @pietfried @hikinggrass -/modules/rust_examples/ @SirVer @golovasteek @dorezyuk -**/Cargo.toml @SirVer @golovasteek @dorezyuk -**/Cargo.lock @SirVer @golovasteek @dorezyuk - - -# Rust & Bazel -*.rs @SirVer @golovasteek @dorezyuk -*.bazel @SirVer @golovasteek @dorezyuk -*.bzl @SirVer @golovasteek @dorezyuk - -# third-party/bazel -/third-party/bazel/deps_versions.bzl @pietfried @hikinggrass @corneliusclaussen @SebaLukas @a-w50 @SirVer @golovasteek @dorezyuk diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml deleted file mode 100644 index 8544735c12..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ /dev/null @@ -1,57 +0,0 @@ -name: Bug Report -description: Thanks for taking the time to fill out this bug report! - -body: - - type: textarea - id: description - attributes: - label: Describe the bug - description: A clear and concise description of what the bug is. If applicable, add screenshots or logfiles to help explain your problem. - validations: - required: true - - type: dropdown - id: affected-domain - attributes: - label: EVerest Domain - description: Can you specify a specific domain is affected by the issue? Mark multiple if applicable. - options: - - Authorization - - Charge Control - - CHAdeMO - - Energy Management - - Hardware Drivers - - ISO15118 - - Power Supplies - - OCPP - - OCPP1.6 - - OCPP2.0.1 - - Simulation - - SLAC - - Compilation - - Utility - - Testing - - Other - multiple: true - validations: - required: true - - - type: textarea - id: affected-module - attributes: - label: Affected EVerest Module - description: | - Please specify the module where the bug is located. If you are not sure, please leave this field empty. - - - type: textarea - id: reproduction - attributes: - label: To Reproduce - description: | - If applicable describe the steps to and additional information to reproduce the behavior - like EVerest configuration files, EVerest version, compile options and your system information. - - - type: textarea - id: other - attributes: - label: Anything else? - placeholder: Add any other context about the bug report here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml deleted file mode 100644 index 8a9dee09a5..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: Feature Request -description: Thanks for taking the time to fill out this feature request! - -body: - - type: textarea - id: description - attributes: - label: Describe the problem - description: What problem is your feature request targeting and why is it a problem? Please describe. - placeholder: | - A clear and concise description of what the problem is. - validations: - required: true - - - type: dropdown - id: affected-domain - attributes: - label: EVerest Domain - description: Can you specify a specific domain for which the feature is requested? Mark multiple if applicable. - options: - - Authorization - - Charge Control - - CHAdeMO - - Energy Management - - Hardware Drivers - - ISO15118 - - Power Supplies - - OCPP - - OCPP1.6 - - OCPP2.0.1 - - Simulation - - SLAC - - Compilation - - Utility - - Testing - - Other - multiple: true - validations: - required: true - - - type: textarea - id: affected-module - attributes: - label: Affected EVerest Module - description: | - Can you specify a module in which this feature shall be implemented? If you are not sure, please leave this field empty. - - - type: textarea - id: solution - attributes: - label: Describe your solution - description: Describe the solution you'd like - placeholder: | - A clear and concise description of what you want to happen. - - - type: textarea - id: other - attributes: - label: Additional context - placeholder: Add any other context about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index e4b7d8be66..0000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,9 +0,0 @@ -## Describe your changes - -## Issue ticket number and link - -## Checklist before requesting a review -- [ ] I have performed a self-review of my code -- [ ] I have made corresponding changes to the documentation -- [ ] I read the [contribution documentation](https://github.com/EVerest/EVerest/blob/main/CONTRIBUTING.md) and made sure that my changes meet its requirements - diff --git a/.github/workflows/bazel_build_and_test.yaml b/.github/workflows/bazel_build_and_test.yaml deleted file mode 100644 index 002218c037..0000000000 --- a/.github/workflows/bazel_build_and_test.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Bazel Build -run-name: ${{ github.actor }} is building with bazel -on: [pull_request] -jobs: - bazel-build-and-test: - runs-on: ubuntu-22.04 - steps: - - run: echo branch name is ${{ github.ref }} - - name: Checkout - uses: actions/checkout@v4.1.0 - - name: Mount bazel cache - uses: actions/cache@v3 - with: - path: "~/.cache/bazel" - key: ${{ runner.os }}-bazel-${{ hashFiles('dependencies.yaml', '.bazelversion', '.bazelrc', 'WORKSPACE.bazel', 'third-party/bazel/*') }} - restore-keys: | - ${{ runner.os }}-bazel- - - name: Build all - run: > - bazelisk build //... - - name: Test all - run: bazelisk test //... --test_output=errors diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml deleted file mode 100644 index 577f7dd143..0000000000 --- a/.github/workflows/build_and_test.yaml +++ /dev/null @@ -1,161 +0,0 @@ -name: Build, Lint and Test -on: - pull_request: {} - workflow_dispatch: - inputs: - runner: - description: Which runner to use - type: choice - default: 'ubuntu-22.04' - required: true - options: - - 'ubuntu-22.04' - - 'large-ubuntu-22.04-xxl' - schedule: - - cron: '37 13,1 * * *' - -env: - BUILD_KIT_IMAGE: ghcr.io/everest/build-kit-alpine:v1.2.0 - -jobs: - lint: - name: Lint - runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} - steps: - - name: Checkout everest-core - uses: actions/checkout@v4.1.6 - with: - path: source - - name: Run clang-format - uses: everest/everest-ci/github-actions/run-clang-format@v1.1.0 - with: - source-dir: source - extensions: hpp,cpp - exclude: cache - build: - name: Build and Unit Tests - runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} - steps: - - name: Format branch name for cache key - run: | - BRANCH_NAME_FOR_CACHE="${GITHUB_REF_NAME//-/_}" - echo "branch_name_for_cache=${BRANCH_NAME_FOR_CACHE}" >> "$GITHUB_ENV" - - name: Setup cache - uses: actions/cache@v3 - with: - path: cache - key: compile-${{ env.branch_name_for_cache }}-${{ github.sha }} - restore-keys: | - compile-${{ env.branch_name_for_cache }}- - compile- - - name: Checkout everest-core - uses: actions/checkout@v4.1.6 - with: - path: source - - name: Setup run scripts - run: | - mkdir scripts - rsync -a source/.ci/build-kit/ scripts - - name: Pull build-kit image - run: | - docker pull --quiet ${{ env.BUILD_KIT_IMAGE }} - docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit - - name: Compile - run: | - docker run \ - --volume "$(pwd):/ext" \ - --name compile-container \ - build-kit run-script compile - - name: Commit compile-container - run: | - docker commit compile-container build-image - - name: Run unit tests - run: | - docker run \ - --volume "$(pwd):/ext" \ - --name unit-tests-container \ - build-image run-script run_unit_tests - - name: Create dist - run: | - docker run \ - --volume "$(pwd):/ext" \ - --name install-container \ - build-image run-script install - - name: Tar dist dir and keep permissions - run: | - tar -czf dist.tar.gz dist - - name: Upload dist artifact - uses: actions/upload-artifact@v4.3.3 - with: - path: dist.tar.gz - name: dist - - name: Upload wheels artifact - uses: actions/upload-artifact@v4.3.3 - with: - path: dist-wheels - name: wheels - - name: Archive unit test results - if: always() - uses: actions/upload-artifact@v4.3.3 - with: - name: ctest-report - path: ${{ github.workspace }}/ctest-report - integration-tests: - name: Integration Tests - needs: build - runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} - steps: - - name: Download dist dir - uses: actions/download-artifact@v4.1.2 - with: - name: dist - - name: Extract dist.tar.gz - run: | - tar -xzf ${{ github.workspace }}/dist.tar.gz -C ${{ github.workspace }} - - name: Download wheels - uses: actions/download-artifact@v4.1.2 - with: - name: wheels - path: wheels - - name: Checkout everest-core - uses: actions/checkout@v4.1.6 - with: - path: source - - name: Setup run scripts - run: | - mkdir scripts - rsync -a source/.ci/build-kit/ scripts - - name: Pull build-kit image - run: | - docker pull --quiet ${{ env.BUILD_KIT_IMAGE }} - docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit - - name: Create integration-image - run: | - docker run \ - --volume "$(pwd):/ext" \ - --name prepare-container \ - build-kit run-script prepare_integration_tests - docker commit prepare-container integration-image - - name: Run integration tests - run: | - pushd source/.ci/e2e - docker-compose run \ - e2e-test-server \ - run-script run_integration_tests - - name: Upload result & report as artifact - if: always() - uses: actions/upload-artifact@v4.3.3 - with: - path: | - ${{ github.workspace }}/result.xml - ${{ github.workspace }}/report.html - name: pytest-results - - name: Render result - if: always() - uses: pmeier/pytest-results-action@v0.6.0 - with: - path: ${{ github.workspace }}/result.xml - summary: True - display-options: fEX - fail-on-empty: True - title: Test results diff --git a/.github/workflows/dco-check.yaml b/.github/workflows/dco-check.yaml deleted file mode 100644 index 70a5f6979a..0000000000 --- a/.github/workflows/dco-check.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: DCO Check -on: - pull_request: {} -jobs: - dco_check: - name: DCO Check - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.x - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install dco-check - run: pip3 install -U dco-check==0.4.0 - - name: Check DCO - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - dco-check diff --git a/.github/workflows/sync-fork.yml b/.github/workflows/sync-fork.yml new file mode 100644 index 0000000000..42ba380546 --- /dev/null +++ b/.github/workflows/sync-fork.yml @@ -0,0 +1,89 @@ +name: Sync fork + +on: + workflow_dispatch: {} + schedule: + - cron: "15 3 * * *" # Run every day at 3:15 UTC + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Checkout fork's default branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: "fork" + token: ${{ secrets.GH_PAT }} + - name: Checkout fork's configuration branch + uses: actions/checkout@v4 + with: + path: "configuration" + ref: "renovate-and-workflow-files" + token: ${{ secrets.GH_PAT }} + - name: Determine Upstream clone URL + id: upstream-repo-clone-url + uses: actions/github-script@v7 + with: + script: | + const { data } = await github.rest.repos.get({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + if (data.fork) { + return data.parent.clone_url; + } else { + throw new Error('This repository is not a fork.'); + } + result-encoding: string + - name: Determine Upstream default branch + id: upstream-repo-default-branch + uses: actions/github-script@v7 + with: + script: | + const { data } = await github.rest.repos.get({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + if (data.fork) { + return data.parent.default_branch; + } else { + throw new Error('This repository is not a fork.'); + } + result-encoding: string + - name: Sync fork with upstream + run: | + set -ex + cd fork + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git remote add upstream ${{ steps.upstream-repo-clone-url.outputs.result }} + git fetch upstream ${{ steps.upstream-repo-default-branch.outputs.result }} + UPSTREAM_MOST_RECENT_COMMIT_HASH=$(git log upstream/${{ steps.upstream-repo-default-branch.outputs.result }} -n 1 --format="%H") + PREVIOUS_SYNC_COMMIT_HASH=$(cat ../configuration/upstream_commit_hash) + if [ "$PREVIOUS_SYNC_COMMIT_HASH" = "$UPSTREAM_MOST_RECENT_COMMIT_HASH" ]; then + echo "No need to sync, already up-to-date" + exit 0 + fi + + git reset --hard upstream/${{ steps.upstream-repo-default-branch.outputs.result }} + # Enforce the usage of our own config (renovate.json5) + git rm renovate.json* || true + # Avoid problems where an existing .gitignore file would prevent committing our configuration files + git rm .gitignore || true + # Delete existing workflows, we don't need to run them in our fork + rm -rf .github || true + # Instead of using "cp -r", rsync allows us to exclude the .git directory + rsync -av --exclude '.git' ../configuration/ . + rm upstream_commit_hash + git add . + git commit -m "add Renovate and custom workflow files" + git push --force-with-lease + + cd ../configuration + # git config user.name "github-actions[bot]" + # git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + echo $UPSTREAM_MOST_RECENT_COMMIT_HASH > upstream_commit_hash + git add upstream_commit_hash + git commit -m "update commit hash to $UPSTREAM_MOST_RECENT_COMMIT_HASH" + git push diff --git a/.github/workflows/trivy-dependencies-submission.yml b/.github/workflows/trivy-dependencies-submission.yml new file mode 100644 index 0000000000..71f59af7e3 --- /dev/null +++ b/.github/workflows/trivy-dependencies-submission.yml @@ -0,0 +1,27 @@ +name: SBOM upload from Trivy + +on: + workflow_dispatch: {} + schedule: + - cron: "0 9 */5 * *" # Run every fifth day at 9 AM UTC + +jobs: + SBOM-upload: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@0.23.0 + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'github' + output: 'trivy-results.gsbom' + github-pat: ${{ secrets.GITHUB_TOKEN }} # this causes a curl call to upload the snapshot + + - name: Upload report file + uses: actions/upload-artifact@v4 + with: + name: trivy-results + path: trivy-results.gsbom diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml deleted file mode 100644 index db5efb683d..0000000000 --- a/.github/workflows/unit_test.yml +++ /dev/null @@ -1,28 +0,0 @@ - -name: Unit tests -on: - pull_request: {} - workflow_dispatch: - inputs: - runner: - description: Which runner to use - type: choice - default: 'ubuntu-22.04' - required: true - options: - - 'ubuntu-22.04' - - 'large-ubuntu-22.04-xxl' - -jobs: - manifests_tes: - name: Manifests test - runs-on: ${{ inputs.runner || 'ubuntu-22.04' }} - steps: - - uses: actions/checkout@v3 - - name: Install deps - run: pip3 install pytest - - name: Test mainfests - run: | - cd ${{ github.workspace }} - python3 -m pytest tests/manifest_tests/*.py - diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 70850d8c40..0000000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -*build -*build-cross -.cache/ -workspace.yaml -.vscode/ -/bazel-* -/modules/target diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 0000000000..53fe2ac327 --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,12 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + ":disableRateLimiting" + ], + "labels": ["dependencies", "depManager:{{{manager}}}"], + "vulnerabilityAlerts": { + "labels": ["security", "dependencies", "depManager:{{{manager}}}"], + }, + "forkProcessing": "enabled" +}