-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a29ef8
commit 8db88f0
Showing
2 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# | ||
# Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
name: "TruffleHog" | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: ["main"] | ||
schedule: | ||
- cron: "0 0 * * *" # Once a day | ||
workflow_dispatch: | ||
|
||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
id-token: write | ||
issues: write | ||
|
||
jobs: | ||
ScanSecrets: | ||
name: Scan secrets | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Ensure full clone for pull request workflows | ||
|
||
- name: TruffleHog OSS | ||
id: trufflehog | ||
uses: trufflesecurity/trufflehog@8a8ef8526527dd5f5d731d8e74843c121777b82d #v3.80.2 | ||
continue-on-error: true | ||
with: | ||
path: ./ # Scan the entire repository | ||
base: "${{ github.event.repository.default_branch }}" # Set base branch for comparison (pull requests) | ||
extra_args: --filter-entropy=4 --results=verified,unknown --debug | ||
|
||
- name: Scan Results Status | ||
if: steps.trufflehog.outcome == 'failure' | ||
run: exit 1 # Set workflow run to failure if TruffleHog finds secrets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# | ||
# Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
--- | ||
name: "Verify" | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [ opened, synchronize, reopened ] | ||
branches: [ main ] | ||
paths: | ||
- 'src/**' | ||
- ".github/**" | ||
- 'gradle.properties' | ||
- 'build.gradle' | ||
- 'settings.gradle' | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'src/**' | ||
- ".github/**" | ||
- 'gradle.properties' | ||
- 'build.gradle' | ||
- 'settings.gradle' | ||
|
||
jobs: | ||
verify-license-headers: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3.5.2 | ||
- name: "Check for files without a license header" | ||
run: |- | ||
# checks all java, yaml, kts and sql files for an Apache 2.0 license header | ||
cmd="grep -riL \"SPDX-License-Identifier: Apache-2.0\" --include=\*.{java,yaml,yml,kts,sql} --exclude-dir={.gradle,\*\openapi} ." | ||
violations=$(eval $cmd | wc -l) | ||
if [[ $violations -ne 0 ]] ; then | ||
echo "$violations files without license headers were found:"; | ||
eval $cmd; | ||
exit 1; | ||
fi | ||
Review-Allowed-Licenses: | ||
runs-on: ubuntu-latest | ||
continue-on-error: false | ||
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: 'Check Allowed Licenses' | ||
uses: actions/dependency-review-action@v4 | ||
with: | ||
fail-on-severity: critical | ||
# Representation of this list: https://www.eclipse.org/legal/licenses.php# | ||
# Expressed with the help of the following IDs: https://spdx.org/licenses/ | ||
allow-licenses: >- | ||
Adobe-Glyph, Apache-1.0, Apache-1.1, Apache-2.0, Artistic-2.0, BSD-2-Clause, BSD-3-Clause, | ||
BSD-4-Clause, 0BSD, BSL-1.0, CDDL-1.0, CDDL-1.1, CPL-1.0, CC-BY-3.0, CC-BY-4.0, CC-BY-2.5, | ||
CC-BY-SA-3.0, CC-BY-SA-4.0, CC0-1.0, EPL-1.0, EPL-2.0, FTL, GFDL-1.3-only, IPL-1.0, ISC, | ||
MIT, MIT-0, MPL-1.1, MPL-2.0, NTP, OpenSSL, PHP-3.01, PostgreSQL, OFL-1.1, Unlicense, | ||
Unicode-DFS-2015, Unicode-DFS-2016, Unicode-TOU, UPL-1.0, W3C-20150513, W3C-19980720, W3C, | ||
WTFPL, X11, Zlib, ZPL-2.1, AGPL-3.0 | ||
Dash-Verify-Licenses: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: eclipse-edc/.github/.github/actions/setup-build@main | ||
- name: Download latest Eclipse Dash | ||
run: | | ||
curl -L https://repo.eclipse.org/service/local/artifact/maven/redirect\?r\=dash-licenses\&g\=org.eclipse.dash\&a\=org.eclipse.dash.licenses\&v\=LATEST --output dash.jar | ||
- name: Regenerate DEPENDENCIES | ||
run: | | ||
# dash returns a nonzero exit code if there are libs that need review. the "|| true" avoids that | ||
./gradlew dependencies | grep -Poh "(?<=\s)[\w.-]+:[\w.-]+:[^:\s\[\]]+" | sort | uniq | java -jar dash.jar - -summary DEPENDENCIES-gen || true | ||
# error if DEPENDENCIES is empty | ||
grep -E 'maven' DEPENDENCIES-gen | if test $(wc -l) -lt 1; then | ||
echo "::error file=DEPENDENCIES-gen,title=Dependencies file is corrupted, please run the workflow again" | ||
exit 1 | ||
fi | ||
# log warning if restricted deps are found | ||
grep -E 'restricted' DEPENDENCIES-gen | if test $(wc -l) -gt 0; then | ||
echo "::warning file=DEPENDENCIES,title=Restricted Dependencies found::Some dependencies are marked 'restricted' - please review them" | ||
fi | ||
# log error and fail job if rejected deps are found | ||
grep -E 'rejected' DEPENDENCIES-gen | if test $(wc -l) -gt 0; then | ||
echo "::error file=DEPENDENCIES,title=Rejected Dependencies found::Some dependencies are marked 'rejected', they cannot be used" | ||
exit 1 | ||
fi | ||
- name: Check for differences | ||
run: | | ||
if diff DEPENDENCIES DEPENDENCIES-gen ; then | ||
echo "DEPENDENCIES up-do-date" | ||
else | ||
diff DEPENDENCIES DEPENDENCIES-gen || true | ||
echo "------------------------------------------------------------" | ||
echo "=== Please copy the following content back to DEPENDENCIES ===" | ||
cat DEPENDENCIES-gen | ||
echo "=== end of content ===" | ||
echo "::error file=DEPENDENCIES,title=Dependencies outdated::The DEPENDENCIES file was outdated and must be regenerated. Check the output of this job for more information" | ||
exit 1 | ||
fi | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
needs: [ Review-Allowed-Licenses, Dash-Verify-Licenses ] | ||
steps: | ||
- uses: actions/checkout@v3.5.2 | ||
- uses: ./.github/actions/setup-java | ||
- name: Run Unit tests | ||
run: ./gradlew test |