Skip to content

Commit

Permalink
ci: pipeline to attach windows binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Aug 1, 2023
1 parent bc8fa3c commit e3df165
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 12 deletions.
118 changes: 106 additions & 12 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ groups:
jobs:
- check-code
- release
- publish-to-crates
- set-dev-version

jobs:
Expand Down Expand Up @@ -63,34 +64,127 @@ jobs:
- name: repo
run:
path: pipeline-tasks/ci/tasks/update-repo.sh
- task: publish-to-crates
- in_parallel:
- task: build-windows-release
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
username: #@ data.values.osxcross_docker_username
password: #@ data.values.osxcross_docker_password
repository: #@ data.values.osxcross_repository
inputs:
- name: version
- name: pipeline-tasks
- name: repo
outputs:
- name: x86_64-pc-windows-gnu
caches:
- path: cargo-home
- path: cargo-target-dir
params:
TARGET: x86_64-pc-windows-gnu
OUT: x86_64-pc-windows-gnu
run:
path: pipeline-tasks/ci/tasks/build-release.sh
- task: build-osx-release
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
username: #@ data.values.osxcross_docker_username
password: #@ data.values.osxcross_docker_password
repository: #@ data.values.osxcross_repository
inputs:
- name: version
- name: pipeline-tasks
- name: repo
outputs:
- name: x86_64-apple-darwin
caches:
- path: cargo-home
- path: cargo-target-dir
params:
TARGET: x86_64-apple-darwin
OUT: x86_64-apple-darwin
run:
path: pipeline-tasks/ci/tasks/build-release.sh
- task: build-static-release
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source: { repository: clux/muslrust, tag: stable }
inputs:
- name: version
- name: pipeline-tasks
- name: repo
outputs:
- name: x86_64-unknown-linux-musl
caches:
- path: cargo-home
- path: cargo-target-dir
params:
TARGET: x86_64-unknown-linux-musl
OUT: x86_64-unknown-linux-musl
run:
path: pipeline-tasks/ci/tasks/build-release.sh
- task: prep-github-release
config:
image_resource: #@ rust_task_image_config()
image_resource: #@ release_task_image_config()
platform: linux
inputs:
- name: x86_64-pc-windows-gnu
- name: x86_64-apple-darwin
- name: x86_64-unknown-linux-musl
- name: version
- name: pipeline-tasks
- name: repo
params:
CRATES_API_TOKEN: #@ data.values.crates_api_token
caches:
- path: cargo-home
- path: cargo-target-dir
- name: artifacts
outputs:
- name: artifacts
run:
path: pipeline-tasks/ci/tasks/publish-to-crates.sh
path: pipeline-tasks/ci/tasks/prep-github-release.sh
- put: repo
params:
tag: artifacts/gh-release-tag
repository: repo
merge: true
- put: version
params:
file: version/version
- put: gh-release
params:
name: artifacts/gh-release-name
tag: artifacts/gh-release-tag
body: artifacts/gh-release-notes.md
globs: [artifacts/binaries/*]
- put: version
params:
file: version/version

- name: publish-to-crates
plan:
- in_parallel:
- { get: repo, passed: [release], trigger: true }
- get: pipeline-tasks
- get: version
- task: publish-to-crates
config:
image_resource: #@ rust_task_image_config()
platform: linux
inputs:
- name: version
- name: pipeline-tasks
- name: repo
params:
CRATES_API_TOKEN: #@ data.values.crates_api_token
caches:
- path: cargo-home
- path: cargo-target-dir
run:
path: pipeline-tasks/ci/tasks/publish-to-crates.sh

- name: set-dev-version
plan:
Expand Down
33 changes: 33 additions & 0 deletions ci/tasks/build-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -eu

VERSION=""
if [[ -f version/version ]];then
VERSION="$(cat version/version)"
fi

REPO=${REPO:-repo}
BINARY=bria
OUT=${OUT:-none}
WORKSPACE="$(pwd)"

export CARGO_HOME="$(pwd)/cargo-home"
export CARGO_TARGET_DIR="$(pwd)/cargo-target-dir"

[ -f /workspace/.cargo/config ] && cp /workspace/.cargo/config ${CARGO_HOME}/config

pushd ${REPO}

set -x

make build-${TARGET}-release

cd ${CARGO_TARGET_DIR}/${TARGET}/release
OUT_DIR="${BINARY}-${TARGET}-${VERSION}"
rm -rf "${OUT_DIR}" || true
mkdir "${OUT_DIR}"
mv ./${BINARY} ${OUT_DIR}
tar -czvf ${OUT_DIR}.tar.gz ${OUT_DIR}

mv ${OUT_DIR}.tar.gz ${WORKSPACE}/${OUT}/
16 changes: 16 additions & 0 deletions ci/tasks/prep-github-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -eu

mkdir artifacts/binaries

mv x86_64-pc-windows-gnu/* artifacts/binaries
mv x86_64-apple-darwin/* artifacts/binaries
mv x86_64-unknown-linux-musl/* artifacts/binaries

for file in artifacts/binaries/*; do
if [ -f "$file" ]; then
sha256sum "$file" > "$file".sha256
fi
done

4 changes: 4 additions & 0 deletions ci/values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ crates_api_token: ((crates.token))
slack_channel: galoy-cli-github
slack_username: concourse
slack_webhook_url: ((addons-slack.api_url))

osxcross_docker_username: ((osxcross-image.username))
osxcross_docker_password: ((osxcross-image.password))
osxcross_repository: ((osxcross-image.repository))

0 comments on commit e3df165

Please sign in to comment.