Skip to content

Commit

Permalink
Merge branch 'develop' into cli_test_migration
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankshampi committed Oct 27, 2024
2 parents 597e6ed + d99fdf1 commit 2bb6327
Show file tree
Hide file tree
Showing 211 changed files with 28,830 additions and 176 deletions.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ statusgo-cross: statusgo-android statusgo-ios
@echo "Full cross compilation done."
@ls -ld build/bin/statusgo-*

status-go-deps:
go install go.uber.org/mock/[email protected]
go install github.com/kevinburke/go-bindata/v4/[email protected]
go install google.golang.org/protobuf/cmd/[email protected]

statusgo-android: generate
statusgo-android: ##@cross-compile Build status-go for Android
@echo "Building status-go for Android..."
Expand Down Expand Up @@ -398,6 +403,7 @@ test-e2e: ##@tests Run e2e tests
test-e2e-race: export GOTEST_EXTRAFLAGS=-race
test-e2e-race: test-e2e ##@tests Run e2e tests with -race flag

test-functional: generate
test-functional: export FUNCTIONAL_TESTS_DOCKER_UID ?= $(call sh, id -u)
test-functional: export FUNCTIONAL_TESTS_REPORT_CODECOV ?= false
test-functional:
Expand All @@ -407,7 +413,10 @@ canary-test: node-canary
# TODO: uncomment that!
#_assets/scripts/canary_test_mailservers.sh ./config/cli/fleet-eth.prod.json

lint: generate
lint-panics: generate
go run ./cmd/lint-panics -root="$(call sh, pwd)" -skip=./cmd -test=false ./...

lint: generate lint-panics
golangci-lint run ./...

ci: generate lint canary-test test-unit test-e2e ##@tests Run all linters and tests at once
Expand Down
8 changes: 7 additions & 1 deletion _assets/ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library '[email protected].6'
library '[email protected].12'

pipeline {
agent { label 'linux' }
Expand Down Expand Up @@ -52,6 +52,12 @@ pipeline {
stage('Linux') { steps { script {
linux = jenkins.Build('status-go/platforms/linux')
} } }
stage('MacOS') { steps { script {
linux = jenkins.Build('status-go/platforms/macos')
} } }
stage('Windows') { steps { script {
linux = jenkins.Build('status-go/platforms/windows')
} } }
stage('Docker') { steps { script {
dock = jenkins.Build('status-go/platforms/docker')
} } }
Expand Down
5 changes: 4 additions & 1 deletion _assets/ci/Jenkinsfile.android
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pipeline {
post {
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup { sh 'make deep-clean' }
cleanup {
cleanWs()
dir("${env.WORKSPACE}@tmp") { deleteDir() }
}
} // post
} // pipeline
166 changes: 166 additions & 0 deletions _assets/ci/Jenkinsfile.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
#!/usr/bin/env groovy
library '[email protected]'

pipeline {
/* This way we run the same Jenkinsfile on different platforms. */
agent { label "${params.AGENT_LABEL}" }

parameters {
string(
name: 'BRANCH',
defaultValue: 'develop',
description: 'Name of branch to build.'
)
string(
name: 'AGENT_LABEL',
description: 'Label for targetted CI slave host.',
defaultValue: params.AGENT_LABEL ?: getAgentLabel(),
)
booleanParam(
name: 'RELEASE',
defaultValue: false,
description: 'Enable to create build for release.',
)
}

options {
timestamps()
ansiColor('xterm')
/* Prevent Jenkins jobs from running forever */
timeout(time: 15, unit: 'MINUTES')
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '5',
daysToKeepStr: '30',
artifactNumToKeepStr: '1',
))
}

environment {
PLATFORM = getPlatformFromLabel(params.AGENT_LABEL)
TMPDIR = "${WORKSPACE_TMP}"
GOPATH = "${WORKSPACE_TMP}/go"
GOCACHE = "${WORKSPACE_TMP}/gocache"
PATH = "${PATH}:${GOPATH}/bin:/c/Users/jenkins/go/bin"
REPO_SRC = "${GOPATH}/src/github.com/status-im/status-go"
VERSION = sh(script: "./_assets/scripts/version.sh", returnStdout: true)
ARTIFACT = utils.pkgFilename(
name: 'status-go',
type: env.PLATFORM,
version: env.VERSION,
ext: 'zip',
)
/* prevent sharing cache dir across different jobs */
GO_GENERATE_FAST_DIR = "${env.WORKSPACE_TMP}/go-generate-fast"
}

stages {
stage('Setup') {
steps {
script {
if (env.PLATFORM != 'windows') {
sh "mkdir -p \$(dirname ${REPO_SRC})"
sh "ln -s ${WORKSPACE} ${REPO_SRC}"
}
}
}
}

stage('Deps') {
steps { script {
shell('make status-go-deps')
}
}
}

stage('Generate') {
steps { script {
shell('make generate')
}
}
}

stage('Build Static Lib') {
steps {
script {
shell('make statusgo-library')
}
}
}

stage('Build Shared Lib') {
steps {
script {
shell('make statusgo-shared-library')
}
}
}

stage('Archive') {
steps {
zip zipFile: "${ARTIFACT}", archive: true, dir: 'build/bin'
}
}

stage('Upload') {
steps {
script {
env.PKG_URL = s5cmd.upload(ARTIFACT)
}
}
}
stage('Cleanup') {
steps {
script {
cleanTmp()
}
}
}
} // stages
post {
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup { cleanWs() }
} // post
} // pipeline

/* This allows us to use one Jenkinsfile and run
* jobs on different platforms based on job name. */
def getAgentLabel() {
if (params.AGENT_LABEL) { return params.AGENT_LABEL }
/* We extract the name of the job from currentThread because
* before an agent is picket env is not available. */
def tokens = Thread.currentThread().getName().split('/')
def labels = []
/* Check if the job path contains any of the valid labels. */
['linux', 'macos', 'windows', 'x86_64', 'aarch64', 'arm64'].each {
if (tokens.contains(it)) { labels.add(it) }
}
return labels.join(' && ')
}

/* This function extracts the platform from the AGENT_LABEL */
def getPlatformFromLabel(label) {
for (platform in ['linux', 'macos', 'windows']) {
if (label.contains(platform)) {
return platform
}
}
}

def shell(cmd) {
if (env.PLATFORM == 'windows') {
sh "${cmd} SHELL=/bin/sh"
} else {
nix.shell(cmd, pure: false) // Use nix.shell for Linux/macOS
}
}

def cleanTmp() {
if (env.PLATFORM == 'windows') {
sh "rm -rf ${env.WORKSPACE}@tmp"
} else {
dir("${env.WORKSPACE}@tmp") { deleteDir() }
}
}
5 changes: 4 additions & 1 deletion _assets/ci/Jenkinsfile.ios
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ pipeline {
post {
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
cleanup { sh 'make deep-clean' }
cleanup {
cleanWs()
dir("${env.WORKSPACE}@tmp") { deleteDir() }
}
} // post
} // pipeline
97 changes: 0 additions & 97 deletions _assets/ci/Jenkinsfile.linux

This file was deleted.

1 change: 1 addition & 0 deletions _assets/ci/Jenkinsfile.linux
1 change: 1 addition & 0 deletions _assets/ci/Jenkinsfile.macos
6 changes: 3 additions & 3 deletions _assets/ci/Jenkinsfile.tests
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ pipeline {
}
}
cleanup {
dir(env.TMPDIR) { deleteDir() }
sh "make git-clean"
cleanWs()
dir("${env.WORKSPACE}@tmp") { deleteDir() }
}
} // post
} // pipeline
Expand All @@ -254,4 +254,4 @@ def getDefaultUnitTestCount() { isNightlyJob() ? '20' : '1' }

def getDefaultTimeout() { isNightlyJob() ? 5*60 : 50 }

def getAmountToKeep() { isNightlyJob() ? '14' : isDevelopJob() ? '10' : '5' }
def getAmountToKeep() { isNightlyJob() ? '14' : isDevelopJob() ? '10' : '5' }
1 change: 1 addition & 0 deletions _assets/ci/Jenkinsfile.windows
Loading

0 comments on commit 2bb6327

Please sign in to comment.