-
Notifications
You must be signed in to change notification settings - Fork 14
chore: add devcontainer and Taskfile workflow for multi-platform builds #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Cesarucho
wants to merge
4
commits into
hostinger:main
Choose a base branch
from
Cesarucho:feature/automation-binaries
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
659afdc
feat: add DevContainer and Taskfile for release automation
Cesarucho c080bdc
feat: add DevContainer and Taskfile for release automation
Cesarucho 601662d
issue(coderabbit): applying coderabbit-ai suggestions
Cesarucho ba7749c
issue(coderabbit): applying coderabbit-ai suggestions, revision 2
Cesarucho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,49 @@ | ||
| // For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
| // README at: https://github.com/devcontainers/templates/tree/main/src/go . | ||
| { | ||
| "name": "Go", | ||
| // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
| "image": "mcr.microsoft.com/devcontainers/go:2-1.25-trixie", | ||
|
|
||
| // Features to add to the dev container. More info: https://containers.dev/features. | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/go:1": {}, | ||
| "ghcr.io/guiyomh/features/golangci-lint:0": {}, | ||
| "ghcr.io/guiyomh/features/goreleaser:0": {} | ||
| }, | ||
|
|
||
| // Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
| // "forwardPorts": [], | ||
|
|
||
| // Configure tool-specific properties. | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "openai.chatgpt", | ||
| "golang.Go" | ||
| ], | ||
| "settings": { | ||
| // Slightly different dark theme to highlight the DevContainer | ||
| "workbench.colorTheme": "Default Dark Modern", | ||
| "workbench.colorCustomizations": { | ||
| "statusBar.background": "#005f73", | ||
| "statusBar.noFolderBackground": "#005f73", | ||
| "statusBar.debuggingBackground": "#9b2226", | ||
| "statusBar.foreground": "#ffffff" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| // Preserve the packages configurations within the container on a host volume: git, codex-extension. | ||
| "mounts": [ | ||
| "source=codex-session,target=/home/vscode/.codex,type=volume", | ||
| "source=gitconfig,target=/home/vscode/.gitconfig-volume,type=volume" | ||
| ], | ||
|
|
||
| // Use 'postCreateCommand' to run commands after the container is created. | ||
| "postCreateCommand": "./.devcontainer/setup.sh", | ||
|
|
||
| // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
| "remoteUser": "vscode" | ||
| } |
This file contains hidden or 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,29 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if ! command -v task >/dev/null; then | ||
| echo "Installing Taskfile CLI helper..." >&2 | ||
| curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash | ||
| sudo apt install -y task | ||
| fi | ||
|
|
||
| sudo chown -R ${UID}:${UID} ${HOME}/.codex | ||
|
|
||
| # Fix project file permissions to standard privileges | ||
| sudo chown -R ${UID}:${UID} ${PWD} | ||
| sudo find ${PWD} -type d -exec chmod 755 {} + | ||
| sudo find ${PWD} -type f ! -name "*.sh" -exec chmod 644 {} + | ||
| sudo find ${PWD} -type f -name "*.sh" -exec chmod 755 {} + | ||
|
|
||
| # Setup git files configurations | ||
| sudo chown -R ${UID}:${UID} ${HOME}/.gitconfig-volume | ||
|
|
||
| touch ${HOME}/.gitconfig-volume/config | ||
| ln -fs ${HOME}/.gitconfig-volume/config ${HOME}/.gitconfig | ||
| sudo chown -R ${UID}:${UID} ${HOME}/.gitconfig | ||
|
|
||
| touch ${HOME}/.gitconfig-volume/.git-credentials | ||
| ln -fs ${HOME}/.gitconfig-volume/.git-credentials ${HOME}/.git-credentials | ||
| sudo chown -R ${UID}:${UID} ${HOME}/.git-credentials | ||
|
|
||
| git config --global --add safe.directory ${PWD} | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| .idea/ | ||
| hapi | ||
| hapi | ||
| bin/ | ||
| dist/ |
This file contains hidden or 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
This file contains hidden or 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,157 @@ | ||
| version: '3' | ||
|
|
||
| env: | ||
| DIST_DIR: dist | ||
| BINARY: hapi | ||
| LDFLAGS: -s -w | ||
|
|
||
| tasks: | ||
| default: | ||
| desc: List the available tasks without executing any of them. | ||
| silent: true | ||
| cmds: | ||
| - task --list | ||
|
|
||
| clean: | ||
| desc: Remove previously generated artifacts. | ||
| cmds: | ||
| - rm -rf ${DIST_DIR} | ||
|
|
||
| ensure: | ||
| desc: Download Go modules before building. | ||
| cmds: | ||
| - go mod download | ||
|
|
||
| build: | ||
| desc: Build the CLI for the host platform. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/host | ||
| - go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/host/${BINARY} main.go | ||
|
|
||
| build.linux-amd64: | ||
| desc: Build Linux amd64 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/linux-amd64 | ||
| - GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/linux-amd64/${BINARY} main.go | ||
|
|
||
| build.linux-arm64: | ||
| desc: Build Linux arm64 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/linux-arm64 | ||
| - GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/linux-arm64/${BINARY} main.go | ||
|
|
||
| build.darwin-amd64: | ||
| desc: Build macOS amd64 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/darwin-amd64 | ||
| - GOOS=darwin GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/darwin-amd64/${BINARY} main.go | ||
|
|
||
| build.darwin-arm64: | ||
| desc: Build macOS arm64 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/darwin-arm64 | ||
| - GOOS=darwin GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/darwin-arm64/${BINARY} main.go | ||
|
|
||
| build.linux-386: | ||
| desc: Build Linux 386 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/linux-386 | ||
| - GOOS=linux GOARCH=386 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/linux-386/${BINARY} main.go | ||
|
|
||
| build.windows-386: | ||
| desc: Build Windows 386 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/windows-386 | ||
| - GOOS=windows GOARCH=386 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-386/${BINARY}.exe main.go | ||
|
|
||
| build.windows-amd64: | ||
| desc: Build Windows amd64 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/windows-amd64 | ||
| - GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-amd64/${BINARY}.exe main.go | ||
|
|
||
| build.windows-arm64: | ||
| desc: Build Windows arm64 binary. | ||
| deps: [ensure] | ||
| cmds: | ||
| - mkdir -p ${DIST_DIR}/windows-arm64 | ||
| - GOOS=windows GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ${DIST_DIR}/windows-arm64/${BINARY}.exe main.go | ||
|
|
||
| package.linux-amd64: | ||
| desc: Package the Linux amd64 binary into a tarball. | ||
| deps: [build.linux-amd64] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-linux-amd64.tar.gz -C ${DIST_DIR}/linux-amd64 ${BINARY}' | ||
|
|
||
| package.linux-arm64: | ||
| desc: Package the Linux arm64 binary into a tarball. | ||
| deps: [build.linux-arm64] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-linux-arm64.tar.gz -C ${DIST_DIR}/linux-arm64 ${BINARY}' | ||
|
|
||
| package.darwin-arm64: | ||
| desc: Package the macOS arm64 binary into a tarball. | ||
| deps: [build.darwin-arm64] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-arm64.tar.gz -C ${DIST_DIR}/darwin-arm64 ${BINARY}' | ||
|
|
||
| package.darwin-amd64: | ||
| desc: Package the macOS amd64 binary into a tarball. | ||
| deps: [build.darwin-amd64] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-darwin-amd64.tar.gz -C ${DIST_DIR}/darwin-amd64 ${BINARY}' | ||
|
|
||
| package.linux-386: | ||
| desc: Package the Linux 386 binary into a tarball. | ||
| deps: [build.linux-386] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-linux-386.tar.gz -C ${DIST_DIR}/linux-386 ${BINARY}' | ||
|
|
||
| package.windows-386: | ||
| desc: Package the Windows 386 binary into a tarball. | ||
| deps: [build.windows-386] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-386.tar.gz -C ${DIST_DIR}/windows-386 ${BINARY}.exe' | ||
|
|
||
| package.windows-amd64: | ||
| desc: Package the Windows amd64 binary into a tarball. | ||
| deps: [build.windows-amd64] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-amd64.tar.gz -C ${DIST_DIR}/windows-amd64 ${BINARY}.exe' | ||
|
|
||
| package.windows-arm64: | ||
| desc: Package the Windows arm64 binary into a tarball. | ||
| deps: [build.windows-arm64] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); tar czf ${DIST_DIR}/${BINARY}-$version-windows-arm64.tar.gz -C ${DIST_DIR}/windows-arm64 ${BINARY}.exe' | ||
|
|
||
| packages: | ||
| desc: Package every platform bundle. | ||
| deps: | ||
| - package.darwin-amd64 | ||
| - package.darwin-arm64 | ||
| - package.linux-386 | ||
| - package.linux-amd64 | ||
| - package.linux-arm64 | ||
| - package.windows-386 | ||
| - package.windows-amd64 | ||
| - package.windows-arm64 | ||
|
|
||
| package.checksums: | ||
| desc: Create SHA256 checksums for every release tarball. | ||
| deps: [packages] | ||
| cmds: | ||
| - sh -c 'version=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD); cd ${DIST_DIR}; sha256sum ${BINARY}-$version-*.tar.gz > ${BINARY}-$version-checksums.sha256' | ||
|
|
||
| release: | ||
| desc: Build and package every target used for releases. | ||
| deps: | ||
| - package.checksums |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.