-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
763 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
#KINDEST_VERSION=v1.24.7 | ||
#GO111MODULE=on | ||
#REDIS_VERSION=7 | ||
#ROOT_DIR=${AP_ROOT} | ||
#AP_DEVCACHE_BASE=${AP_ROOT}/.cache | ||
#AP_DEVCACHE=${AP_DEVCACHE_BASE} | ||
#AP_DEVCACHE_BIN=${AP_DEVCACHE}/bin | ||
#AP_DEVCACHE_INCLUDE=${AP_DEVCACHE}/include | ||
#AP_DEVCACHE_VERSIONS=${AP_DEVCACHE}/versions | ||
#AP_DEVCACHE_NODE_MODULES=${AP_DEVCACHE} | ||
#AP_DEVCACHE_NODE_BIN=${AP_DEVCACHE_NODE_MODULES}/node_modules/.bin | ||
#AP_DEVCACHE_TESTS=${AP_DEVCACHE}/tests | ||
#DEVCACHE_RUN=${AP_DEVCACHE}/run |
This file contains 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,74 @@ | ||
direnv_version_major=$(direnv version | cut -d "." -f1 | tr -d '\n') | ||
direnv_version_minor=$(direnv version | cut -d "." -f2 | tr -d '\n') | ||
|
||
if [[ $direnv_version_major -lt 2 ]] || [[ $direnv_version_major -eq 2 ]] && [[ $direnv_version_minor -lt 32 ]]; then | ||
echo -e "\033[31munsupported direnv version $(direnv version) < 2.32.x" | ||
exit 1 | ||
fi | ||
|
||
if [[ "$SHELL" == "bash" ]]; then | ||
if [ "${BASH_VERSINFO:-0}" -lt 4 ]; then | ||
echo -e "\033[31mthe environment needs BASH 4 or above" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
AP_ROOT=$(pwd) | ||
export AP_ROOT | ||
|
||
dotenv | ||
dotenv_if_exists dev.env | ||
|
||
if ! has make ; then | ||
echo -e "\033[31mmake is not installed"; exit 1 | ||
fi | ||
|
||
if ! has go ; then | ||
echo -e "\033[31mgo is not installed"; exit 1 | ||
fi | ||
|
||
TOOLS=${AP_ROOT}/script/tools.sh | ||
SEMVER=${AP_ROOT}/script/semver.sh | ||
|
||
GOTOOLCHAIN=$(${TOOLS} gotoolchain) | ||
GOTOOLCHAIN_SEMVER=$(echo "${GOTOOLCHAIN}" | sed 's/go*/v/' | tr -d '\n') | ||
|
||
AKASH_DIRENV_SET=1 | ||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# on MacOS disable deprecation warnings security framework | ||
CGO_CFLAGS=-Wno-deprecated-declarations | ||
|
||
export CGO_CFLAGS | ||
|
||
if ! has brew; then | ||
echo -e "\033[31mhomebrew is not installed. visit https://brew.sh" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z $HOMEBREW_PREFIX ]]; then | ||
HOMEBREW_PREFIX=$(brew --prefix) | ||
fi | ||
|
||
# don't use brew list, as it is utterly slow | ||
getopt_bin=${HOMEBREW_PREFIX}/opt/gnu-getopt/bin | ||
|
||
if [ ! -d "$getopt_bin" ]; then | ||
echo -e "\033[31mgnu-getopt is not installed. to install \"brew install gnu-getopt\"" | ||
exit 1 | ||
else | ||
path=$path:"$getopt_bin" | ||
fi | ||
fi | ||
|
||
if [[ -z "$GOPATH" ]]; then | ||
GOPATH=$(go env GOPATH) | ||
export GOPATH | ||
fi | ||
|
||
PATH_add "$path" | ||
|
||
export SEMVER | ||
export GOTOOLCHAIN | ||
export GOTOOLCHAIN_SEMVER | ||
export AKASH_DIRENV_SET |
This file contains 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,48 @@ | ||
--- | ||
name: release | ||
defaults: | ||
run: | ||
shell: bash | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_CLI_EXPERIMENTAL: "enabled" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Detect required Go version | ||
run: | | ||
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//') | ||
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "${{ env.GOVERSION }}" | ||
- name: Setup direnv | ||
uses: HatsuneMiku3939/direnv-action@v1 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: release version | ||
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- name: Login to GHCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: release publish | ||
run: | | ||
sudo rm -rf dist | ||
make release | ||
env: | ||
GORELEASER_RELEASE: true | ||
GORELEASER_MOUNT_CONFIG: true | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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,2 @@ | ||
e2e-test | ||
dist |
This file contains 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,65 @@ | ||
--- | ||
project_name: e2e-test | ||
env: | ||
- GO111MODULE=on | ||
builds: | ||
- id: e2e-test-linux | ||
binary: e2e-test | ||
main: ./ | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
goos: | ||
- linux | ||
flags: | ||
- -trimpath | ||
archives: | ||
- format: binary | ||
dockers: | ||
- dockerfile: Dockerfile | ||
use: buildx | ||
goos: linux | ||
goarch: amd64 | ||
build_flag_templates: | ||
- --platform=linux/amd64 | ||
- --label=org.opencontainers.image.title={{ .ProjectName }} | ||
- --label=org.opencontainers.image.description={{ .ProjectName }} | ||
- --label=org.opencontainers.image.url={{.GitURL}} | ||
- --label=org.opencontainers.image.source={{.GitURL}} | ||
- --label=org.opencontainers.image.version={{ .Version }} | ||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
image_templates: | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .ShortCommit }}-amd64" | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .Version }}-amd64" | ||
- "{{ .Env.DOCKER_IMAGE }}:latest-amd64" | ||
- dockerfile: Dockerfile | ||
use: buildx | ||
goos: linux | ||
goarch: arm64 | ||
build_flag_templates: | ||
- --platform=linux/arm64 | ||
- --label=org.opencontainers.image.title={{ .ProjectName }} | ||
- --label=org.opencontainers.image.description={{ .ProjectName }} | ||
- --label=org.opencontainers.image.url={{.GitURL}} | ||
- --label=org.opencontainers.image.source={{.GitURL}} | ||
- --label=org.opencontainers.image.version={{ .Version }} | ||
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
image_templates: | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .ShortCommit }}-arm64" | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .Version }}-arm64" | ||
- "{{ .Env.DOCKER_IMAGE }}:latest-arm64" | ||
docker_manifests: | ||
- name_template: "{{ .Env.DOCKER_IMAGE }}:{{ .ShortCommit }}" | ||
image_templates: | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .ShortCommit }}-amd64" | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .ShortCommit }}-arm64" | ||
- name_template: "{{ .Env.DOCKER_IMAGE }}:{{ .Version }}" | ||
image_templates: | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .Version }}-amd64" | ||
- "{{ .Env.DOCKER_IMAGE }}:{{ .Version }}-arm64" | ||
- name_template: "{{ .Env.DOCKER_IMAGE }}:latest" | ||
image_templates: | ||
- "{{ .Env.DOCKER_IMAGE }}:latest-amd64" | ||
- "{{ .Env.DOCKER_IMAGE }}:latest-arm64" |
This file contains 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,14 @@ | ||
FROM debian | ||
|
||
COPY ./e2e-test /usr/local/bin | ||
|
||
RUN \ | ||
apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
tini \ | ||
ca-certificates \ | ||
curl \ | ||
bash \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENTRYPOINT ["/tini", "--", "e2e-test"] |
This file contains 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,55 @@ | ||
GORELEASER_RELEASE ?= false | ||
GORELEASER_DEBUG ?= false | ||
GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser:$(GOTOOLCHAIN_SEMVER) | ||
GORELEASER_MOUNT_CONFIG ?= false | ||
GORELEASER_SNAPSHOT ?= false | ||
GORELEASER_SKIP_FLAGS := $(GORELEASER_SKIP) | ||
GORELEASER_SKIP := | ||
GORELEASER_CONFIG ?= .goreleaser.yaml | ||
|
||
RELEASE_DOCKER_IMAGE ?= ghcr.io/akash-network/e2e-test | ||
|
||
GO_MOD_NAME := $(shell go list -m 2>/dev/null) | ||
|
||
null := | ||
space := $(null) # | ||
comma := , | ||
|
||
ifneq ($(GORELEASER_RELEASE),true) | ||
GITHUB_TOKEN= | ||
GORELEASER_SKIP_FLAGS += publish | ||
endif | ||
|
||
ifneq ($(GORELEASER_SKIP_FLAGS),) | ||
GORELEASER_SKIP := --skip=$(subst $(space),$(comma),$(strip $(GORELEASER_SKIP_FLAGS))) | ||
endif | ||
|
||
ifeq ($(GORELEASER_MOUNT_CONFIG),true) | ||
GORELEASER_IMAGE := -v $(HOME)/.docker/config.json:/root/.docker/config.json $(GORELEASER_IMAGE) | ||
endif | ||
|
||
.PHONY: release | ||
release: | ||
docker run \ | ||
--rm \ | ||
-e MOD="$(GO_MOD)" \ | ||
-e BUILD_TAGS="$(BUILD_TAGS)" \ | ||
-e BUILD_VARS="$(GORELEASER_BUILD_VARS)" \ | ||
-e STRIP_FLAGS="$(GORELEASER_STRIP_FLAGS)" \ | ||
-e LINKMODE="$(GO_LINKMODE)" \ | ||
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \ | ||
-e GORELEASER_CURRENT_TAG="$(RELEASE_TAG)" \ | ||
-e DOCKER_IMAGE=$(RELEASE_DOCKER_IMAGE) \ | ||
-e GOTOOLCHAIN="$(GOTOOLCHAIN)" \ | ||
-e GOPATH=/go \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v $(GOPATH):/go \ | ||
-v $(shell pwd):/go/src/$(GO_MOD_NAME) \ | ||
-w /go/src/$(GO_MOD_NAME)\ | ||
$(GORELEASER_IMAGE) \ | ||
-f "$(GORELEASER_CONFIG)" \ | ||
release \ | ||
$(GORELEASER_SKIP) \ | ||
--debug=$(GORELEASER_DEBUG) \ | ||
--snapshot=$(GORELEASER_SNAPSHOT) \ | ||
--clean |
This file contains 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,5 @@ | ||
module github.com/akash-network/e2e-test | ||
|
||
go 1.21 | ||
|
||
require github.com/gorilla/mux v1.8.1 |
This file contains 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,2 @@ | ||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= | ||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= |
Oops, something went wrong.