From 2e88be6d15414dc3a60a816372a4af97bc827c1e Mon Sep 17 00:00:00 2001 From: AtomicFS Date: Thu, 28 Nov 2024 15:42:56 +0100 Subject: [PATCH 1/6] chore(action): move golang code - 'go install' command uses the last elements in the path/url to determine name of the executable - move golang code from ./action directory to ./cmd/firmware-action instead - this way when people run 'go install' they get 'firmware-action' instead of just 'action' Signed-off-by: AtomicFS --- {action => cmd/firmware-action}/.gitignore | 0 {action => cmd/firmware-action}/.golangci.yml | 0 {action => cmd/firmware-action}/.goreleaser.yaml | 0 {action => cmd/firmware-action}/container/container.go | 0 {action => cmd/firmware-action}/container/container_test.go | 0 {action => cmd/firmware-action}/container/ssh.go | 0 {action => cmd/firmware-action}/container/ssh_test.go | 0 {action => cmd/firmware-action}/filesystem/filesystem.go | 0 {action => cmd/firmware-action}/filesystem/filesystem_test.go | 0 {action => cmd/firmware-action}/go.mod | 0 {action => cmd/firmware-action}/go.sum | 0 {action => cmd/firmware-action}/logging/logging.go | 0 {action => cmd/firmware-action}/logging/pretty_handler.go | 0 {action => cmd/firmware-action}/main.go | 0 {action => cmd/firmware-action}/recipes/config.go | 0 {action => cmd/firmware-action}/recipes/config_test.go | 0 {action => cmd/firmware-action}/recipes/coreboot.go | 0 {action => cmd/firmware-action}/recipes/coreboot_test.go | 0 {action => cmd/firmware-action}/recipes/edk2.go | 0 {action => cmd/firmware-action}/recipes/edk2_test.go | 0 {action => cmd/firmware-action}/recipes/linux.go | 0 {action => cmd/firmware-action}/recipes/linux_test.go | 0 {action => cmd/firmware-action}/recipes/recipes.go | 0 {action => cmd/firmware-action}/recipes/recipes_test.go | 0 {action => cmd/firmware-action}/recipes/stitching.go | 0 {action => cmd/firmware-action}/recipes/stitching_test.go | 0 {action => cmd/firmware-action}/recipes/universal.go | 0 {action => cmd/firmware-action}/recipes/universal_test.go | 0 {action => cmd/firmware-action}/recipes/uroot.go | 0 {action => cmd/firmware-action}/recipes/uroot_test.go | 0 30 files changed, 0 insertions(+), 0 deletions(-) rename {action => cmd/firmware-action}/.gitignore (100%) rename {action => cmd/firmware-action}/.golangci.yml (100%) rename {action => cmd/firmware-action}/.goreleaser.yaml (100%) rename {action => cmd/firmware-action}/container/container.go (100%) rename {action => cmd/firmware-action}/container/container_test.go (100%) rename {action => cmd/firmware-action}/container/ssh.go (100%) rename {action => cmd/firmware-action}/container/ssh_test.go (100%) rename {action => cmd/firmware-action}/filesystem/filesystem.go (100%) rename {action => cmd/firmware-action}/filesystem/filesystem_test.go (100%) rename {action => cmd/firmware-action}/go.mod (100%) rename {action => cmd/firmware-action}/go.sum (100%) rename {action => cmd/firmware-action}/logging/logging.go (100%) rename {action => cmd/firmware-action}/logging/pretty_handler.go (100%) rename {action => cmd/firmware-action}/main.go (100%) rename {action => cmd/firmware-action}/recipes/config.go (100%) rename {action => cmd/firmware-action}/recipes/config_test.go (100%) rename {action => cmd/firmware-action}/recipes/coreboot.go (100%) rename {action => cmd/firmware-action}/recipes/coreboot_test.go (100%) rename {action => cmd/firmware-action}/recipes/edk2.go (100%) rename {action => cmd/firmware-action}/recipes/edk2_test.go (100%) rename {action => cmd/firmware-action}/recipes/linux.go (100%) rename {action => cmd/firmware-action}/recipes/linux_test.go (100%) rename {action => cmd/firmware-action}/recipes/recipes.go (100%) rename {action => cmd/firmware-action}/recipes/recipes_test.go (100%) rename {action => cmd/firmware-action}/recipes/stitching.go (100%) rename {action => cmd/firmware-action}/recipes/stitching_test.go (100%) rename {action => cmd/firmware-action}/recipes/universal.go (100%) rename {action => cmd/firmware-action}/recipes/universal_test.go (100%) rename {action => cmd/firmware-action}/recipes/uroot.go (100%) rename {action => cmd/firmware-action}/recipes/uroot_test.go (100%) diff --git a/action/.gitignore b/cmd/firmware-action/.gitignore similarity index 100% rename from action/.gitignore rename to cmd/firmware-action/.gitignore diff --git a/action/.golangci.yml b/cmd/firmware-action/.golangci.yml similarity index 100% rename from action/.golangci.yml rename to cmd/firmware-action/.golangci.yml diff --git a/action/.goreleaser.yaml b/cmd/firmware-action/.goreleaser.yaml similarity index 100% rename from action/.goreleaser.yaml rename to cmd/firmware-action/.goreleaser.yaml diff --git a/action/container/container.go b/cmd/firmware-action/container/container.go similarity index 100% rename from action/container/container.go rename to cmd/firmware-action/container/container.go diff --git a/action/container/container_test.go b/cmd/firmware-action/container/container_test.go similarity index 100% rename from action/container/container_test.go rename to cmd/firmware-action/container/container_test.go diff --git a/action/container/ssh.go b/cmd/firmware-action/container/ssh.go similarity index 100% rename from action/container/ssh.go rename to cmd/firmware-action/container/ssh.go diff --git a/action/container/ssh_test.go b/cmd/firmware-action/container/ssh_test.go similarity index 100% rename from action/container/ssh_test.go rename to cmd/firmware-action/container/ssh_test.go diff --git a/action/filesystem/filesystem.go b/cmd/firmware-action/filesystem/filesystem.go similarity index 100% rename from action/filesystem/filesystem.go rename to cmd/firmware-action/filesystem/filesystem.go diff --git a/action/filesystem/filesystem_test.go b/cmd/firmware-action/filesystem/filesystem_test.go similarity index 100% rename from action/filesystem/filesystem_test.go rename to cmd/firmware-action/filesystem/filesystem_test.go diff --git a/action/go.mod b/cmd/firmware-action/go.mod similarity index 100% rename from action/go.mod rename to cmd/firmware-action/go.mod diff --git a/action/go.sum b/cmd/firmware-action/go.sum similarity index 100% rename from action/go.sum rename to cmd/firmware-action/go.sum diff --git a/action/logging/logging.go b/cmd/firmware-action/logging/logging.go similarity index 100% rename from action/logging/logging.go rename to cmd/firmware-action/logging/logging.go diff --git a/action/logging/pretty_handler.go b/cmd/firmware-action/logging/pretty_handler.go similarity index 100% rename from action/logging/pretty_handler.go rename to cmd/firmware-action/logging/pretty_handler.go diff --git a/action/main.go b/cmd/firmware-action/main.go similarity index 100% rename from action/main.go rename to cmd/firmware-action/main.go diff --git a/action/recipes/config.go b/cmd/firmware-action/recipes/config.go similarity index 100% rename from action/recipes/config.go rename to cmd/firmware-action/recipes/config.go diff --git a/action/recipes/config_test.go b/cmd/firmware-action/recipes/config_test.go similarity index 100% rename from action/recipes/config_test.go rename to cmd/firmware-action/recipes/config_test.go diff --git a/action/recipes/coreboot.go b/cmd/firmware-action/recipes/coreboot.go similarity index 100% rename from action/recipes/coreboot.go rename to cmd/firmware-action/recipes/coreboot.go diff --git a/action/recipes/coreboot_test.go b/cmd/firmware-action/recipes/coreboot_test.go similarity index 100% rename from action/recipes/coreboot_test.go rename to cmd/firmware-action/recipes/coreboot_test.go diff --git a/action/recipes/edk2.go b/cmd/firmware-action/recipes/edk2.go similarity index 100% rename from action/recipes/edk2.go rename to cmd/firmware-action/recipes/edk2.go diff --git a/action/recipes/edk2_test.go b/cmd/firmware-action/recipes/edk2_test.go similarity index 100% rename from action/recipes/edk2_test.go rename to cmd/firmware-action/recipes/edk2_test.go diff --git a/action/recipes/linux.go b/cmd/firmware-action/recipes/linux.go similarity index 100% rename from action/recipes/linux.go rename to cmd/firmware-action/recipes/linux.go diff --git a/action/recipes/linux_test.go b/cmd/firmware-action/recipes/linux_test.go similarity index 100% rename from action/recipes/linux_test.go rename to cmd/firmware-action/recipes/linux_test.go diff --git a/action/recipes/recipes.go b/cmd/firmware-action/recipes/recipes.go similarity index 100% rename from action/recipes/recipes.go rename to cmd/firmware-action/recipes/recipes.go diff --git a/action/recipes/recipes_test.go b/cmd/firmware-action/recipes/recipes_test.go similarity index 100% rename from action/recipes/recipes_test.go rename to cmd/firmware-action/recipes/recipes_test.go diff --git a/action/recipes/stitching.go b/cmd/firmware-action/recipes/stitching.go similarity index 100% rename from action/recipes/stitching.go rename to cmd/firmware-action/recipes/stitching.go diff --git a/action/recipes/stitching_test.go b/cmd/firmware-action/recipes/stitching_test.go similarity index 100% rename from action/recipes/stitching_test.go rename to cmd/firmware-action/recipes/stitching_test.go diff --git a/action/recipes/universal.go b/cmd/firmware-action/recipes/universal.go similarity index 100% rename from action/recipes/universal.go rename to cmd/firmware-action/recipes/universal.go diff --git a/action/recipes/universal_test.go b/cmd/firmware-action/recipes/universal_test.go similarity index 100% rename from action/recipes/universal_test.go rename to cmd/firmware-action/recipes/universal_test.go diff --git a/action/recipes/uroot.go b/cmd/firmware-action/recipes/uroot.go similarity index 100% rename from action/recipes/uroot.go rename to cmd/firmware-action/recipes/uroot.go diff --git a/action/recipes/uroot_test.go b/cmd/firmware-action/recipes/uroot_test.go similarity index 100% rename from action/recipes/uroot_test.go rename to cmd/firmware-action/recipes/uroot_test.go From a0bbfee470356ad929591c4272786444422689b8 Mon Sep 17 00:00:00 2001 From: AtomicFS Date: Thu, 28 Nov 2024 15:54:25 +0100 Subject: [PATCH 2/6] chore: cleanup after moving golang code - change references in docs - update gitignore - update workflows - update Taskfile - hopefully I did not forget anything Signed-off-by: AtomicFS --- .github/dependabot.yml | 2 +- .github/labeler.yml | 24 ++++++++++---------- .github/workflows/example.yml | 4 ++-- .github/workflows/go-test.yml | 11 +++++---- .github/workflows/lint.yml | 2 +- .github/workflows/release-prepare.yml | 2 +- .github/workflows/release.yml | 2 +- .gitignore | 6 ++--- Taskfile.yml | 14 ++++++------ action.yml | 8 +++---- cmd/firmware-action/recipes/coreboot_test.go | 2 +- cmd/firmware-action/recipes/linux_test.go | 2 +- docs/src/firmware-action/config.md | 20 ++++++++-------- docs/src/firmware-action/interactive.md | 2 +- 14 files changed, 51 insertions(+), 50 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cf87cfd7..9c3af01e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -24,7 +24,7 @@ updates: - 'patch' - package-ecosystem: gomod - directory: '/action' + directory: '/cmd/firmware-action' schedule: interval: 'daily' time: '00:00' diff --git a/.github/labeler.yml b/.github/labeler.yml index 61767a4f..13a0d0e5 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -6,8 +6,8 @@ dependencies: - changed-files: - any-glob-to-any-file: - '.dagger-ci/daggerci/requirements.txt' - - 'action/go.mod' - - 'action/go.sum' + - 'cmd/firmware-action/go.mod' + - 'cmd/firmware-action/go.sum' docker: - any: - changed-files: @@ -37,38 +37,38 @@ go: - changed-files: - any-glob-to-any-file: - '*.go' - - 'action/.golangci.yml' - - 'action/.goreleaser.yaml' - - 'action/go.mod' - - 'action/go.sum' + - 'cmd/firmware-action/.golangci.yml' + - 'cmd/firmware-action/.goreleaser.yaml' + - 'cmd/firmware-action/go.mod' + - 'cmd/firmware-action/go.sum' module/coreboot: - any: - changed-files: - any-glob-to-any-file: - - 'action/recipes/coreboot*' + - 'cmd/firmware-action/recipes/coreboot*' - 'docker/coreboot/**' module/edk2: - any: - changed-files: - any-glob-to-any-file: - - 'action/recipes/edk2*' + - 'cmd/firmware-action/recipes/edk2*' - 'docker/edk2/**' module/linux: - any: - changed-files: - any-glob-to-any-file: - - 'action/recipes/linux*' + - 'cmd/firmware-action/recipes/linux*' - 'docker/linux/**' module/stitching: - any: - changed-files: - any-glob-to-any-file: - - 'action/recipes/stitching*' + - 'cmd/firmware-action/recipes/stitching*' module/u-root: - any: - changed-files: - any-glob-to-any-file: - - 'action/recipes/uroot*' + - 'cmd/firmware-action/recipes/uroot*' - 'docker/uroot/**' python: - any: @@ -89,7 +89,7 @@ testing: - '.markdownlint.json' - '.mega-linter.yml' - '.trivy.yaml' - - 'action/**/*_test.go' + - 'cmd/firmware-action/**/*_test.go' - 'tests/**' - head-branch: - '^test' diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index 2f66f87c..d5e3e012 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -64,7 +64,7 @@ jobs: - 'docker/**' - 'tests/**' - 'action.yml' - - 'action/**' + - 'cmd/firmware-action/**' # Change detection in action golang code changes: @@ -94,7 +94,7 @@ jobs: with: filters: | action: - - 'action/**' + - 'cmd/firmware-action/**' - name: Compile id: compile # Require compilation if changes in action golang code or if any breaking changes since last release diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index c652b7c0..8b5f49c5 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -49,13 +49,14 @@ jobs: filters: | changes: - '.github/workflows/go-test.yml' - - 'action/**' + - 'cmd/firmware-action/**' go-test-resource-hogs: # Run tests that take up a lot of system resources separately runs-on: ubuntu-latest needs: skip-check strategy: + fail-fast: false matrix: testregex: ['TestLinux', 'TestEdk2', 'TestCoreboot', 'TestStitching', 'TestURoot', 'TestUniversal'] if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }} @@ -69,11 +70,11 @@ jobs: go-version: stable - name: Install go dependencies run: | - cd action + cd cmd/firmware-action go get -d ./... - name: Run go test run: | - cd action + cd cmd/firmware-action go test -race -v -timeout 60m -shuffle=on -covermode=atomic -coverprofile coverage.out -run ${{ matrix.testregex }} ./... go-test: @@ -91,9 +92,9 @@ jobs: go-version: stable - name: Install go dependencies run: | - cd action + cd cmd/firmware-action go get -d ./... - name: Run go test run: | - cd action + cd cmd/firmware-action go test -race -v -timeout 60m -shuffle=on -covermode=atomic -coverprofile coverage.out -skip '(TestLinux|TestEdk2|TestCoreboot|TestStitching|TestUniversal)' ./... diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b2e6e613..fe920fe5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -66,4 +66,4 @@ jobs: uses: golangci/golangci-lint-action@v6 with: version: latest - working-directory: action + working-directory: cmd/firmware-action diff --git a/.github/workflows/release-prepare.yml b/.github/workflows/release-prepare.yml index deed353e..416ed7bf 100644 --- a/.github/workflows/release-prepare.yml +++ b/.github/workflows/release-prepare.yml @@ -34,7 +34,7 @@ jobs: # Bump version - name: Update main.go run: | - sed -i -E 's/const firmwareActionVersion = .*/const firmwareActionVersion = "${{ steps.semver.outputs.next }}"/g' action/main.go + sed -i -E 's/const firmwareActionVersion = .*/const firmwareActionVersion = "${{ steps.semver.outputs.next }}"/g' cmd/firmware-action/main.go - name: Update Taskfile.yml run: | sed -i -E "s/^ SEMVER: .*/ SEMVER: '${{ steps.semver.outputs.next }}'/g" Taskfile.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 715789e7..04d43a37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,7 @@ jobs: run: | git branch --show-current git pull - echo "version=$(grep 'const firmwareActionVersion' < action/main.go | sed -E 's/.*= "//g' | sed 's/"//g')" >> "${GITHUB_OUTPUT}" + echo "version=$(grep 'const firmwareActionVersion' < cmd/firmware-action/main.go | sed -E 's/.*= "//g' | sed 's/"//g')" >> "${GITHUB_OUTPUT}" # Can't really use cocogitto here - name: Create tag diff --git a/.gitignore b/.gitignore index 8b7eb290..be7bbe4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ .coverage .task .example_runs -action/coverage.html -action/coverage.out +cmd/firmware-action/coverage.html +cmd/firmware-action/coverage.out bin/ megalinter-reports node_modules -action/recipes/__tmp_files__/ +cmd/firmware-action/recipes/__tmp_files__/ output-*/ docker/coreboot/coreboot-* diff --git a/Taskfile.yml b/Taskfile.yml index 10a5bbc2..f38f7d3a 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -17,19 +17,19 @@ includes: tasks: build-go-binary: desc: Template task to build a go binary - dir: action + dir: '{{.GOLANG_CODE_PATH}}' cmds: - - go build -ldflags="-s -w" -o ../bin/firmware-action-{{OS}}-{{ARCH}}-{{.SEMVER}} + - go build -ldflags="-s -w" -o ../../bin/firmware-action-{{OS}}-{{ARCH}}-{{.SEMVER}} env: CGO_ENABLED: 0 sources: - ./**/*.go generates: - - ../bin/firmware-action-{{OS}}-{{ARCH}}-{{.SEMVER}} + - ../../bin/firmware-action-{{OS}}-{{ARCH}}-{{.SEMVER}} lint: desc: Run the linters - dir: action + dir: '{{.GOLANG_CODE_PATH}}' cmds: - revive ./... - go vet ./... @@ -39,11 +39,11 @@ tasks: format: desc: Run gofumt (fork of gofmt, stricter) cmds: - - gofumpt -w action + - gofumpt -w '{{.GOLANG_CODE_PATH}}' test: desc: Run tests - dir: action + dir: '{{.GOLANG_CODE_PATH}}' cmds: - go test {{.CLI_ARGS}} -race -timeout 60m -shuffle=on -covermode=atomic -coverprofile coverage.out ./... - go tool cover -func=coverage.out @@ -51,7 +51,7 @@ tasks: godocs: desc: Start godocs http server - dir: action + dir: '{{.GOLANG_CODE_PATH}}' cmds: - godoc -http=:6060 diff --git a/action.yml b/action.yml index e0af7299..0b84946d 100644 --- a/action.yml +++ b/action.yml @@ -93,9 +93,9 @@ runs: - name: compile_unix if: ${{ ( runner.os == 'Linux' || runner.os == 'macOS' ) && inputs.compile == 'true' }} shell: bash - working-directory: ./action + working-directory: ./cmd/firmware-action run: | - go build -ldflags="-s -w" -o ../firmware-action + go build -ldflags="-s -w" -o ../../firmware-action - id: fetch_windows if: ${{ runner.os == 'Windows' && inputs.compile == 'false' }} @@ -106,9 +106,9 @@ runs: - name: compile_windows if: ${{ runner.os == 'Windows' && inputs.compile == 'true' }} shell: pwsh - working-directory: ./action + working-directory: ./cmd/firmware-action run: | - go build -ldflags="-s -w" -o ../firmware-action.exe + go build -ldflags="-s -w" -o ../../firmware-action.exe - name: run_unix if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} diff --git a/cmd/firmware-action/recipes/coreboot_test.go b/cmd/firmware-action/recipes/coreboot_test.go index bf902c9a..8041d092 100644 --- a/cmd/firmware-action/recipes/coreboot_test.go +++ b/cmd/firmware-action/recipes/coreboot_test.go @@ -140,7 +140,7 @@ func TestCoreboot(t *testing.T) { assert.NoError(t, err) // Copy over defconfig file into tmpDir - repoRootPath, err := filepath.Abs(filepath.Join(pwd, "../..")) + repoRootPath, err := filepath.Abs(filepath.Join(pwd, "../../..")) assert.NoError(t, err) // repoPath = path to end user repository (in this case somewhere in /tmp) // repoRootPath = path to our repository with this code (contains configuration files for testing) diff --git a/cmd/firmware-action/recipes/linux_test.go b/cmd/firmware-action/recipes/linux_test.go index e0b8480e..29d49486 100644 --- a/cmd/firmware-action/recipes/linux_test.go +++ b/cmd/firmware-action/recipes/linux_test.go @@ -129,7 +129,7 @@ func TestLinux(t *testing.T) { // Copy over defconfig file into tmpDir/linux defconfigPath := filepath.Join(myLinuxOpts.RepoPath, myLinuxOpts.DefconfigPath) - repoRootPath, err := filepath.Abs(filepath.Join(pwd, "../..")) + repoRootPath, err := filepath.Abs(filepath.Join(pwd, "../../..")) assert.NoError(t, err) // common.RepoPath = path to end user repository (in this case somewhere in /tmp) // repoRootPath = path to our repository with this code (contains configuration files for testing) diff --git a/docs/src/firmware-action/config.md b/docs/src/firmware-action/config.md index ac7bfd78..4efff50b 100644 --- a/docs/src/firmware-action/config.md +++ b/docs/src/firmware-action/config.md @@ -58,7 +58,7 @@ Each module has sections: - `specific` ```go -{{#include ../../../action/recipes/coreboot.go:CorebootOpts}} +{{#include ../../../cmd/firmware-action/recipes/coreboot.go:CorebootOpts}} ``` `common` & `specific` are identical in function. There is no real difference between these two. They are split to simplify the code. They define things like path to source code, version and source of SDK to use, and so on. @@ -113,31 +113,31 @@ For more tails see [go-playground/validator](https://github.com/go-playground/va ### Common ```go -{{#include ../../../action/recipes/config.go:CommonOpts}} +{{#include ../../../cmd/firmware-action/recipes/config.go:CommonOpts}} ``` ### Specific / coreboot ```go -{{#include ../../../action/recipes/coreboot.go:CorebootOpts}} -{{#include ../../../action/recipes/coreboot.go:CorebootBlobs}} +{{#include ../../../cmd/firmware-action/recipes/coreboot.go:CorebootOpts}} +{{#include ../../../cmd/firmware-action/recipes/coreboot.go:CorebootBlobs}} ``` ### Specific / Linux ```go -{{#include ../../../action/recipes/linux.go:LinuxOpts}} -{{#include ../../../action/recipes/linux.go:LinuxSpecific}} +{{#include ../../../cmd/firmware-action/recipes/linux.go:LinuxOpts}} +{{#include ../../../cmd/firmware-action/recipes/linux.go:LinuxSpecific}} ``` ### Specific / Edk2 ```go -{{#include ../../../action/recipes/edk2.go:Edk2Opts}} -{{#include ../../../action/recipes/edk2.go:Edk2Specific}} +{{#include ../../../cmd/firmware-action/recipes/edk2.go:Edk2Opts}} +{{#include ../../../cmd/firmware-action/recipes/edk2.go:Edk2Specific}} ``` ### Specific / Firmware stitching ```go -{{#include ../../../action/recipes/stitching.go:FirmwareStitchingOpts}} -{{#include ../../../action/recipes/stitching.go:IfdtoolEntry}} +{{#include ../../../cmd/firmware-action/recipes/stitching.go:FirmwareStitchingOpts}} +{{#include ../../../cmd/firmware-action/recipes/stitching.go:IfdtoolEntry}} ``` ### Specific / u-root diff --git a/docs/src/firmware-action/interactive.md b/docs/src/firmware-action/interactive.md index a162af80..0ec89bde 100644 --- a/docs/src/firmware-action/interactive.md +++ b/docs/src/firmware-action/interactive.md @@ -29,7 +29,7 @@ To start a `ssh` service and wait for user to log-in, the container has to be co As a workaround, when the evaluation of pipeline fails in the container, the container from previous step is converted into a `service` container with everything as it was just before the failing command was executed. In essence, when you connect, you end up in pristine environment. ~~~go -{{#include ../../../action/container/ssh.go:ContainerAsService}} +{{#include ../../../cmd/firmware-action/container/ssh.go:ContainerAsService}} ~~~ ``` From 4d4a2b850acda5a0bd462c17d87ec74df5cf07f0 Mon Sep 17 00:00:00 2001 From: AtomicFS Date: Mon, 2 Dec 2024 13:36:23 +0100 Subject: [PATCH 3/6] docs: add golang installation instructions Signed-off-by: AtomicFS --- docs/src/firmware-action/get_started/04_get_firmware_action.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/firmware-action/get_started/04_get_firmware_action.md b/docs/src/firmware-action/get_started/04_get_firmware_action.md index e678ae27..155a5621 100644 --- a/docs/src/firmware-action/get_started/04_get_firmware_action.md +++ b/docs/src/firmware-action/get_started/04_get_firmware_action.md @@ -4,4 +4,5 @@ You can get Firmware-Action multiple ways: - clone the repository and [build the executable yourself](../usage_local.md) - download pre-compiled executable from [releases](https://github.com/9elements/firmware-action/releases). - Arch Linux [AUR package](https://aur.archlinux.org/packages/firmware-action) +- build from source with golang `go install github.com/9elements/firmware-action/cmd/firmware-action@latest` From a48e9b9ac0e414de4185c6eda892361f681b3a33 Mon Sep 17 00:00:00 2001 From: Marvin Drees Date: Wed, 8 Jan 2025 21:34:35 +0100 Subject: [PATCH 4/6] docs: update remaining '/action' reference Signed-off-by: Marvin Drees --- docs/src/firmware-action/config.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/firmware-action/config.md b/docs/src/firmware-action/config.md index 4efff50b..491ba70f 100644 --- a/docs/src/firmware-action/config.md +++ b/docs/src/firmware-action/config.md @@ -142,13 +142,13 @@ For more tails see [go-playground/validator](https://github.com/go-playground/va ### Specific / u-root ```go -{{#include ../../../action/recipes/uroot.go:URootOpts}} -{{#include ../../../action/recipes/uroot.go:URootSpecific}} +{{#include ../../../cmd/firmware-action/recipes/uroot.go:URootOpts}} +{{#include ../../../cmd/firmware-action/recipes/uroot.go:URootSpecific}} ``` ### Specific / Universal module ```go -{{#include ../../../action/recipes/universal.go:UniversalOpts}} -{{#include ../../../action/recipes/universal.go:UniversalSpecific}} +{{#include ../../../cmd/firmware-action/recipes/universal.go:UniversalOpts}} +{{#include ../../../cmd/firmware-action/recipes/universal.go:UniversalSpecific}} ``` From b3cb6c5905d92921fd44739566222fed0ed1c55e Mon Sep 17 00:00:00 2001 From: Marvin Drees Date: Wed, 8 Jan 2025 21:35:07 +0100 Subject: [PATCH 5/6] chore: change go mod path and imports This simplifies the mod path now that we moved the code Signed-off-by: Marvin Drees Signed-off-by: AtomicFS --- cmd/firmware-action/container/container.go | 2 +- cmd/firmware-action/container/container_test.go | 2 +- cmd/firmware-action/go.mod | 2 +- cmd/firmware-action/logging/logging.go | 2 +- cmd/firmware-action/main.go | 6 +++--- cmd/firmware-action/recipes/config.go | 4 ++-- cmd/firmware-action/recipes/coreboot.go | 6 +++--- cmd/firmware-action/recipes/coreboot_test.go | 2 +- cmd/firmware-action/recipes/edk2.go | 2 +- cmd/firmware-action/recipes/linux.go | 4 ++-- cmd/firmware-action/recipes/linux_test.go | 2 +- cmd/firmware-action/recipes/recipes.go | 4 ++-- cmd/firmware-action/recipes/stitching.go | 4 ++-- cmd/firmware-action/recipes/stitching_test.go | 2 +- cmd/firmware-action/recipes/universal.go | 2 +- cmd/firmware-action/recipes/universal_test.go | 2 +- cmd/firmware-action/recipes/uroot.go | 2 +- cmd/firmware-action/recipes/uroot_test.go | 2 +- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/cmd/firmware-action/container/container.go b/cmd/firmware-action/container/container.go index 776b6dd2..41cdb48f 100644 --- a/cmd/firmware-action/container/container.go +++ b/cmd/firmware-action/container/container.go @@ -15,7 +15,7 @@ import ( "strings" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/logging" + "github.com/9elements/firmware-action/logging" ) var ( diff --git a/cmd/firmware-action/container/container_test.go b/cmd/firmware-action/container/container_test.go index e65c58ba..0d835b92 100644 --- a/cmd/firmware-action/container/container_test.go +++ b/cmd/firmware-action/container/container_test.go @@ -11,7 +11,7 @@ import ( "testing" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/filesystem" + "github.com/9elements/firmware-action/filesystem" "github.com/stretchr/testify/assert" ) diff --git a/cmd/firmware-action/go.mod b/cmd/firmware-action/go.mod index 43a1ed43..0da461a9 100644 --- a/cmd/firmware-action/go.mod +++ b/cmd/firmware-action/go.mod @@ -1,4 +1,4 @@ -module github.com/9elements/firmware-action/action +module github.com/9elements/firmware-action go 1.22.5 diff --git a/cmd/firmware-action/logging/logging.go b/cmd/firmware-action/logging/logging.go index f91cbd28..b7adc2c5 100644 --- a/cmd/firmware-action/logging/logging.go +++ b/cmd/firmware-action/logging/logging.go @@ -36,7 +36,7 @@ func InitLogger(level slog.Level, opts ...PrettyHandlerOption) { // TrimNameFunction just trims the name func TrimNameFunction(pc uintptr) string { // 'runtime.FuncForPC(pc).Name()' is nice and all, but it will return this monstrosity: - // github.com/9elements/firmware-action/action/.... + // github.com/9elements/firmware-action/.... // So this function is just to trim it down // Usage: // pc, _, _, _ := runtime.Caller(0) diff --git a/cmd/firmware-action/main.go b/cmd/firmware-action/main.go index 4fd374df..c6045870 100644 --- a/cmd/firmware-action/main.go +++ b/cmd/firmware-action/main.go @@ -13,9 +13,9 @@ import ( "os" "regexp" - "github.com/9elements/firmware-action/action/filesystem" - "github.com/9elements/firmware-action/action/logging" - "github.com/9elements/firmware-action/action/recipes" + "github.com/9elements/firmware-action/filesystem" + "github.com/9elements/firmware-action/logging" + "github.com/9elements/firmware-action/recipes" "github.com/alecthomas/kong" "github.com/go-git/go-git/v5" "github.com/jedib0t/go-pretty/v6/table" diff --git a/cmd/firmware-action/recipes/config.go b/cmd/firmware-action/recipes/config.go index 9ee8ac85..2f64d850 100644 --- a/cmd/firmware-action/recipes/config.go +++ b/cmd/firmware-action/recipes/config.go @@ -15,8 +15,8 @@ import ( "strings" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" - "github.com/9elements/firmware-action/action/logging" + "github.com/9elements/firmware-action/container" + "github.com/9elements/firmware-action/logging" "github.com/go-playground/validator/v10" ) diff --git a/cmd/firmware-action/recipes/coreboot.go b/cmd/firmware-action/recipes/coreboot.go index 33404a55..f9fa0184 100644 --- a/cmd/firmware-action/recipes/coreboot.go +++ b/cmd/firmware-action/recipes/coreboot.go @@ -15,9 +15,9 @@ import ( "strings" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" - "github.com/9elements/firmware-action/action/filesystem" - "github.com/9elements/firmware-action/action/logging" + "github.com/9elements/firmware-action/container" + "github.com/9elements/firmware-action/filesystem" + "github.com/9elements/firmware-action/logging" ) // BlobDef is used to store information about a single blob. diff --git a/cmd/firmware-action/recipes/coreboot_test.go b/cmd/firmware-action/recipes/coreboot_test.go index 8041d092..d028c249 100644 --- a/cmd/firmware-action/recipes/coreboot_test.go +++ b/cmd/firmware-action/recipes/coreboot_test.go @@ -12,7 +12,7 @@ import ( "testing" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/filesystem" + "github.com/9elements/firmware-action/filesystem" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" ) diff --git a/cmd/firmware-action/recipes/edk2.go b/cmd/firmware-action/recipes/edk2.go index f2ecd552..cd6d9030 100644 --- a/cmd/firmware-action/recipes/edk2.go +++ b/cmd/firmware-action/recipes/edk2.go @@ -12,7 +12,7 @@ import ( "runtime" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" + "github.com/9elements/firmware-action/container" ) // ANCHOR: Edk2Specific diff --git a/cmd/firmware-action/recipes/linux.go b/cmd/firmware-action/recipes/linux.go index e5707336..c4ba93ba 100644 --- a/cmd/firmware-action/recipes/linux.go +++ b/cmd/firmware-action/recipes/linux.go @@ -15,8 +15,8 @@ import ( "strings" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" - "github.com/9elements/firmware-action/action/logging" + "github.com/9elements/firmware-action/container" + "github.com/9elements/firmware-action/logging" ) var errUnknownArchCrossCompile = errors.New("unknown architecture for cross-compilation") diff --git a/cmd/firmware-action/recipes/linux_test.go b/cmd/firmware-action/recipes/linux_test.go index 29d49486..57341432 100644 --- a/cmd/firmware-action/recipes/linux_test.go +++ b/cmd/firmware-action/recipes/linux_test.go @@ -13,7 +13,7 @@ import ( "testing" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/filesystem" + "github.com/9elements/firmware-action/filesystem" "github.com/Masterminds/semver" "github.com/stretchr/testify/assert" ) diff --git a/cmd/firmware-action/recipes/recipes.go b/cmd/firmware-action/recipes/recipes.go index a6f53f33..c61599cc 100644 --- a/cmd/firmware-action/recipes/recipes.go +++ b/cmd/firmware-action/recipes/recipes.go @@ -15,8 +15,8 @@ import ( "sync" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" - "github.com/9elements/firmware-action/action/filesystem" + "github.com/9elements/firmware-action/container" + "github.com/9elements/firmware-action/filesystem" "github.com/heimdalr/dag" ) diff --git a/cmd/firmware-action/recipes/stitching.go b/cmd/firmware-action/recipes/stitching.go index fc213759..5726b8ea 100644 --- a/cmd/firmware-action/recipes/stitching.go +++ b/cmd/firmware-action/recipes/stitching.go @@ -14,8 +14,8 @@ import ( "strings" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" - "github.com/9elements/firmware-action/action/logging" + "github.com/9elements/firmware-action/container" + "github.com/9elements/firmware-action/logging" "github.com/dustin/go-humanize" ) diff --git a/cmd/firmware-action/recipes/stitching_test.go b/cmd/firmware-action/recipes/stitching_test.go index e9b6e36f..fe8c9561 100644 --- a/cmd/firmware-action/recipes/stitching_test.go +++ b/cmd/firmware-action/recipes/stitching_test.go @@ -15,7 +15,7 @@ import ( "testing" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/filesystem" + "github.com/9elements/firmware-action/filesystem" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" ) diff --git a/cmd/firmware-action/recipes/universal.go b/cmd/firmware-action/recipes/universal.go index 234d74f2..b79a7d30 100644 --- a/cmd/firmware-action/recipes/universal.go +++ b/cmd/firmware-action/recipes/universal.go @@ -9,7 +9,7 @@ import ( "log/slog" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" + "github.com/9elements/firmware-action/container" ) // UniversalSpecific is used to store data specific to the universal command module diff --git a/cmd/firmware-action/recipes/universal_test.go b/cmd/firmware-action/recipes/universal_test.go index 3d7d0bf0..6384145e 100644 --- a/cmd/firmware-action/recipes/universal_test.go +++ b/cmd/firmware-action/recipes/universal_test.go @@ -10,7 +10,7 @@ import ( "testing" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/filesystem" + "github.com/9elements/firmware-action/filesystem" "github.com/stretchr/testify/assert" ) diff --git a/cmd/firmware-action/recipes/uroot.go b/cmd/firmware-action/recipes/uroot.go index 1b8ae375..5d332b48 100644 --- a/cmd/firmware-action/recipes/uroot.go +++ b/cmd/firmware-action/recipes/uroot.go @@ -9,7 +9,7 @@ import ( "log/slog" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/container" + "github.com/9elements/firmware-action/container" ) // URootSpecific is used to store data specific to u-root diff --git a/cmd/firmware-action/recipes/uroot_test.go b/cmd/firmware-action/recipes/uroot_test.go index 39fa94c4..c2f89654 100644 --- a/cmd/firmware-action/recipes/uroot_test.go +++ b/cmd/firmware-action/recipes/uroot_test.go @@ -12,7 +12,7 @@ import ( "testing" "dagger.io/dagger" - "github.com/9elements/firmware-action/action/filesystem" + "github.com/9elements/firmware-action/filesystem" "github.com/stretchr/testify/assert" ) From 584400734c86e700881afeff4a47d476d7c4439d Mon Sep 17 00:00:00 2001 From: AtomicFS Date: Wed, 8 Jan 2025 22:27:33 +0100 Subject: [PATCH 6/6] fix: undefined variable in Taskfile Signed-off-by: AtomicFS --- Taskfile.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/Taskfile.yml b/Taskfile.yml index f38f7d3a..f36f846d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,6 +2,7 @@ version: '3' vars: SEMVER: 'v0.10.2' + GOLANG_CODE_PATH: 'cmd/firmware-action' includes: containers: