Skip to content

Commit

Permalink
add ci job
Browse files Browse the repository at this point in the history
  • Loading branch information
samo3l committed Aug 9, 2023
1 parent 2a2aa5f commit 7f98b09
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
54 changes: 26 additions & 28 deletions .ci/Jenkinsfile.gosh-tools-prepare-rc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pipeline {
git branch: "${COMMIT}", url: 'https://github.com/gosh-sh/anytree.git'
checkout scm
script {
env.APP_VERSION = sh(script: " grep -m1 version gosh/Cargo.toml | awk '{print \$NF}' | tr -d '\"' ", returnStdout: true).trim()
env.APP_VERSION = sh(script: " grep -m1 version anytree/Cargo.toml | awk '{print \$NF}' | tr -d '\"' ", returnStdout: true).trim()
currentBuild.displayName = "${BUILD_NUMBER}_${COMMIT}_${APP_VERSION}"
}
}
Expand Down Expand Up @@ -99,28 +99,26 @@ pipeline {
def buildGoshCli() {
script {
if (!params.ONLY_IMAGES) {
dir('gosh') {
sh '''
#!/bin/bash
set -ex

# 3 = gosh
PIPELINE_3_ID=$(az pipelines build queue --definition-id 3 --branch \${COMMIT} --project gosh | jq .id)
PIPELINE_3_STATUS=inProgress

until [ \$PIPELINE_3_STATUS = "completed" ]
do
sleep 60
PIPELINE_3_STATUS=$(az pipelines build show --project gosh --id $PIPELINE_3_ID | jq .status | tr -d '\"')
done

cd ${WORKSPACE}
rm -rf linux-*

az pipelines runs artifact download --project gosh --artifact-name linux-amd64 --run-id $PIPELINE_3_ID --path linux-amd64 && sleep 2
az pipelines runs artifact download --project gosh --artifact-name linux-arm64 --run-id $PIPELINE_3_ID --path linux-arm64 && sleep 2
'''
}
sh '''
#!/bin/bash
set -ex

# 3 = gosh
PIPELINE_3_ID=$(az pipelines build queue --definition-id 3 --branch \${COMMIT} --project gosh | jq .id)
PIPELINE_3_STATUS=inProgress

until [ \$PIPELINE_3_STATUS = "completed" ]
do
sleep 60
PIPELINE_3_STATUS=$(az pipelines build show --project gosh --id $PIPELINE_3_ID | jq .status | tr -d '\"')
done

cd ${WORKSPACE}
rm -rf linux-*

az pipelines runs artifact download --project gosh --artifact-name linux-amd64 --run-id $PIPELINE_3_ID --path linux-amd64 && sleep 2
az pipelines runs artifact download --project gosh --artifact-name linux-arm64 --run-id $PIPELINE_3_ID --path linux-arm64 && sleep 2
'''
}
}
}
Expand All @@ -132,11 +130,11 @@ def archiveAzureArtifacts() {
#!/bin/bash
set -ex

rm -rf gosh-*.tar.gz
rm -rf anytree-*.tar.gz
chmod +x linux-a*/*

tar -czvf gosh-linux-amd64.tar.gz -C linux-amd64 $(ls -A linux-amd64)
tar -czvf gosh-linux-arm64.tar.gz -C linux-arm64 $(ls -A linux-arm64)
tar -czvf anytree-linux-amd64.tar.gz -C linux-amd64 $(ls -A linux-amd64)
tar -czvf anytree-linux-arm64.tar.gz -C linux-arm64 $(ls -A linux-arm64)
'''
}
}
Expand All @@ -148,8 +146,8 @@ def prereleaseBinaries() {
dir('.ci/scripts') {
withCredentials([string(credentialsId: 'github-gosh-release', variable: 'TOKEN')]) {
sh './create-github-release.sh $TOKEN ${APP_VERSION} ${COMMIT}'
sh './github-upload-assets.sh $TOKEN ${APP_VERSION} /tmp/${JOB_NAME}/gosh-linux-amd64.tar.gz application/gzip'
sh './github-upload-assets.sh $TOKEN ${APP_VERSION} /tmp/${JOB_NAME}/gosh-linux-arm64.tar.gz application/gzip'
sh './github-upload-assets.sh $TOKEN ${APP_VERSION} /tmp/${JOB_NAME}/anytree-linux-amd64.tar.gz application/gzip'
sh './github-upload-assets.sh $TOKEN ${APP_VERSION} /tmp/${JOB_NAME}/anytree-linux-arm64.tar.gz application/gzip'
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions .ci/azure/gosh-cli-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ strategy:
matrix:
linux:
imageName: ubuntu-20.04
binName: gosh
binName: anytree
artifactNameAmd: linux-amd64
maxParallel: 3

Expand Down Expand Up @@ -43,11 +43,11 @@ steps:
# Linux
- script: |
set -ex
cargo build --release --bin gosh
cargo build --release --bin anytree
sudo apt update -y
sudo apt install -y build-essential g++-x86-64-linux-gnu libc6-dev-amd64-cross g++-aarch64-linux-gnu libc6-dev-arm64-cross gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnu --bin gosh
cargo build --release --target aarch64-unknown-linux-gnu --bin anytree
env:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: x86_64-linux-gnu-gcc
CC_x86_64_unknown_linux_gnu: x86_64-linux-gnu-gcc
Expand Down

0 comments on commit 7f98b09

Please sign in to comment.