Newer
Older
before_script:
- go version || echo "Go executable not found."
- echo $CI_BUILD_REF
- echo $CI_PROJECT_DIR
- echo $PWD
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -t rsa $GITLAB_SERVER > ~/.ssh/known_hosts
- rm -rf ~/.gitconfig
- git config --global url."git@$GITLAB_SERVER:".insteadOf "https://gitlab.com/"
- git config --global url."git@$GITLAB_SERVER:".insteadOf "https://git.xx.network/" --add
- export PATH=$HOME/go/bin:$PATH

Jono Wenger
committed
stages:

Jono Wenger
committed
- build

Jono Wenger
committed
- unset $(env | grep '=' | awk -F= '{print $1}' | grep -v PATH | grep -v GO | grep -v HOME)

Jono Wenger
committed
- GOOS=js GOARCH=wasm go test ./... -v

Jono Wenger
committed
script:
- go mod vendor -v
- mkdir -p release
- GOOS=js GOARCH=wasm go build -ldflags '-w -s' -trimpath -o release/xxdk.wasm main.go
- cp wasm_exec.js release/
artifacts:
paths:
- release/
- go mod vendor -v
- mkdir -p release
- GOOS=js GOARCH=wasm go build -ldflags '-w -s' -trimpath -o release/xxdk-channelsIndexedDkWorker.wasm ./indexedDb/impl/channels/...
- GOOS=js GOARCH=wasm go build -ldflags '-w -s' -trimpath -o release/xxdk-dmIndexedDkWorker.wasm ./indexedDb/impl/dm/...
- cp indexedDb/impl/channels/channelsIndexedDbWorker.js release/
- cp indexedDb/impl/dm/dmIndexedDbWorker.js release/
artifacts:
paths:
- release/
image: $DOCKER_IMAGE
script:
- git remote add origin_tags git@$GITLAB_SERVER:elixxir/xxdk-wasm.git || true
- GOOS=js GOARCH=wasm go build -ldflags '-w -s' -o release/xxdk.wasm main.go
- git tag $(sha256sum release/xxdk.wasm | awk '{ print $1 }') -f
- git push origin_tags -f --tags
combine-artifacts:
stage: combine-artifacts
except:
- tags
image: $DOCKER_IMAGE
script:
- echo $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs
- 'PIPELINE_JOBS=$(curl --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs)'
- echo $PIPELINE_JOBS
- BUILD_JOB_JSON=$(echo $PIPELINE_JOBS | jq '.[] | select(.name=="build")')
- BUILD_WORKERS_JOB_JSON=$(echo $PIPELINE_JOBS | jq '.[] | select(.name=="build-workers")')
- BUILD_JOB_ID=$(echo $BUILD_JOB_JSON | jq -r '.["id"]')
- BUILD_WORKERS_JOB_ID=$(echo $BUILD_WORKERS_JOB_JSON | jq -r '.["id"]')
- rm -rf release
- mkdir -p release
- 'curl --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" --output release/wasm_exec.js $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$BUILD_JOB_ID/artifacts/release/wasm_exec.js'
- 'curl --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" --output release/xxdk.wasm $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$BUILD_JOB_ID/artifacts/release/xxdk.wasm'
- 'curl --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" --output release/xxdk-channelsIndexedDkWorker.wasm $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$BUILD_WORKERS_JOB_ID/artifacts/release/xxdk-channelsIndexedDkWorker.wasm'
- 'curl --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" --output release/xxdk-dmIndexedDkWorker.wasm $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$BUILD_WORKERS_JOB_ID/artifacts/release/xxdk-dmIndexedDkWorker.wasm'
- 'curl --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" --output release/channelsIndexedDbWorker.js $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$BUILD_WORKERS_JOB_ID/artifacts/release/channelsIndexedDbWorker.js'
- 'curl --header "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" --output release/dmIndexedDbWorker.js $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$BUILD_WORKERS_JOB_ID/artifacts/release/dmIndexedDbWorker.js'
- ls release
artifacts:
paths:
- release/
expose_as: "release"
# This pipeline job will attempt to have pkg.go.dev update docs for xxdk-wasm.
#
# pkg.go.dev relies on the proxy.golang.org service (go module cache/proxy) to
# discover versions of Go modules to make docs of. The proxy keeps a list of all
# known versions of Go modules. The go mod proxy does cache pulls for about 30
# minutes, so if quickly successive commits are done in master/release, this
# will fail to pull the latest client, and the docs will not update.
image: $DOCKER_IMAGE
script:
# We use GOPRIVATE blank because not want to directly pull client, we want to use the public cache.
- GOOS=js GOARCH=wasm GOPRIVATE="" go install gitlab.com/elixxir/xxdk-wasm@$CI_COMMIT_SHA
version_check:
stage: version_check
except:
- tags
only:
- master
image: $DOCKER_IMAGE
script:
- GITTAG=$(git describe --tags)
- CODEVERS=$(cat storage/version.go | grep "const SEMVER =" | cut -d ' ' -f4 | tr -d '"')
- if [[ $GITTAG != $CODEVERS ]]; then echo "VERSION NUMBER BAD $GITTAG != $CODEVERS"; exit -1; fi