Skip to content

Commit 709d41e

Browse files
authored
Enforce license headers with license-eye (#41)
1 parent f16c000 commit 709d41e

37 files changed

Lines changed: 597 additions & 7 deletions

‎.github/workflows/license.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: License
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
license-eye:
14+
if: github.repository == 'version-fox/vfox-flutter'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v7
18+
- name: Check license headers
19+
uses: apache/skywalking-eyes@v0.9.0
20+
with:
21+
config: .licenserc.yaml
22+
- name: Check PowerShell license headers
23+
run: docker run --rm -v "${{ github.workspace }}:/src" ghcr.io/google/addlicense:v1.2.0 -check -f .license.tpl tests/e2e/windows/*.ps1

‎.license.tpl‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2026 Han Li and contributors
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

‎.licenserc.yaml‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2026 Han Li and contributors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# License header check (Apache SkyWalking Eyes): Go and Lua are both covered.
16+
# PowerShell is check-only here (no `<# ... #>` fix support upstream):
17+
# tests/e2e/windows/*.ps1 is fixed and checked with addlicense instead (see
18+
# the addlicense step in .github/workflows/license.yml and docs/e2e.md).
19+
# CI runs the check via .github/workflows/license.yml; the local commands
20+
# (Docker only) are documented in docs/e2e.md.
21+
header:
22+
license:
23+
spdx-id: Apache-2.0
24+
copyright-owner: Han Li and contributors
25+
content: |
26+
Copyright 2026 Han Li and contributors
27+
28+
Licensed under the Apache License, Version 2.0 (the "License");
29+
you may not use this file except in compliance with the License.
30+
You may obtain a copy of the License at
31+
32+
http://www.apache.org/licenses/LICENSE-2.0
33+
34+
Unless required by applicable law or agreed to in writing, software
35+
distributed under the License is distributed on an "AS IS" BASIS,
36+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37+
See the License for the specific language governing permissions and
38+
limitations under the License.
39+
40+
paths-ignore:
41+
# Documentation and data files carry no license header.
42+
- '**/*.md'
43+
- '**/*.yaml'
44+
- '**/*.yml'
45+
- '**/*.json'
46+
- '**/*.toml'
47+
- '**/go.mod'
48+
- '**/go.sum'
49+
- '**/Dockerfile*'
50+
- '.gitignore'
51+
- '.gitattributes'
52+
- '.dockerignore'
53+
- '.tool-versions'
54+
- 'LICENSE'
55+
# Plain-text template for addlicense (no comment markers in it; keep its
56+
# text in sync with the `content` block above).
57+
- '.license.tpl'
58+
59+
comment: on-failure

‎Injection.lua‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
-- Copyright 2026 Han Li and contributors
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
115
--[[
216
Do not change any thing in the current file,
317
it's just there to show what objects are injected by vfox and what they do.

‎docs/e2e.md‎

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ each `vfox` x `flavor` x `mirror` combination gets its own throwaway container.
66

77
## Ubuntu 26.04.1
88

9-
Only Docker Engine (in either rootful or rootless mode) is required on the
10-
host. Execute in Bash,
9+
Only Docker Engine (in either rootful or rootless mode) is required on the host.
10+
On ARM64 it runs the official flavor only:
11+
OpenHarmony publishes no `linux-arm64` Dart SDK (see `docs/ohos.md`),
12+
so the ohos flavor cannot bootstrap there.
13+
14+
### rootful Docker
15+
16+
Execute in Bash,
1117

1218
```bash
1319
sudo apt install --assume-yes git
@@ -16,17 +22,18 @@ cd ./vfox-flutter/
1622
docker compose -f tests/e2e/linux/compose.yaml run --rm e2e
1723
```
1824

25+
### rootless Docker
26+
1927
With rootless Docker the daemon socket lives elsewhere; point `DOCKER_SOCK`
2028
at it instead:
2129

2230
```bash
23-
DOCKER_SOCK="$XDG_RUNTIME_DIR/docker.sock" \
24-
docker compose -f tests/e2e/linux/compose.yaml run --rm e2e
31+
sudo apt install --assume-yes git
32+
git clone git@github.com:version-fox/vfox-flutter.git
33+
cd ./vfox-flutter/
34+
DOCKER_SOCK="$XDG_RUNTIME_DIR/docker.sock" docker compose -f tests/e2e/linux/compose.yaml run --rm e2e
2535
```
2636

27-
On ARM64 it runs the official flavor only: OpenHarmony publishes no `linux-arm64` Dart SDK (see `docs/ohos.md`), so the
28-
ohos flavor cannot bootstrap there.
29-
3037
## Windows 11 Pro
3138

3239
Windows containers cannot be emulated across architectures, so the ARM64 suite
@@ -47,6 +54,7 @@ winget install --id Microsoft.PowerShell --source winget --exact
4754

4855
```powershell
4956
winget install --id Git.Git --source winget --exact
57+
# Configure Git appropriately.
5058
5159
curl.exe -fsSL `
5260
"https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" `
@@ -85,6 +93,7 @@ winget install --id Microsoft.PowerShell --source winget --exact
8593

8694
```powershell
8795
winget install --id Git.Git --source winget --exact
96+
# Configure Git appropriately.
8897
winget install --id GoLang.Go --source winget --exact
8998
git clone git@github.com:version-fox/vfox-flutter.git
9099
cd ./vfox-flutter/
@@ -97,3 +106,23 @@ curl.exe -fsSL `
97106
98107
docker compose -f tests/e2e/windows/compose.arm64.yaml run --rm --build e2e
99108
```
109+
110+
## Local checks
111+
112+
Execute in Bash on Ubuntu before pushing.
113+
114+
```bash
115+
docker run --rm -v "$PWD:/work" -w /work apache/skywalking-eyes:0.9.0 header check
116+
docker run --rm -v "$PWD:/work" -w /work apache/skywalking-eyes:0.9.0 header fix
117+
docker run --rm -v "$PWD:/src" ghcr.io/google/addlicense:v1.2.0 -check -f .license.tpl tests/e2e/windows/*.ps1
118+
docker run --rm -v "$PWD:/src" ghcr.io/google/addlicense:v1.2.0 -f .license.tpl tests/e2e/windows/*.ps1
119+
120+
cd tests/e2e
121+
go test -short ./...
122+
test -z "$(gofmt -l .)"
123+
go vet ./...
124+
cd ../..
125+
126+
stylua --check .
127+
mise x aqua:LuaLS/lua-language-server@3.19.1 -- lua-language-server --check . --checklevel=Warning
128+
```

‎hooks/available.lua‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
-- Copyright 2026 Han Li and contributors
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
115
local http = require("http")
216
local json = require("json")
317
local ohos = require("ohos")

‎hooks/env_keys.lua‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
-- Copyright 2026 Han Li and contributors
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
115
function PLUGIN:EnvKeys(ctx)
216
local mainPath = ctx.path
317
return {

‎hooks/pre_install.lua‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
-- Copyright 2026 Han Li and contributors
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
115
local http = require("http")
216
local json = require("json")
317
local manifest = require("manifest")

‎hooks/pre_use.lua‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
-- Copyright 2026 Han Li and contributors
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
115
local manifest = require("manifest")
216

317
local REASON = {

‎lib/git.lua‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
-- Copyright 2026 Han Li and contributors
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
115
local HOME_ENV = "VFOX_HOME"
216
local FALLBACK_HOME_ENV = { "HOME", "USERPROFILE" }
317
local VFOX_DIR = ".vfox"

0 commit comments

Comments
 (0)