-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add statically linked binary for GitHub Release (#3)
* Allow auto-publishing when there is new tag * Bump version and change to tfzignore * Fix travis build issue * Fix missing .env-build file
- Loading branch information
Showing
9 changed files
with
123 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
HOME=/volume |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,91 @@ | ||
language: rust | ||
|
||
env: | ||
global: | ||
- BINARY_NAME=terraform-zap | ||
- REPO_USERNAME=guangie88 | ||
- REPO_NAME=terraform-zap | ||
|
||
matrix: | ||
include: | ||
- services: docker | ||
env: | ||
- LINT=true | ||
- services: docker | ||
env: | ||
- COVERAGE=true | ||
- rust: stable | ||
sudo: false | ||
env: | ||
- DOC=true | ||
- rust: stable | ||
sudo: false | ||
- rust: beta | ||
sudo: false | ||
- rust: nightly | ||
sudo: false | ||
- services: docker | ||
env: | ||
- LINT=true | ||
- PUBLISH=true | ||
- services: docker | ||
env: | ||
- ARTIFACT=true | ||
- ARTIFACTS_DIR=./artifacts | ||
- services: docker | ||
env: | ||
- COVERAGE=true | ||
- rust: stable | ||
sudo: false | ||
- rust: beta | ||
sudo: false | ||
- rust: nightly | ||
sudo: false | ||
fast_finish: true | ||
|
||
before_script: | ||
- set -e | ||
- | | ||
if [ "$LINT" = "true" ]; then | ||
docker-compose -f docker-compose.lint-test.yml build lint-test | ||
elif [ "$COVERAGE" = "true" ]; then | ||
echo "Coverage does not deal with before_script" | ||
elif [ "$DOC" = "true" ]; then | ||
echo "Doc does not deal with before_script" | ||
else | ||
cargo test --all --no-run --verbose | ||
fi | ||
- set -e | ||
- | | ||
if [ "$LINT" = "true" ]; then | ||
docker-compose -f docker-compose.lint-test.yml build lint-test | ||
elif [ "$ARTIFACT" = "true" ]; then | ||
echo "Artifact not dealing with 'before_script'" | ||
elif [ "$COVERAGE" = "true" ]; then | ||
echo "Coverage not dealing with 'before_script'" | ||
else | ||
cargo test --all --no-run --verbose | ||
fi | ||
script: | ||
- | | ||
if [ "$LINT" = "true" ]; then | ||
docker-compose -f docker-compose.lint-test.yml run lint-test | ||
elif [ "$COVERAGE" = "true" ]; then | ||
echo "Coverage does not deal with script" | ||
elif [ "$DOC" = "true" ]; then | ||
cargo doc --all | ||
else | ||
cargo test --all --verbose | ||
fi | ||
- | | ||
if [ "$LINT" = "true" ]; then | ||
docker-compose -f docker-compose.lint-test.yml run lint-test | ||
elif [ "$ARTIFACT" = "true" ]; then | ||
docker-compose -f docker-compose.build.yml run -u $UID:`id -g` build | ||
mkdir $ARTIFACTS_DIR | ||
cp ./target/x86_64-unknown-linux-musl/release/$BINARY_NAME $ARTIFACTS_DIR | ||
elif [ "$COVERAGE" = "true" ]; then | ||
echo "Coverage not dealing with 'script'" | ||
else | ||
cargo doc --all | ||
cargo test --all --verbose | ||
fi | ||
after_success: | ||
- | | ||
if [ "$COVERAGE" = "true" ]; then | ||
docker run --security-opt seccomp=unconfined -v "$PWD:/volume" \ | ||
guangie88/ubuntu-cargo-tarpaulin:xenial-stable " | ||
cargo tarpaulin --all --out Xml \ | ||
&& bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN" | ||
fi | ||
- | | ||
if [ "$PUBLISH" = "true" ] && [ -n "$TRAVIS_TAG" ]; then | ||
# publish when this is a new tag | ||
cargo login "$CRATES_TOKEN" | ||
cargo publish | ||
elif [ "$ARTIFACT" = "true" ] && [ -n "$TRAVIS_TAG" ]; then | ||
# upload binary artifact when this is a new tag | ||
# this needs to be jq processed to extract out the `id` value | ||
export TAG_ID=$(curl -X GET \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
"https://api.github.com/repos/$REPO_USERNAME/$REPO_NAME/releases" \ | ||
| jq -r '.[] | select(.tag_name == "'$TRAVIS_TAG'").id') | ||
# formulate zip | ||
export ZIP_FILE=$BINARY_NAME-$TRAVIS_TAG.zip | ||
zip -j $ZIP_FILE "$ARTIFACTS_DIR/$BINARY_NAME" | ||
curl -X POST \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/zip" \ | ||
--upload-file $ZIP_FILE \ | ||
"https://uploads.github.com/repos/$REPO_USERNAME/$REPO_NAME/releases/$TAG_ID/assets?name=$ZIP_FILE" | ||
elif [ "$COVERAGE" = "true" ] && [ -z "$TRAVIS_TAG" ]; then | ||
docker run --security-opt seccomp=unconfined -v "$PWD:/volume" \ | ||
guangie88/ubuntu-cargo-tarpaulin:xenial-stable " | ||
cargo tarpaulin --all --out Xml \ | ||
&& bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN" | ||
fi | ||
branches: | ||
only: | ||
- master | ||
- master | ||
- /^v\d+\.\d+\.\d+(-\S*)?$/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "terraform-zap" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
authors = ["Chen Weiguang <[email protected]>"] | ||
description = "Script wrapper to perform finer terraform destroy" | ||
repository = "https://github.com/guangie88/terraform-zap" | ||
|
@@ -19,7 +19,7 @@ is_executable = "=0.1.0" | |
structopt = "=0.2.7" | ||
structopt-derive = "=0.2.7" | ||
subprocess = "=0.1.12" | ||
terraform-zap-ignore-lib = { path = "ignore-lib", version = "0.1.0" } | ||
terraform-zap-ignore-lib = { path = "ignore-lib", version = "0.2.0" } | ||
toml = "=0.4.6" | ||
which = "=2.0.0" | ||
whiteread = "=0.4.3" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '2' | ||
services: | ||
build: | ||
image: 'clux/muslrust:stable' | ||
command: | ||
- cargo | ||
- build | ||
- '--release' | ||
volumes: | ||
- '.:/volume' | ||
env_file: .env-build | ||
clean: | ||
image: 'clux/muslrust:stable' | ||
command: | ||
- cargo | ||
- clean | ||
volumes: | ||
- '.:/volume' | ||
env_file: .env-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "terraform-zap-ignore-lib" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
authors = ["Chen Weiguang <[email protected]>"] | ||
description = "Provides ignore implementation to terraform-zap" | ||
documentation = "https://docs.rs/terraform-zap-ignore-lib" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters