Skip to content

Commit

Permalink
add GHA to check for license (#731)
Browse files Browse the repository at this point in the history
* add GHA to check for license"

* fix GHA

* update license.yaml
  • Loading branch information
darrenvechain authored May 9, 2024
1 parent 724e76f commit 0489d6a
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/license-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: License Check

on:
workflow_call:

jobs:
license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: License Check
uses: apache/[email protected]
9 changes: 7 additions & 2 deletions .github/workflows/on-master-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ jobs:
run-unit-tests:
name: Run Unit Tests
uses: ./.github/workflows/test.yaml
secrets:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

license-check:
name: License Check
uses: ./.github/workflows/license-check.yaml

lint:
name: Lint
uses: ./.github/workflows/lint-go.yaml
Expand Down Expand Up @@ -43,6 +47,7 @@ jobs:
- run-e2e-tests
- generate-tags
- lint
- license-check
permissions:
contents: read
packages: write
Expand All @@ -61,7 +66,7 @@ jobs:
- generate-tags
- lint
- run-unit-tests
if: always() && (needs.publish-docker-image.result != 'success' || needs.run-unit-tests.result != 'success' || needs.lint.result != 'success' || needs.run-e2e-tests.result != 'success')
if: always() && (needs.publish-docker-image.result != 'success' || needs.run-unit-tests.result != 'success' || needs.lint.result != 'success' || needs.run-e2e-tests.result != 'success' || needs.license-check.result != 'success')
runs-on: ubuntu-latest
steps:
- name: Notify Slack
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/on-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

license-check:
name: License Check
uses: ./.github/workflows/license-check.yaml

run-e2e-tests:
name: E2E Tests
uses: ./.github/workflows/test-e2e.yaml
Expand Down
20 changes: 20 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See: https://github.com/apache/skywalking-eyes
header:
license:
spdx-id: GPL-3.0-or-later
# This is the pattern used when running:
# docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header check
pattern: |
Copyright(?: \(c\))? \b(19\d{2}|20\d{2})\b The (VeChainThor developers|go-ethereum Authors)
# This is content written to files when running:
# docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix
content: |
Copyright (c) 2024 The VeChainThor developers
Distributed under the GNU Lesser General Public License v3.0 software license, see the accompanying
file LICENSE or <https://www.gnu.org/licenses/lgpl-3.0.html>
paths:
- '**/*.go'
paths-ignore:
- 'builtin/gen/bindata.go'
- 'tracers/**/gen_*.go'
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ lint_command_check:
lint: | go_version_check lint_command_check #@ Run 'golangci-lint'
@golangci-lint run --config .golangci.yml

license-check: #@ Check license headers
@FILE_COUNT=$$(find . -type f -name '*.go' | wc -l); \
echo "Checking license headers for all .go... $$FILE_COUNT files found"; \
docker run -it --rm -v $$(pwd):/github/workspace apache/skywalking-eyes header check

.DEFAULT:
@$(MAKE) help
5 changes: 5 additions & 0 deletions thor/blocklist_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) 2024 The VeChainThor developers

// Distributed under the GNU Lesser General Public License v3.0 software license, see the accompanying
// file LICENSE or <https://www.gnu.org/licenses/lgpl-3.0.html>

package thor

import "testing"
Expand Down
5 changes: 5 additions & 0 deletions thor/fork_config_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) 2024 The VeChainThor developers

// Distributed under the GNU Lesser General Public License v3.0 software license, see the accompanying
// file LICENSE or <https://www.gnu.org/licenses/lgpl-3.0.html>

package thor

import (
Expand Down
5 changes: 5 additions & 0 deletions thor/receipt_correction_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) 2024 The VeChainThor developers

// Distributed under the GNU Lesser General Public License v3.0 software license, see the accompanying
// file LICENSE or <https://www.gnu.org/licenses/lgpl-3.0.html>

package thor

import (
Expand Down
5 changes: 5 additions & 0 deletions trie/derive_root_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) 2024 The VeChainThor developers

// Distributed under the GNU Lesser General Public License v3.0 software license, see the accompanying
// file LICENSE or <https://www.gnu.org/licenses/lgpl-3.0.html>

package trie

import (
Expand Down

0 comments on commit 0489d6a

Please sign in to comment.