Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix bin builds #546

Merged
merged 30 commits into from
Jan 5, 2023
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7f227cc
ci: comment out other jobs than linux bins
oddgrd Dec 20, 2022
3054be6
ci: try without tag
oddgrd Dec 20, 2022
6bc55b9
feat: set git tag with git describe
oddgrd Dec 21, 2022
d39bd2c
feat: echo tag in CI for debugging
oddgrd Dec 21, 2022
b266230
fix: set tag earlier for testing
oddgrd Dec 21, 2022
655e8a1
ci: echo artifacts directory
oddgrd Dec 21, 2022
04f0e27
ci: pass tag via parameters
oddgrd Dec 21, 2022
47a552c
ci: move artifacts in target sub directory
oddgrd Dec 21, 2022
75386b9
ci: create artifacts subdir
oddgrd Dec 21, 2022
4a6408a
ci: test draft release
oddgrd Dec 21, 2022
c23b01f
ci: authenticate ghr
oddgrd Dec 21, 2022
bd27b73
ci: try with symlink
oddgrd Dec 21, 2022
c718c8c
ci: revert symlink, cp bins from subdirs before release
oddgrd Dec 21, 2022
177952e
ci: flatten artifacts dir before releasing
oddgrd Dec 22, 2022
59a9e96
ci: set-tag command
oddgrd Dec 22, 2022
7452410
ci: fix invalid config
oddgrd Dec 22, 2022
b370f2a
fix: invalid config
oddgrd Dec 22, 2022
21dda2e
ci: test if artifacts flattening command works for win bin
oddgrd Dec 22, 2022
dcf4012
ci: enable linux bin build too
oddgrd Dec 22, 2022
dc9c4f5
ci: remove environment field
oddgrd Jan 3, 2023
2c83052
ci: check artifacts dir structure
oddgrd Jan 3, 2023
b49f6f4
ci: tweak ghr command and verify tag is set
oddgrd Jan 3, 2023
05699ad
ci: include tag in make-artifact env
oddgrd Jan 3, 2023
40c406f
fix: invalid command
oddgrd Jan 3, 2023
4764cf2
fix: incorrect path to bash.env
oddgrd Jan 3, 2023
5a1cf52
ci: set tag in env in preceding step
oddgrd Jan 3, 2023
5fd7c14
ci: clean up, add comments
oddgrd Jan 3, 2023
bea460b
fix: rm path
oddgrd Jan 3, 2023
e420693
ci: re-enable all workflows, remove tag filters
oddgrd Jan 3, 2023
32225fe
fix: formatting
oddgrd Jan 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 81 additions & 77 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,27 @@ commands:
type: string
default: ""
steps:
- run:
name: Set git tag in the environment"
command: |
echo TAG=$(git describe --tags) >> $BASH_ENV
- run:
name: Make artifact
command: |
mkdir shuttle
mv target/<< parameters.target >>/release/cargo-shuttle<< parameters.suffix >> shuttle/cargo-shuttle<< parameters.suffix >>
mv LICENSE shuttle/
mv README.md shuttle/
mkdir artifacts
tar -cvzf artifacts/cargo-shuttle-${CIRCLE_TAG}-<< parameters.target >>.tar.gz shuttle
mkdir -p artifacts/<< parameters.target >>
cp $BASH_ENV artifacts/bash.env
tar -cvzf artifacts/<< parameters.target >>/cargo-shuttle-$TAG-<< parameters.target >>.tar.gz shuttle
# Persist the bash environment to the workspace as well, we need it for the release job.
# https://discuss.circleci.com/t/share-environment-variable-between-different-job/45647/4
- persist_to_workspace:
root: artifacts
paths:
- cargo-shuttle-${CIRCLE_TAG}-<< parameters.target >>.tar.gz
- << parameters.target >>/*
- bash.env

jobs:
workspace-fmt:
Expand Down Expand Up @@ -353,98 +361,94 @@ jobs:
steps:
- attach_workspace:
at: artifacts
- run:
name: "Set tag in environment"
command: |
cat artifacts/bash.env >> "$BASH_ENV"
rm artifacts/bash.env
- run:
name: "Publish Release on GitHub"
environment:
GITHUB_TOKEN: $GITHUB_TOKEN
oddgrd marked this conversation as resolved.
Show resolved Hide resolved
# Since each binary is in a sub directory named after its target, we flatten
# the artifacts directory before passing it to ghr
command: |
find artifacts -mindepth 2 -type f -exec mv -t artifacts {} +
go install github.com/tcnksm/ghr@v0.16.0
ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -draft ${CIRCLE_TAG} artifacts/
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -draft ${TAG} ./artifacts/

workflows:
version: 2
ci:
jobs:
- workspace-fmt
- workspace-clippy:
name: workspace-clippy-<< matrix.framework >>
requires:
- workspace-fmt
matrix:
parameters:
framework: ["web-actix-web", "web-axum", "web-rocket", "web-poem", "web-thruster", "web-tide", "web-tower","web-warp", "web-salvo", "bot-serenity"]
- check-standalone:
matrix:
parameters:
path:
- resources/aws-rds
- resources/persist
- resources/secrets
- resources/shared-db
- resources/static-folder
- service-test:
requires:
- workspace-clippy
- platform-test:
requires:
- workspace-clippy
matrix:
parameters:
crate: ["shuttle-deployer", "cargo-shuttle", "shuttle-codegen", "shuttle-common", "shuttle-proto", "shuttle-provisioner"]
- e2e-test:
requires:
- service-test
- platform-test
- check-standalone
filters:
branches:
only: production
- build-and-push:
requires:
- e2e-test
- workspace-fmt
- workspace-clippy:
name: workspace-clippy-<< matrix.framework >>
requires:
- workspace-fmt
matrix:
parameters:
framework: ["web-actix-web", "web-axum", "web-rocket", "web-poem", "web-thruster", "web-tide", "web-tower","web-warp", "web-salvo", "bot-serenity"]
- check-standalone:
matrix:
parameters:
path:
- resources/aws-rds
- resources/persist
- resources/secrets
- resources/shared-db
- resources/static-folder
- service-test:
requires:
- workspace-clippy
- platform-test:
requires:
- workspace-clippy
matrix:
parameters:
crate: ["shuttle-deployer", "cargo-shuttle", "shuttle-codegen", "shuttle-common", "shuttle-proto", "shuttle-provisioner"]
- e2e-test:
requires:
- service-test
- platform-test
- check-standalone
filters:
branches:
only: production
- build-and-push:
requires:
- e2e-test
filters:
branches:
only: production
- build-binaries-linux:
name: build-binaries-x86_64
image: ubuntu-2204:2022.04.1
target: x86_64-unknown-linux-musl
resource_class: medium
filters:
branches:
only: production
- build-binaries-linux:
name: build-binaries-aarch64
image: ubuntu-2004:202101-01
target: aarch64-unknown-linux-musl
resource_class: arm.medium
filters:
branches:
only: production
- build-binaries-windows:
filters:
branches:
only: production
- build-binaries-linux:
name: build-binaries-x86_64
image: ubuntu-2204:2022.04.1
target: x86_64-unknown-linux-musl
resource_class: medium
- build-binaries-mac:
filters:
tags:
only: /^v.*/
branches:
only: production
- build-binaries-linux:
name: build-binaries-aarch64
image: ubuntu-2004:202101-01
target: aarch64-unknown-linux-musl
resource_class: arm.medium
filters:
tags:
only: /^v.*/
branches:
only: production
- build-binaries-windows:
filters:
tags:
only: /^v.*/
branches:
only: production
- build-binaries-mac:
filters:
tags:
only: /^v.*/
branches:
only: production
- publish-github-release:
only: production
- publish-github-release:
requires:
- build-binaries-x86_64
- build-binaries-aarch64
- build-binaries-windows
- build-binaries-mac
filters:
tags:
only: /^v.*/
branches:
only: production
only: production