language: shell
git:
depth: 1
lfs_skip_smudge: true
notifications:
email:
false
cache:
cargo: true
directories:
- registry
- target
stages:
- name: tools
if: tag IS NOT present
- test
- documentation
- name: release
if: tag IS present
install: |
if [[ ! -z "$CUSTOM_TARGET" ]]; then
OPTIONS="$OPTIONS --target $CUSTOM_TARGET"
TARGET=$CUSTOM_TARGET
fi
if [[ $TRAVIS_OS_NAME = linux ]]; then
mkdir -p registry
mkdir -p target
docker pull astralengine/$TARGET:$TOOLCHAIN
run() {
docker run \
--rm \
--init \
--user "$(id -u)":"$(id -g)" \
--volume `pwd`/registry:/usr/local/cargo/registry \
--volume `pwd`:/usr/src/$TRAVIS_REPO_SLUG \
--workdir /usr/src/$TRAVIS_REPO_SLUG \
astralengine/$TARGET:$TOOLCHAIN "$@"
}
else
run() {
"$@"
}
fi
script: |
run cargo test --features "$FEATURES" $OPTIONS --all
matrix:
fast_finish: true
allow_failures:
- os: windows
include:
- name: x86_64-unknown-linux-gnu - stable
env: TARGET=x86_64-unknown-linux-gnu TOOLCHAIN=stable
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: x86_64-unknown-linux-gnu - beta
env: TARGET=x86_64-unknown-linux-gnu TOOLCHAIN=beta
if: type != api OR commit_message =~ beta
- name: x86_64-unknown-linux-gnu - nightly
env: TARGET=x86_64-unknown-linux-gnu TOOLCHAIN=nightly
if: type != api OR commit_message =~ nightly
- name: i686-unknown-linux-gnu - stable
env: TARGET=i686-unknown-linux-gnu TOOLCHAIN=stable
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: i686-unknown-linux-gnu - beta
env: TARGET=i686-unknown-linux-gnu TOOLCHAIN=beta
if: type != api OR commit_message =~ beta
- name: i686-unknown-linux-gnu - nightly
env: TARGET=i686-unknown-linux-gnu TOOLCHAIN=nightly
if: type != api OR commit_message =~ nightly
- name: x86_64-apple-darwin - stable
os: osx
language: rust
rust: stable-x86_64-apple-darwin
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: i686-apple-darwin - stable
os: osx
language: rust
rust: stable-i686-apple-darwin
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: x86_64-pc-windows - stable
os: windows
language: rust
rust: stable-x86_64-pc-windows-msvc
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: i686-pc-windows - stable
os: windows
language: rust
rust: stable-i686-pc-windows-msvc
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: x86_64-pc-windows - stable
os: windows
language: rust
rust: stable-x86_64-pc-windows-gnu
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: aarch64-linux-android - stable
env: CUSTOM_TARGET=aarch64-linux-android TOOLCHAIN=stable
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: arm-linux-androideabi - stable
env: CUSTOM_TARGET=arm-linux-androideabi TOOLCHAIN=stable
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- name: x86_64-linux-android - stable
env: CUSTOM_TARGET=x86_64-linux-android TOOLCHAIN=stable
if: type != api OR commit_message !~ beta AND commit_message !~ nightly
- stage: tools
name: rustfmt - nightly
env: TARGET=x86_64-unknown-linux-gnu TOOLCHAIN=nightly
if: type != api OR commit_message =~ nightly
script:
- run cargo fmt --all -- --check
- stage: tools
name: clippy - nightly
env: TARGET=x86_64-unknown-linux-gnu TOOLCHAIN=nightly
if: type != api OR commit_message =~ nightly
script:
- run cargo clippy --all --examples
- &documentation
name: x86_64-unknown-linux-gnu - nightly
stage: documentation
env: TARGET=x86_64-unknown-linux-gnu TOOLCHAIN=nightly
if: type != api OR commit_message =~ nightly
script: |
run cargo doc --features "$FEATURES" --no-deps
echo '<meta http-equiv="refresh" content="0; url=astral">' > target/doc/index.html
rm target/doc/aliases.js
echo '.srclink{display:none;}' >> target/doc/rustdoc.css
before_deploy: |
git clone https://$GH_TOKEN@github.com/astral-engine/docs.git documentation
rm -rf documentation/$TRAVIS_BRANCH
mkdir -p documentation/$TRAVIS_BRANCH
mv target/doc/* documentation/$TRAVIS_BRANCH/
deploy:
- &pages
provider: pages
skip-cleanup: true
local_dir: documentation/
repo: astral-engine/docs
target-branch: master
github-token: $GH_TOKEN
keep-history: true
verbose: true
on:
branch: master
- <<: *pages
on:
tags: true
- <<: *documentation
stage: release
name: Documentation
after_success: false
before_deploy: |
mkdir documentation
mv target/doc/* documentation/
zip -r "documentation.zip" documentation/*
tar cvzf "documentation.tar.gz" documentation/*
deploy:
- provider: releases
file:
- "documentation.zip"
- "documentation.tar.gz"
api_key: $GH_TOKEN
body: "[Online Documentation](https://astral-engine.github.io/docs/$TRAVIS_BRANCH/astral/)"
skip_cleanup: true
on:
tags: true
- &release
stage: release
name: linux-x86_64-gnu
language: rust
rust: stable
env: ARCHIVE=linux_gnu_x86_64.tar.gz
script: |
cargo build --features "$FEATURES" --examples --release
mkdir -p Astral/examples/
before_deploy: |
mv target/release/examples/simple Astral/examples/
tar cvzf $ARCHIVE Astral
deploy:
provider: releases
file: $ARCHIVE
api_key: $GH_TOKEN
skip_cleanup: true
on:
tags: true
- <<: *release
name: darwin-x86_64
os: osx
env: ARCHIVE=darwin_x86_64.tar.gz
- <<: *release
name: windows-x86_64
os: windows
env: ARCHIVE=windows_x86_64.zip
before_deploy: |
mv target/release/examples/simple.exe Astral/examples/
7z a $ARCHIVE Astral