-
Notifications
You must be signed in to change notification settings - Fork 1
Hermetic Builds 🔒 #40
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9780bc1
more hermetic builds
GrantBirki faebc6d
match go versions
GrantBirki eaf4921
run `script/update`
GrantBirki 9d8bcc8
Fix shebang formatting in env script
GrantBirki a9e02e7
Refactor build environment variables and ldflags in .goreleaser.yaml
GrantBirki b3b65d4
goreleaser updates
GrantBirki 7ce3394
fix build
GrantBirki 8b9cefd
add check
GrantBirki 3c50135
Update build scripts to use single target mode and pass arguments to …
GrantBirki 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
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
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
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
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
source script/env "$@" | ||
|
||
echo -e "${BLUE}🥾 Bootstrapping...${OFF}" | ||
|
||
# Hermetic check: ensure all imports resolve from vendor/ only | ||
# This avoids touching the network or the module cache. | ||
go list -mod=vendor -deps ./... > /dev/null | ||
|
||
echo -e "${GREEN}✅ Bootstrap complete!${OFF}" |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
source script/env "$@" | ||
|
||
# Get build information for embedding into binary | ||
COMMIT_SHA="$(git rev-parse HEAD)" | ||
BUILD_TIME="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" | ||
|
||
go build -mod=vendor -ldflags "-X github.com/github/gh-combine/internal/version.commit=${COMMIT_SHA} -X github.com/github/gh-combine/internal/version.buildTime=${BUILD_TIME}" -v ./cmd/gh-combine | ||
|
||
echo -e "${GREEN}Build completed successfully!${OFF}" |
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 @@ | ||
#! /usr/bin/env bash | ||
GrantBirki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
set -euo pipefail | ||
|
||
# COLORS | ||
export OFF='\033[0m' | ||
export RED='\033[0;31m' | ||
export GREEN='\033[0;32m' | ||
export BLUE='\033[0;34m' | ||
export PURPLE='\033[0;35m' | ||
|
||
# set the working directory to the root of the project | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" | ||
export DIR | ||
|
||
# The name of the repository is the name of the directory (usually) | ||
REPO_NAME=$(basename "$PWD") | ||
export REPO_NAME | ||
|
||
# detect OS version and architecture | ||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | ||
PLATFORM="linux" | ||
VERSION="$(awk -F= '/^VERSION_CODENAME=/{print $2}' /etc/os-release | tr -d '"' || echo "unknown")" | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
PLATFORM="macos" | ||
VERSION=$(sw_vers -productVersion || echo "unknown") | ||
else | ||
PLATFORM="unknown" | ||
VERSION="unknown" | ||
fi | ||
|
||
ARCH=$(uname -m || echo "unknown") | ||
|
||
export PLATFORM | ||
export VERSION | ||
export ARCH | ||
|
||
# make the vendor/ directory if it doesn't exist | ||
mkdir -p "$DIR/vendor/" | ||
|
||
# Mark the current GitHub organization based on the remote URL | ||
# This is used to set GOPRIVATE for private repositories | ||
# You might want to remove these lines if you're not using a private repo in any of your dependencies | ||
#CURRENT_GITHUB_ORG=$(git remote get-url origin | sed 's/.*github\.com[\/:]//; s/\/.*$//') | ||
#export GOPRIVATE="github.com/$CURRENT_GITHUB_ORG/*" | ||
|
||
# Set up Go environment variables | ||
export GOPROXY="off" | ||
export GOSUMDB="off" |
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,7 +1,8 @@ | ||
#! /usr/bin/env bash | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -euo pipefail | ||
|
||
go fmt ./... | ||
go mod tidy | ||
source script/env "$@" | ||
|
||
go fmt -mod=vendor ./... | ||
golangci-lint run --fix | ||
GrantBirki marked this conversation as resolved.
Show resolved
Hide resolved
|
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,4 +1,6 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Usage: | ||
# script/release | ||
|
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,12 +1,14 @@ | ||
#! /usr/bin/env bash | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -euo pipefail | ||
|
||
source script/env "$@" | ||
|
||
count=10 | ||
|
||
# if the tparse binary is not found, don't use it | ||
if ! command -v tparse &> /dev/null; then | ||
go test -race -count $count -v -cover -coverprofile=coverage.out ./... | ||
go test -mod=vendor -race -count $count -v -cover -coverprofile=coverage.out ./... | ||
else | ||
set -o pipefail && go test -race -count $count -cover -coverprofile=coverage.out -json ./... | tparse -smallscreen -all -trimpath github.com/github/ | ||
set -o pipefail && go test -mod=vendor -race -count $count -cover -coverprofile=coverage.out -json ./... | tparse -smallscreen -all -trimpath github.com/github/ | ||
fi |
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,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
source script/env "$@" | ||
|
||
# Always reset env on exit (success or failure) | ||
restore_env() { | ||
export GOPROXY="off" | ||
export GOSUMDB="off" | ||
} | ||
trap restore_env EXIT | ||
|
||
# Parse flags | ||
ALL=0 | ||
for arg in "$@"; do | ||
case "$arg" in | ||
--all) | ||
ALL=1 | ||
;; | ||
esac | ||
done | ||
|
||
export GOPROXY="https://proxy.golang.org" | ||
export GOSUMDB="sum.golang.org" | ||
unset GOFLAGS # to avoid forcing -mod=vendor | ||
|
||
# Update deps | ||
if [ "$ALL" -eq 1 ]; then | ||
echo -e "${BLUE}Updating ALL modules (direct + transitive)...${OFF}" | ||
echo -e "${BLUE}Includes MAJOR version bumps (go get -u all).${OFF}" | ||
go get -u all | ||
else | ||
echo -e "${BLUE}Updating direct deps to latest compatible versions...${OFF}" | ||
echo -e "${BLUE}(minor/patch only; use --all for majors) (go get -u ./...).${OFF}" | ||
go get -u ./... | ||
fi | ||
|
||
go mod tidy | ||
go mod vendor | ||
go mod verify | ||
|
||
echo -e "${GREEN}Dependencies updated successfully!${OFF}" |
Oops, something went wrong.
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.