glean_parser/.circleci/config.yml

272 строки
7.1 KiB
YAML

---
version: 2.1
commands:
setup-rust-toolchain:
steps:
- run:
name: Installing rustup
command: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- run:
name: Setup custom Rust environment variables
command: |
echo 'export PATH=$HOME/.cargo/bin:$PATH' >> $BASH_ENV
echo "export RUST_BACKTRACE=1" >> $BASH_ENV
echo "export CARGO_INCREMENTAL=0" >> $BASH_ENV
test-start:
steps:
- checkout
- run:
name: environment
command: |
echo 'export PATH=.:$HOME/.local/bin:$PATH' >> $BASH_ENV
- run:
name: Upgrade pip
command: |
pip install --upgrade --user pip
test-min-requirements:
steps:
- run:
name: install minimum requirements
command: |
# Use requirements-builder to determine the minimum versions of
# all requirements and test those
# We install requirements-builder itself into its own venv, since
# otherwise its dependencies might install newer versions of
# glean_parser's dependencies.
python3 -m venv .rb
.rb/bin/pip install requirements-builder
.rb/bin/requirements-builder --level=min setup.py > min_requirements.txt
pip install --progress-bar off --user -U -r min_requirements.txt
test-python-version:
parameters:
requirements-file:
type: string
default: "requirements_dev.txt"
steps:
- run:
name: Install required native dependencies
command: |
pip install --progress-bar off --user -U -r <<parameters.requirements-file>>
sudo apt update -q
sudo apt upgrade -q
sudo apt install \
--yes --no-install-recommends \
openjdk-11-jdk-headless \
ruby \
golang-go
make install-kotlin-linters
- setup-rust-toolchain
- run:
name: Install glean_parser
# Set CC to something that isn't a working compiler so we
# can detect if any of the dependencies require a compiler
# to be installed. We can't count on a working compiler
# being available to pip on all of the platforms we need to
# support, so we need to make sure the dependencies are all
# pure Python or provide pre-built wheels.
command: CC=broken_compiler pip install . --user
- run:
name: test
command: make test-full
lint:
parameters:
requirements-file:
type: string
default: "requirements_dev.txt"
steps:
- run:
name: install
command: |
pip install --progress-bar off --user -U -r <<parameters.requirements-file>>
- run:
name: install
# Set CC to something that isn't a working compiler so we
# can detect if any of the dependencies require a compiler
# to be installed. We can't count on a working compiler
# being available to pip on all of the platforms we need to
# support, so we need to make sure the dependencies are all
# pure Python or provide pre-built wheels.
command: CC=broken_compiler pip install . --user
- run:
name: lint
command: make lint
license-check:
steps:
- run:
name: install
command: |
pip install --user pip-licenses
CC=broken_compiler pip install . --user
- run:
name: license-check
command: |
pip-licenses --fail-on 'GNU General Public License v3 (GPLv3)'
jobs:
build-38:
docker:
- image: cimg/python:3.8-node
steps:
- test-start
- test-python-version
build-38-min:
docker:
- image: cimg/python:3.8-node
steps:
- test-start
- test-min-requirements
- test-python-version
build-39:
docker:
- image: cimg/python:3.9-node
steps:
- test-start
- test-python-version
build-310:
docker:
- image: cimg/python:3.10-node
steps:
- test-start
- test-python-version
- run:
name: make-docs
command: |
make docs
touch docs/_build/html/.nojekyll
- persist_to_workspace:
root: docs/_build
paths: html
build-311:
docker:
- image: cimg/python:3.11-node
steps:
- test-start
- test-python-version
build-312:
docker:
- image: cimg/python:3.12-node
steps:
- test-start
- test-python-version
lint:
docker:
- image: cimg/python:3.12
steps:
- test-start
- lint
license-check:
docker:
- image: cimg/python:3.12
steps:
- test-start
- license-check
docs-deploy:
docker:
- image: node:8.10.0
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "9b:25:aa:bf:39:b6:4a:e7:c3:52:cf:ab:23:81:3d:52"
- attach_workspace:
at: docs/_build
- run:
name: install gh-pages
command: |
npm install -g --silent gh-pages@2.0.1
git config user.email "glean-ci@nowhere.com"
git config user.name "glean-ci"
- run:
name: deploy
command: |
gh-pages --dotfiles --message "[ci skip] updates" --dist docs/_build/html
pypi-deploy:
docker:
- image: cimg/python:3.8
steps:
- checkout
- run:
name: environment
command: |
echo 'export PATH=.:$HOME/.local/bin:$PATH' >> $BASH_ENV
- run:
name: Upgrade pip
command: |
pip install --upgrade --user pip
- run:
name: install Python dependencies
command: |
pip install --user -U -r requirements_dev.txt
- run:
name: deploy
# Requires that the TWINE_USERNAME and TWINE_PASSWORD environment
# variables are configured in CircleCI's environment variables.
command: |
make release
workflows:
version: 2
build:
jobs:
- lint:
filters:
tags:
only: /.*/
- license-check:
filters:
tags:
only: /.*/
- build-38:
filters:
tags:
only: /.*/
- build-38-min:
filters:
tags:
only: /.*/
- build-39:
filters:
tags:
only: /.*/
- build-310:
filters:
tags:
only: /.*/
- build-311:
filters:
tags:
only: /.*/
- build-312:
filters:
tags:
only: /.*/
- docs-deploy:
requires:
- build-310
filters:
branches:
only: main
- pypi-deploy:
requires:
- build-38
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/