summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rw-r--r--ci/before_deploy.ps123
-rw-r--r--ci/before_deploy.sh33
-rw-r--r--ci/install.sh24
-rw-r--r--ci/script.sh24
4 files changed, 104 insertions, 0 deletions
diff --git a/ci/before_deploy.ps1 b/ci/before_deploy.ps1
new file mode 100644
index 00000000..191a30b8
--- /dev/null
+++ b/ci/before_deploy.ps1
@@ -0,0 +1,23 @@
+# This script takes care of packaging the build artifacts that will go in the
+# release zipfile
+
+$SRC_DIR = $PWD.Path
+$STAGE = [System.Guid]::NewGuid().ToString()
+
+Set-Location $ENV:Temp
+New-Item -Type Directory -Name $STAGE
+Set-Location $STAGE
+
+$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
+
+# TODO Update this to package the right artifacts
+Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\hello.exe" '.\'
+
+7z a "$ZIP" *
+
+Push-AppveyorArtifact "$ZIP"
+
+Remove-Item *.* -Force
+Set-Location ..
+Remove-Item $STAGE
+Set-Location $SRC_DIR
diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh
new file mode 100644
index 00000000..026dc289
--- /dev/null
+++ b/ci/before_deploy.sh
@@ -0,0 +1,33 @@
+# This script takes care of building your crate and packaging it for release
+
+set -ex
+
+main() {
+ local src=$(pwd) \
+ stage=
+
+ case $TRAVIS_OS_NAME in
+ linux)
+ stage=$(mktemp -d)
+ ;;
+ osx)
+ stage=$(mktemp -d -t tmp)
+ ;;
+ esac
+
+ test -f Cargo.lock || cargo generate-lockfile
+
+ # TODO Update this to build the artifacts that matter to you
+ cross rustc --bin hello --target $TARGET --release -- -C lto
+
+ # TODO Update this to package the right artifacts
+ cp target/$TARGET/release/hello $stage/
+
+ cd $stage
+ tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
+ cd $src
+
+ rm -rf $stage
+}
+
+main
diff --git a/ci/install.sh b/ci/install.sh
new file mode 100644
index 00000000..4093c9b2
--- /dev/null
+++ b/ci/install.sh
@@ -0,0 +1,24 @@
+set -ex
+
+main() {
+ curl https://sh.rustup.rs -sSf | \
+ sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION
+
+ local target=
+ if [ $TRAVIS_OS_NAME = linux ]; then
+ target=x86_64-unknown-linux-gnu
+ else
+ target=x86_64-apple-darwin
+ fi
+
+ # TODO At some point you'll probably want to use a newer release of `cross`,
+ # simply change the argument to `--tag`.
+ curl -LSfs https://japaric.github.io/trust/install.sh | \
+ sh -s -- \
+ --force \
+ --git japaric/cross \
+ --tag v0.1.4 \
+ --target $target
+}
+
+main
diff --git a/ci/script.sh b/ci/script.sh
new file mode 100644
index 00000000..de1f77c5
--- /dev/null
+++ b/ci/script.sh
@@ -0,0 +1,24 @@
+# This script takes care of testing your crate
+
+set -ex
+
+# TODO This is the "test phase", tweak it as you see fit
+main() {
+ cross build --target $TARGET
+ cross build --target $TARGET --release
+
+ if [ -n $DISABLE_TESTS ]; then
+ return
+ fi
+
+ cross test --target $TARGET
+ cross test --target $TARGET --release
+
+ cross run --target $TARGET
+ cross run --target $TARGET --release
+}
+
+# we don't run the "test phase" when doing deploys
+if [ -z $TRAVIS_TAG ]; then
+ main
+fi