зеркало из https://github.com/mozilla/glean.git
249 строки
6.9 KiB
YAML
249 строки
6.9 KiB
YAML
version: 2.1
|
|
|
|
commands:
|
|
setup-rust-toolchain:
|
|
parameters:
|
|
rust-version:
|
|
type: string
|
|
default: "stable"
|
|
steps:
|
|
- run:
|
|
name: Setup Rust toolchain
|
|
command: |
|
|
rustup install <<parameters.rust-version>>
|
|
rustup default <<parameters.rust-version>>
|
|
rustc --version
|
|
test-setup:
|
|
parameters:
|
|
rust-version:
|
|
type: string
|
|
default: "stable"
|
|
steps:
|
|
- checkout
|
|
- setup-rust-toolchain:
|
|
rust-version: <<parameters.rust-version>>
|
|
rust-tests:
|
|
parameters:
|
|
rust-version:
|
|
type: string
|
|
default: "stable"
|
|
steps:
|
|
- test-setup:
|
|
rust-version: <<parameters.rust-version>>
|
|
- run:
|
|
name: Test
|
|
command: cargo test --all --verbose
|
|
|
|
install-rustup:
|
|
steps:
|
|
- run:
|
|
name: Installing rustup
|
|
command: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
- run:
|
|
name: Setup custom environment variables
|
|
command: |
|
|
echo "export PATH=$HOME/.cargo/bin:$PATH" >> $BASH_ENV
|
|
- run:
|
|
command: |
|
|
rustup target add aarch64-linux-android
|
|
rustup target add armv7-linux-androideabi
|
|
rustup target add i686-linux-android
|
|
rustup target add x86_64-linux-android
|
|
|
|
android-setup:
|
|
steps:
|
|
- install-rustup
|
|
- test-setup:
|
|
rust-version: stable
|
|
- run:
|
|
name: Install missing Android SDK
|
|
command: |
|
|
sdkmanager 'build-tools;21.0.0'
|
|
|
|
jobs:
|
|
Check Rust formatting:
|
|
docker:
|
|
- image: circleci/rust:latest
|
|
steps:
|
|
- checkout
|
|
- run: rustup component add rustfmt
|
|
- run: rustfmt --version
|
|
- run: cargo fmt -- --check
|
|
Lint Rust with clippy:
|
|
docker:
|
|
- image: circleci/rust:latest
|
|
steps:
|
|
- checkout
|
|
- run: rustup component add clippy
|
|
- run: cargo clippy --version
|
|
- run: cargo clippy --all --all-targets --all-features -- -D warnings
|
|
Rust tests - stable:
|
|
docker:
|
|
- image: circleci/rust:latest
|
|
# We have to use a machine with more RAM for tests so we don't run out of memory.
|
|
steps:
|
|
- rust-tests
|
|
Rust tests - beta:
|
|
docker:
|
|
- image: circleci/rust:latest
|
|
steps:
|
|
- rust-tests:
|
|
rust-version: "beta"
|
|
Rust tests - minimum version:
|
|
docker:
|
|
- image: circleci/rust:latest
|
|
steps:
|
|
- rust-tests:
|
|
rust-version: "1.34.2"
|
|
C tests:
|
|
docker:
|
|
- image: circleci/rust:latest
|
|
steps:
|
|
- test-setup:
|
|
rust-version: stable
|
|
- run: cargo build --release
|
|
# Just a basic smoke test for now to make sure it compiles and runs
|
|
# without returning an error
|
|
- run: |
|
|
cd glean-core/ffi/examples
|
|
make
|
|
./glean_app
|
|
|
|
Lint Android with ktlint and detekt:
|
|
docker:
|
|
- image: circleci/android:api-28-ndk
|
|
steps:
|
|
- checkout
|
|
- run: ./gradlew --no-daemon ktlint
|
|
- run: ./gradlew --no-daemon detekt
|
|
|
|
Android tests:
|
|
docker:
|
|
- image: circleci/android:api-28-ndk
|
|
steps:
|
|
- android-setup
|
|
- run:
|
|
name: Check skip condition
|
|
command: |
|
|
if git log -1 "$CIRCLE_SHA1" | grep -q '\[doc only\]'; then
|
|
echo "Skipping this step. Last commit was tagged to not require Android tests."
|
|
circleci-agent step halt
|
|
fi
|
|
- run:
|
|
name: Android tests
|
|
command: ./gradlew --no-daemon test
|
|
environment:
|
|
GRADLE_OPTS: -Xmx2048m
|
|
- store_artifacts:
|
|
path: glean-core/android/build/reports/tests
|
|
|
|
# via https://circleci.com/blog/deploying-documentation-to-github-pages-with-continuous-integration/
|
|
Generate Rust documentation:
|
|
docker:
|
|
- image: circleci/rust:latest
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Version information
|
|
command: rustc --version; cargo --version; rustup --version
|
|
- run:
|
|
name: Install mdbook
|
|
command: |
|
|
wget https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.0/mdbook-v0.3.0-x86_64-unknown-linux-gnu.tar.gz
|
|
tar -xvf mdbook-v0.3.0-x86_64-unknown-linux-gnu.tar.gz
|
|
mv mdbook /usr/local/cargo/bin/mdbook
|
|
- run:
|
|
name: Build Rust documentation
|
|
command: bin/build-rust-docs.sh
|
|
- persist_to_workspace:
|
|
root: build/
|
|
paths:
|
|
- docs/book
|
|
- docs/docs
|
|
- docs/index.html
|
|
|
|
Generate Kotlin documentation:
|
|
docker:
|
|
- image: circleci/android:api-28-ndk
|
|
steps:
|
|
- android-setup
|
|
- run:
|
|
name: Build Kotlin documentation
|
|
command: ./gradlew --no-daemon docs
|
|
- persist_to_workspace:
|
|
root: build/
|
|
paths: docs/javadoc
|
|
|
|
docs-linkcheck:
|
|
docker:
|
|
- image: circleci/python
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Install linkchecker
|
|
command: sudo apt install linkchecker
|
|
- attach_workspace:
|
|
at: build/
|
|
- run:
|
|
name: Check internal documentation links
|
|
command: linkchecker --ignore-url javadoc --ignore-url docs/glean_core build/docs
|
|
|
|
docs-deploy:
|
|
docker:
|
|
- image: node:8.10.0
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: build/
|
|
- run:
|
|
name: Disable jekyll builds
|
|
command: touch build/docs/.nojekyll
|
|
- run:
|
|
name: Show contents
|
|
command: ls -R
|
|
# Needed for write access to the GitHub repository;
|
|
# see https://circleci.com/docs/2.0/gh-bb-integration/#deployment-keys-and-user-keys
|
|
- add_ssh_keys:
|
|
fingerprints:
|
|
- "84:e6:13:7e:94:8d:e2:bf:4f:93:1f:d9:52:80:bb:2c"
|
|
# The gh-pages npm package can be used to push a directory to a git branch;
|
|
# see https://www.npmjs.com/package/gh-pages
|
|
- run:
|
|
name: Deploy docs to gh-pages branch
|
|
command: |
|
|
git config user.email "jrediger@mozilla.com"
|
|
git config user.name "CircleCI docs-deploy job"
|
|
npm install -g --silent gh-pages@2.0.1
|
|
gh-pages --dotfiles --message "[skip ci] Updates" --dist build/docs
|
|
|
|
workflows:
|
|
version: 2
|
|
check-formating:
|
|
jobs:
|
|
- Check Rust formatting
|
|
lint:
|
|
jobs:
|
|
- Lint Rust with clippy
|
|
- Lint Android with ktlint and detekt
|
|
run-tests:
|
|
jobs:
|
|
- Rust tests - stable
|
|
- Rust tests - beta
|
|
- Rust tests - minimum version
|
|
- Android tests
|
|
- C tests
|
|
documentation:
|
|
jobs:
|
|
- Generate Rust documentation
|
|
- Generate Kotlin documentation
|
|
- docs-linkcheck:
|
|
requires:
|
|
- Generate Rust documentation
|
|
- Generate Kotlin documentation
|
|
- docs-deploy:
|
|
requires:
|
|
- docs-linkcheck
|
|
filters:
|
|
branches:
|
|
only: master
|