diff options
Diffstat (limited to 'third_party/rust/raw-cpuid/ci')
-rw-r--r-- | third_party/rust/raw-cpuid/ci/before_deploy.ps1 | 23 | ||||
-rw-r--r-- | third_party/rust/raw-cpuid/ci/before_deploy.sh | 33 | ||||
-rw-r--r-- | third_party/rust/raw-cpuid/ci/install.sh | 47 | ||||
-rw-r--r-- | third_party/rust/raw-cpuid/ci/script.sh | 24 |
4 files changed, 127 insertions, 0 deletions
diff --git a/third_party/rust/raw-cpuid/ci/before_deploy.ps1 b/third_party/rust/raw-cpuid/ci/before_deploy.ps1 new file mode 100644 index 0000000000..191a30b88d --- /dev/null +++ b/third_party/rust/raw-cpuid/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/third_party/rust/raw-cpuid/ci/before_deploy.sh b/third_party/rust/raw-cpuid/ci/before_deploy.sh new file mode 100644 index 0000000000..026dc2898d --- /dev/null +++ b/third_party/rust/raw-cpuid/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/third_party/rust/raw-cpuid/ci/install.sh b/third_party/rust/raw-cpuid/ci/install.sh new file mode 100644 index 0000000000..80e18e4720 --- /dev/null +++ b/third_party/rust/raw-cpuid/ci/install.sh @@ -0,0 +1,47 @@ +set -ex + +main() { + local target= + if [ $TRAVIS_OS_NAME = linux ]; then + target=x86_64-unknown-linux-musl + sort=sort + else + target=x86_64-apple-darwin + sort=gsort # for `sort --sort-version`, from brew's coreutils. + fi + + # Builds for iOS are done on OSX, but require the specific target to be + # installed. + case $TARGET in + aarch64-apple-ios) + rustup target install aarch64-apple-ios + ;; + armv7-apple-ios) + rustup target install armv7-apple-ios + ;; + armv7s-apple-ios) + rustup target install armv7s-apple-ios + ;; + i386-apple-ios) + rustup target install i386-apple-ios + ;; + x86_64-apple-ios) + rustup target install x86_64-apple-ios + ;; + esac + + # This fetches latest stable release + local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ + | cut -d/ -f3 \ + | grep -E '^v[0.1.0-9.]+$' \ + | $sort --version-sort \ + | tail -n1) + curl -LSfs https://japaric.github.io/trust/install.sh | \ + sh -s -- \ + --force \ + --git japaric/cross \ + --tag $tag \ + --target $target +} + +main diff --git a/third_party/rust/raw-cpuid/ci/script.sh b/third_party/rust/raw-cpuid/ci/script.sh new file mode 100644 index 0000000000..ddd7f9362a --- /dev/null +++ b/third_party/rust/raw-cpuid/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 [ ! -z $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 |