quickrun
parent
6746143b36
commit
dc8a83a8d3
|
@ -9,105 +9,105 @@ variables:
|
|||
- &gitea_test_env_image 'gitea/test_env:linux-amd64'
|
||||
|
||||
pipeline:
|
||||
# dummy:
|
||||
dummy:
|
||||
image: *golang_image
|
||||
commands:
|
||||
- exit 0
|
||||
# deps-backend:
|
||||
# image: *golang_image
|
||||
# pull: true
|
||||
# secrets:
|
||||
# - goproxy_override
|
||||
# commands:
|
||||
# - exit 0
|
||||
deps-backend:
|
||||
image: *golang_image
|
||||
pull: true
|
||||
secrets:
|
||||
- goproxy_override
|
||||
commands:
|
||||
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
- make deps-backend
|
||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
# - make deps-backend
|
||||
|
||||
security-check:
|
||||
image: *golang_image
|
||||
pull: true
|
||||
secrets:
|
||||
- goproxy_override
|
||||
commands:
|
||||
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
- make security-check
|
||||
# security-check:
|
||||
# image: *golang_image
|
||||
# pull: true
|
||||
# secrets:
|
||||
# - goproxy_override
|
||||
# commands:
|
||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
# - make security-check
|
||||
|
||||
lint-backend:
|
||||
image: *gitea_test_env_image
|
||||
pull: true
|
||||
secrets:
|
||||
- goproxy_override
|
||||
environment:
|
||||
- TAGS=bindata sqlite sqlite_unlock_notify
|
||||
- GOSUMDB=sum.golang.org
|
||||
commands:
|
||||
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
- make lint-backend
|
||||
# lint-backend:
|
||||
# image: *gitea_test_env_image
|
||||
# pull: true
|
||||
# secrets:
|
||||
# - goproxy_override
|
||||
# environment:
|
||||
# - TAGS=bindata sqlite sqlite_unlock_notify
|
||||
# - GOSUMDB=sum.golang.org
|
||||
# commands:
|
||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
# - make lint-backend
|
||||
|
||||
checks-backend:
|
||||
image: *golang_image
|
||||
pull: true
|
||||
secrets:
|
||||
- goproxy_override
|
||||
commands:
|
||||
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
- make --always-make checks-backend
|
||||
# checks-backend:
|
||||
# image: *golang_image
|
||||
# pull: true
|
||||
# secrets:
|
||||
# - goproxy_override
|
||||
# commands:
|
||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
# - make --always-make checks-backend
|
||||
|
||||
fetch-tags:
|
||||
image: docker:git
|
||||
pull: true
|
||||
commands:
|
||||
- git config --add safe.directory '*'
|
||||
- git fetch --tags --force
|
||||
# fetch-tags:
|
||||
# image: docker:git
|
||||
# pull: true
|
||||
# commands:
|
||||
# - git config --add safe.directory '*'
|
||||
# - git fetch --tags --force
|
||||
|
||||
tag-pre-condition:
|
||||
image: drone/git
|
||||
pull: true
|
||||
commands:
|
||||
- git update-ref refs/heads/tag_test ${CI_COMMIT_SHA}
|
||||
# tag-pre-condition:
|
||||
# image: drone/git
|
||||
# pull: true
|
||||
# commands:
|
||||
# - git update-ref refs/heads/tag_test ${CI_COMMIT_SHA}
|
||||
|
||||
prepare-test-env:
|
||||
image: *gitea_test_env_image
|
||||
pull: true
|
||||
secrets:
|
||||
- goproxy_override
|
||||
commands:
|
||||
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
- ./build/test-env-prepare.sh
|
||||
# prepare-test-env:
|
||||
# image: *gitea_test_env_image
|
||||
# pull: true
|
||||
# secrets:
|
||||
# - goproxy_override
|
||||
# commands:
|
||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
# - ./build/test-env-prepare.sh
|
||||
|
||||
build-test:
|
||||
image: *gitea_test_env_image
|
||||
pull: true
|
||||
secrets:
|
||||
- goproxy_override
|
||||
environment:
|
||||
- GOSUMDB=sum.golang.org
|
||||
- TAGS=bindata sqlite sqlite_unlock_notify
|
||||
commands:
|
||||
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
- su gitea -c './build/test-env-check.sh'
|
||||
- su gitea -c 'make backend'
|
||||
# build-test:
|
||||
# image: *gitea_test_env_image
|
||||
# pull: true
|
||||
# secrets:
|
||||
# - goproxy_override
|
||||
# environment:
|
||||
# - GOSUMDB=sum.golang.org
|
||||
# - TAGS=bindata sqlite sqlite_unlock_notify
|
||||
# commands:
|
||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
# - su gitea -c './build/test-env-check.sh'
|
||||
# - su gitea -c 'make backend'
|
||||
|
||||
unit-test:
|
||||
image: *gitea_test_env_image
|
||||
pull: true
|
||||
secrets:
|
||||
- github_read_token
|
||||
- goproxy_override
|
||||
environment:
|
||||
- TAGS=bindata sqlite sqlite_unlock_notify
|
||||
- RACE_ENABLED=true
|
||||
commands:
|
||||
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
- su gitea -c 'make unit-test-coverage test-check'
|
||||
# unit-test:
|
||||
# image: *gitea_test_env_image
|
||||
# pull: true
|
||||
# secrets:
|
||||
# - github_read_token
|
||||
# - goproxy_override
|
||||
# environment:
|
||||
# - TAGS=bindata sqlite sqlite_unlock_notify
|
||||
# - RACE_ENABLED=true
|
||||
# commands:
|
||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||
# - su gitea -c 'make unit-test-coverage test-check'
|
||||
|
||||
test-sqlite:
|
||||
image: *gitea_test_env_image
|
||||
environment:
|
||||
- USE_REPO_TEST_DIR=1
|
||||
- GOPROXY=off
|
||||
- TAGS=bindata gogit sqlite sqlite_unlock_notify
|
||||
- TEST_TAGS=bindata gogit sqlite sqlite_unlock_notify
|
||||
commands:
|
||||
- su gitea -c 'timeout -s ABRT 120m make test-sqlite-migration test-sqlite'
|
||||
when:
|
||||
- evaluate: 'not (CI_COMMIT_MESSAGE contains "[SKIP SQLITE TEST]")'
|
||||
# test-sqlite:
|
||||
# image: *gitea_test_env_image
|
||||
# environment:
|
||||
# - USE_REPO_TEST_DIR=1
|
||||
# - GOPROXY=off
|
||||
# - TAGS=bindata gogit sqlite sqlite_unlock_notify
|
||||
# - TEST_TAGS=bindata gogit sqlite sqlite_unlock_notify
|
||||
# commands:
|
||||
# - su gitea -c 'timeout -s ABRT 120m make test-sqlite-migration test-sqlite'
|
||||
# when:
|
||||
# - evaluate: 'not (CI_COMMIT_MESSAGE contains "[SKIP SQLITE TEST]")'
|
||||
|
|
|
@ -101,15 +101,14 @@ pipeline:
|
|||
- releaseteamuser
|
||||
|
||||
prep-multiarch-binaries:
|
||||
image: *golang_image # image reuse to reduce pull times, go not required
|
||||
image: *golang_image # image reuse to reduce pull times, go not required we just need bash
|
||||
pull: true
|
||||
# the fallback version-name used by make, defaults to main in the script use this if we change the default name
|
||||
# environment:
|
||||
# defaulttagname: main
|
||||
commands:
|
||||
- mkdir docker/bin
|
||||
- bash -c './docker/map-binaries.sh ./dist/binaries forgejo gitea ${CI_COMMIT_TAG##v}'
|
||||
- bash -c './docker/map-binaries.sh ./dist/contrib environment-to-ini false ${CI_COMMIT_TAG##v}'
|
||||
- ./docker/map-binaries.sh ./dist/binaries forgejo gitea ${CI_COMMIT_TAG##v}
|
||||
- ./docker/map-binaries.sh ./dist/contrib environment-to-ini false ${CI_COMMIT_TAG##v}
|
||||
when:
|
||||
event: tag
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
errcho () {
|
||||
echo "${@}" >&2
|
||||
}
|
||||
|
||||
if [ ${#@} -lt 3 ]; then
|
||||
echo "not enough arguments provided" 1>&2
|
||||
errcho "not enough arguments provided"
|
||||
echo "syntax: ${0} <path directly containing the binary> <base name of the binary> <target name or false> [<version tag as in the file name>]"
|
||||
exit 1
|
||||
exit 2
|
||||
fi
|
||||
|
||||
BINARYLOOKUPPATH="${1}"
|
||||
|
@ -11,48 +15,61 @@ FILEBASENAME="${2}"
|
|||
RENAME="${3}"
|
||||
|
||||
if [ ${#@} -gt 3 ] && ! [ "${4}" == "" ]; then
|
||||
echo "Tag provided: ${4}"
|
||||
FILEVERSION="${4}"
|
||||
else
|
||||
echo "No tag provided defaulting to tag ${DEFAULTTAGNAME:-main}"
|
||||
FILEVERSION="${DEFAULTTAGNAME:-main}"
|
||||
fi
|
||||
|
||||
OUTFILENAME=""
|
||||
if [ "${RENAME}" == "false" ]; then
|
||||
echo "Rename deactivated outputting as ${FILEBASENAME}"
|
||||
OUTFILENAME="${FILEBASENAME}"
|
||||
elif [ "${RENAME}" == "true" ]; then
|
||||
OUTFILENAME="gitea"
|
||||
echo "Rename set to true, renaming to ${OUTFILENAME}"
|
||||
else
|
||||
# not using elif as busybox can't handle it...
|
||||
if [ "${RENAME}" == "true" ]; then
|
||||
OUTFILENAME="gitea"
|
||||
else
|
||||
OUTFILENAME="${RENAME}"
|
||||
fi
|
||||
echo "Rename target name provided, renaming to ${RENAME}"
|
||||
OUTFILENAME="${RENAME}"
|
||||
fi
|
||||
|
||||
FILE_WIHTOUT_PLATFORM="${FILEBASENAME}-${FILEVERSION}"
|
||||
|
||||
DOCKERDIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
DOCKERDIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 3; pwd -P )"
|
||||
WS_BASE="${DOCKERDIR%/docker}"
|
||||
|
||||
if [ ! -f "${DOCKERDIR}/archmap.txt" ]; then
|
||||
echo "no archmap found" 1>&2
|
||||
exit 1
|
||||
errcho "no archmap found"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
function map(){
|
||||
if [ ! -d "${DOCKERDIR}/bin" ]; then
|
||||
echo "Folder ${DOCKERDIR}/bin missing, creating it"
|
||||
mkdir -p "${DOCKERDIR}/bin"
|
||||
fi
|
||||
|
||||
map () {
|
||||
local file="${1}"
|
||||
local bin_platform="${file##./$FILE_WIHTOUT_PLATFORM-}"
|
||||
local bin_platform="${file##"./${FILE_WIHTOUT_PLATFORM}-"}"
|
||||
local platform
|
||||
echo "handling ${file} with detected bin_platform $bin_platform"
|
||||
if ! grep -q "$bin_platform" "${DOCKERDIR}/archmap.txt"; then
|
||||
echo "no matching platform for $file found" 2>&1
|
||||
errcho "no matching platform for $file found"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local platform="$(grep $bin_platform "${DOCKERDIR}/archmap.txt" | cut -d':' -f2)"
|
||||
mkdir -p "${DOCKERDIR}/bin/$platform"
|
||||
echo "Mapped ${file} to $platform, copying to ${DOCKERDIR}/bin/$platform/${OUTFILENAME}"
|
||||
platform="$(grep "$bin_platform" "${DOCKERDIR}/archmap.txt" | cut -d':' -f2)"
|
||||
echo "Docker platform parsed: $platform"
|
||||
if [ ! -d "${DOCKERDIR}/bin/$platform" ]; then
|
||||
echo "First item for this platform, creating directory \"${DOCKERDIR}/bin/$platform\""
|
||||
mkdir -p "${DOCKERDIR}/bin/$platform"
|
||||
fi
|
||||
echo "Mapped ${file} to $platform, copying to \"${DOCKERDIR}/bin/$platform/${OUTFILENAME}\""
|
||||
cp "${file}" "${DOCKERDIR}/bin/$platform/${OUTFILENAME}"
|
||||
}
|
||||
|
||||
cd "$WS_BASE/${BINARYLOOKUPPATH}"
|
||||
cd "$WS_BASE/${BINARYLOOKUPPATH}" || exit 5
|
||||
|
||||
while IFS= read -r -d $'\0' infile; do
|
||||
map "$infile"
|
||||
|
|
Loading…
Reference in New Issue