chore: bootstrap ermite-runner with license, README, lint and CI
- commit
- 885c03fff9bc54b7e8e55b554a11c8819012db54
- author
- brice · · 2026-10-12 13:56 UTC
- parent
- none (root commit)
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
7 files · +117 -0
A .forgejo/workflows/ci.yml +41 -0
| @@ -0,0 +1,41 @@ | |||
| 1 | + | name: CI | |
| 2 | + | ||
| 3 | + | on: | |
| 4 | + | push: | |
| 5 | + | branches: [main] | |
| 6 | + | pull_request: | |
| 7 | + | ||
| 8 | + | env: | |
| 9 | + | # Test the module alone, with the versions in go.mod (never a go.work). | |
| 10 | + | GOWORK: "off" | |
| 11 | + | GOPRIVATE: bnema.dev/ermite* | |
| 12 | + | ||
| 13 | + | jobs: | |
| 14 | + | lint: | |
| 15 | + | name: Lint | |
| 16 | + | runs-on: ubuntu-latest | |
| 17 | + | steps: | |
| 18 | + | - uses: actions/checkout@v6 | |
| 19 | + | - uses: actions/setup-go@v5 | |
| 20 | + | with: | |
| 21 | + | go-version-file: go.mod | |
| 22 | + | cache: true | |
| 23 | + | - uses: golangci/golangci-lint-action@v9 | |
| 24 | + | with: | |
| 25 | + | version: v2.14.0 | |
| 26 | + | ||
| 27 | + | test: | |
| 28 | + | name: Test | |
| 29 | + | runs-on: ubuntu-latest | |
| 30 | + | steps: | |
| 31 | + | - uses: actions/checkout@v6 | |
| 32 | + | - uses: actions/setup-go@v5 | |
| 33 | + | with: | |
| 34 | + | go-version-file: go.mod | |
| 35 | + | cache: true | |
| 36 | + | - name: Verify tidy | |
| 37 | + | run: | | |
| 38 | + | go mod tidy | |
| 39 | + | git diff --exit-code -- go.mod go.sum | |
| 40 | + | - run: go vet ./... | |
| 41 | + | - run: go test -race ./... | |
| @@ -0,0 +1,41 @@ | |||||
| 1 | + | name: CI | |||
| 2 | + | ||||
| 3 | + | on: | |||
| 4 | + | push: | |||
| 5 | + | branches: [main] | |||
| 6 | + | pull_request: | |||
| 7 | + | ||||
| 8 | + | env: | |||
| 9 | + | # Test the module alone, with the versions in go.mod (never a go.work). | |||
| 10 | + | GOWORK: "off" | |||
| 11 | + | GOPRIVATE: bnema.dev/ermite* | |||
| 12 | + | ||||
| 13 | + | jobs: | |||
| 14 | + | lint: | |||
| 15 | + | name: Lint | |||
| 16 | + | runs-on: ubuntu-latest | |||
| 17 | + | steps: | |||
| 18 | + | - uses: actions/checkout@v6 | |||
| 19 | + | - uses: actions/setup-go@v5 | |||
| 20 | + | with: | |||
| 21 | + | go-version-file: go.mod | |||
| 22 | + | cache: true | |||
| 23 | + | - uses: golangci/golangci-lint-action@v9 | |||
| 24 | + | with: | |||
| 25 | + | version: v2.14.0 | |||
| 26 | + | ||||
| 27 | + | test: | |||
| 28 | + | name: Test | |||
| 29 | + | runs-on: ubuntu-latest | |||
| 30 | + | steps: | |||
| 31 | + | - uses: actions/checkout@v6 | |||
| 32 | + | - uses: actions/setup-go@v5 | |||
| 33 | + | with: | |||
| 34 | + | go-version-file: go.mod | |||
| 35 | + | cache: true | |||
| 36 | + | - name: Verify tidy | |||
| 37 | + | run: | | |||
| 38 | + | go mod tidy | |||
| 39 | + | git diff --exit-code -- go.mod go.sum | |||
| 40 | + | - run: go vet ./... | |||
| 41 | + | - run: go test -race ./... | |||
A .gitignore +2 -0
| @@ -0,0 +1,2 @@ | |||
| 1 | + | /tmp/ | |
| 2 | + | .worktrees/ | |
| @@ -0,0 +1,2 @@ | |||||
| 1 | + | /tmp/ | |||
| 2 | + | .worktrees/ | |||
A .golangci.yml +13 -0
| @@ -0,0 +1,13 @@ | |||
| 1 | + | version: "2" | |
| 2 | + | ||
| 3 | + | linters: | |
| 4 | + | enable: | |
| 5 | + | - errcheck | |
| 6 | + | - govet | |
| 7 | + | - ineffassign | |
| 8 | + | - misspell | |
| 9 | + | - staticcheck | |
| 10 | + | - unconvert | |
| 11 | + | - unused | |
| 12 | + | exclusions: | |
| 13 | + | generated: strict | |
| @@ -0,0 +1,13 @@ | |||||
| 1 | + | version: "2" | |||
| 2 | + | ||||
| 3 | + | linters: | |||
| 4 | + | enable: | |||
| 5 | + | - errcheck | |||
| 6 | + | - govet | |||
| 7 | + | - ineffassign | |||
| 8 | + | - misspell | |||
| 9 | + | - staticcheck | |||
| 10 | + | - unconvert | |||
| 11 | + | - unused | |||
| 12 | + | exclusions: | |||
| 13 | + | generated: strict | |||
A LICENSE +21 -0
| @@ -0,0 +1,21 @@ | |||
| 1 | + | MIT License | |
| 2 | + | ||
| 3 | + | Copyright (c) 2026 bnema | |
| 4 | + | ||
| 5 | + | Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | + | of this software and associated documentation files (the "Software"), to deal | |
| 7 | + | in the Software without restriction, including without limitation the rights | |
| 8 | + | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | + | copies of the Software, and to permit persons to whom the Software is | |
| 10 | + | furnished to do so, subject to the following conditions: | |
| 11 | + | ||
| 12 | + | The above copyright notice and this permission notice shall be included in all | |
| 13 | + | copies or substantial portions of the Software. | |
| 14 | + | ||
| 15 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | + | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | + | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 21 | + | SOFTWARE. | |
| @@ -0,0 +1,21 @@ | |||||
| 1 | + | MIT License | |||
| 2 | + | ||||
| 3 | + | Copyright (c) 2026 bnema | |||
| 4 | + | ||||
| 5 | + | Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| 6 | + | of this software and associated documentation files (the "Software"), to deal | |||
| 7 | + | in the Software without restriction, including without limitation the rights | |||
| 8 | + | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
| 9 | + | copies of the Software, and to permit persons to whom the Software is | |||
| 10 | + | furnished to do so, subject to the following conditions: | |||
| 11 | + | ||||
| 12 | + | The above copyright notice and this permission notice shall be included in all | |||
| 13 | + | copies or substantial portions of the Software. | |||
| 14 | + | ||||
| 15 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| 16 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| 17 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
| 18 | + | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| 19 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| 20 | + | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
| 21 | + | SOFTWARE. | |||
A README.md +14 -0
| @@ -0,0 +1,14 @@ | |||
| 1 | + | # ermite-runner | |
| 2 | + | ||
| 3 | + | The CI runner of [ermite](https://git.bnema.dev/bnema/ermite). It runs workflows compatible with GitHub Actions (`.github/workflows/*.yml`), one job per sandbox: | |
| 4 | + | ||
| 5 | + | - **`vm`**: a Firecracker micro-VM per job, destroyed at the end. Needs `/dev/kvm`. | |
| 6 | + | - **`container`**: a container per job with its own Docker daemon, for hosts without KVM. Uses the sysbox runtime when available, else a privileged container. | |
| 7 | + | ||
| 8 | + | `ERMITE_RUNNER_ISOLATION=auto` (default) picks `vm` when KVM is usable, else `container`. | |
| 9 | + | ||
| 10 | + | Status: early development. | |
| 11 | + | ||
| 12 | + | ## License | |
| 13 | + | ||
| 14 | + | MIT. See [LICENSE](LICENSE). | |
| @@ -0,0 +1,14 @@ | |||||
| 1 | + | # ermite-runner | |||
| 2 | + | ||||
| 3 | + | The CI runner of [ermite](https://git.bnema.dev/bnema/ermite). It runs workflows compatible with GitHub Actions (`.github/workflows/*.yml`), one job per sandbox: | |||
| 4 | + | ||||
| 5 | + | - **`vm`**: a Firecracker micro-VM per job, destroyed at the end. Needs `/dev/kvm`. | |||
| 6 | + | - **`container`**: a container per job with its own Docker daemon, for hosts without KVM. Uses the sysbox runtime when available, else a privileged container. | |||
| 7 | + | ||||
| 8 | + | `ERMITE_RUNNER_ISOLATION=auto` (default) picks `vm` when KVM is usable, else `container`. | |||
| 9 | + | ||||
| 10 | + | Status: early development. | |||
| 11 | + | ||||
| 12 | + | ## License | |||
| 13 | + | ||||
| 14 | + | MIT. See [LICENSE](LICENSE). | |||
A go.mod +3 -0
| @@ -0,0 +1,3 @@ | |||
| 1 | + | module bnema.dev/ermite-runner | |
| 2 | + | ||
| 3 | + | go 1.27.1 | |
| @@ -0,0 +1,3 @@ | |||||
| 1 | + | module bnema.dev/ermite-runner | |||
| 2 | + | ||||
| 3 | + | go 1.27.1 | |||
A main.go +23 -0
| @@ -0,0 +1,23 @@ | |||
| 1 | + | // SPDX-License-Identifier: MIT | |
| 2 | + | ||
| 3 | + | // Command ermite-runner runs CI jobs for an ermite server. Each job runs in | |
| 4 | + | // its own Firecracker micro-VM, or in its own container when the host has no | |
| 5 | + | // KVM, and executes workflows compatible with GitHub Actions. | |
| 6 | + | package main | |
| 7 | + | ||
| 8 | + | import ( | |
| 9 | + | "fmt" | |
| 10 | + | "os" | |
| 11 | + | ) | |
| 12 | + | ||
| 13 | + | // version is set at build time with -ldflags "-X main.version=...". | |
| 14 | + | var version = "dev" | |
| 15 | + | ||
| 16 | + | func main() { | |
| 17 | + | if len(os.Args) > 1 && os.Args[1] == "version" { | |
| 18 | + | fmt.Println("ermite-runner", version) | |
| 19 | + | return | |
| 20 | + | } | |
| 21 | + | fmt.Fprintln(os.Stderr, "usage: ermite-runner version") | |
| 22 | + | os.Exit(2) | |
| 23 | + | } | |
| @@ -0,0 +1,23 @@ | |||||
| 1 | + | // SPDX-License-Identifier: MIT | |||
| 2 | + | ||||
| 3 | + | // Command ermite-runner runs CI jobs for an ermite server. Each job runs in | |||
| 4 | + | // its own Firecracker micro-VM, or in its own container when the host has no | |||
| 5 | + | // KVM, and executes workflows compatible with GitHub Actions. | |||
| 6 | + | package main | |||
| 7 | + | ||||
| 8 | + | import ( | |||
| 9 | + | "fmt" | |||
| 10 | + | "os" | |||
| 11 | + | ) | |||
| 12 | + | ||||
| 13 | + | // version is set at build time with -ldflags "-X main.version=...". | |||
| 14 | + | var version = "dev" | |||
| 15 | + | ||||
| 16 | + | func main() { | |||
| 17 | + | if len(os.Args) > 1 && os.Args[1] == "version" { | |||
| 18 | + | fmt.Println("ermite-runner", version) | |||
| 19 | + | return | |||
| 20 | + | } | |||
| 21 | + | fmt.Fprintln(os.Stderr, "usage: ermite-runner version") | |||
| 22 | + | os.Exit(2) | |||
| 23 | + | } | |||