11version : 2
22
33jobs :
4+ # All checks on the codebase that can run in parallel to build_library
45 sanity :
56 docker :
67 # We don't use this Rust version but need an image with a Rust environment
@@ -25,11 +26,14 @@ jobs:
2526 - run :
2627 name : Run linter
2728 command : cargo clippy -- -D warnings
29+ - run :
30+ name : Run unit tests
31+ command : cargo test
2832 - run :
2933 name : Run shellcheck
3034 command : find . -name "*.sh" -exec shellcheck {} +
3135
32- build_libwasmvm :
36+ build_library :
3337 docker :
3438 # We don't use this Rust version but need an image with a Rust environment
3539 - image : circleci/rust:1.47.0-buster
4145 - run :
4246 name : Show version information
4347 command : rustc --version; cargo --version; rustup --version
44- - run :
45- name : Run tests
46- command : cargo test
4748 - run :
4849 name : Create release build of libwasmvm
4950 command : make build-rust
@@ -115,15 +116,53 @@ jobs:
115116 git commit --allow-empty -m '[skip ci] Built release libraries'
116117 git push origin $CIRCLE_BRANCH
117118
119+ deploy_to_github_releases :
120+ machine :
121+ image : ubuntu-1604:202010-01
122+ steps :
123+ - checkout
124+ - run :
125+ name : Install ghr
126+ command : |
127+ go get github.com/tcnksm/ghr
128+ ghr --version
129+ - run :
130+ name : Build static library for Alpine
131+ command : make release-build-alpine
132+ - run :
133+ name : Debug build results
134+ command : ls -l ./api
135+ - run :
136+ name : Collect artifacts
137+ command : |
138+ mkdir artifacts
139+ cp ./api/libwasmvm_muslc.a artifacts
140+ - run :
141+ name : Create checksums
142+ working_directory : artifacts
143+ command : sha256sum * > checksums.txt && cat checksums.txt
144+ - run :
145+ name : Publish artifacts on GitHub
146+ command : |
147+ TAG="$CIRCLE_TAG"
148+ TITLE="$TAG"
149+ BODY="Build artifacts generated at this tag."
150+ ghr -t "$GITHUB_TOKEN" \
151+ -u "$CIRCLE_PROJECT_USERNAME" -r "$CIRCLE_PROJECT_REPONAME" \
152+ -c "$CIRCLE_SHA1" \
153+ -n "$TITLE" -b "$BODY" \
154+ -delete \
155+ "$TAG" ./artifacts/
156+
118157workflows :
119158 version : 2
120159 build_and_test :
121160 jobs :
122161 - sanity
123- - build_libwasmvm
162+ - build_library
124163 - test :
125164 requires :
126- - build_libwasmvm
165+ - build_library
127166 # This is long running, so only double-check on merge commits
128167 # ensures that all code works on alpine linux
129168 - test_alpine_build :
@@ -136,10 +175,22 @@ workflows:
136175 - master
137176 # Run only on master, not on tags (auto-build on merge PR)
138177 - deploy_to_git :
178+ requires :
179+ - sanity
180+ - test
139181 filters :
140182 tags :
141183 ignore :
142184 - /.*/
143185 branches :
144186 only :
145187 - master
188+ - deploy_to_github_releases :
189+ requires :
190+ - sanity
191+ - test
192+ filters :
193+ tags :
194+ only : /^v[0-9]+\.[0-9]+\.[0-9]+.*/
195+ branches :
196+ ignore : /.*/
0 commit comments