[go: up one dir, main page]

femme 2.2.1

Not just a pretty (inter)face: pretty-printer and ndjson logger for log crate.
Documentation
version: 2.1

# Circle CI dependencies.
# Rust Orb: https://github.com/CircleCI-Public/rust-orb
# Github Orb: https://github.com/CircleCI-Public/github-cli-orb
orbs:
  rust: circleci/rust@1.6.0
  gh: circleci/github-cli@2.0.0
  win: circleci/windows@2.2.0

# We run jobs on the following platforms: linux, macos and windows.
# These are their specifications:
executors:
  linux: &linux
    machine:
      image: ubuntu-2004:202010-01
  macos: &macos
    macos:
      xcode: "12.5.1"
  windows: &windows
    machine:
      image: 'windows-server-2019-vs2019:stable'
    resource_class: windows.medium
    shell: powershell.exe -ExecutionPolicy Bypass

# There are two workflows: lint and test.

# We run `cargo clippy` for linting on
# linux on stable rust.

# Tests are run on three platforms: linux, macos and
# windows. They all get run through stable and nightly rust so we are aware of
# any breaking changes that might be happening in the near future.
workflows:
  lint:
    jobs:
      - lint:
          name: Lint
          matrix:
            parameters:
              platform: [linux]
              rust_channel: [stable]
  wasm:
    jobs:
      - wasm:
          name: Wasm compilation
          matrix:
            parameters:
              platform: [linux]
              rust_channel: [stable]
  test:
    jobs:
      - test:
          name: Test (<< matrix.rust_channel >> rust on << matrix.platform >>)
          matrix:
            parameters:
              platform: [linux, macos, windows]
              rust_channel: [stable, nightly]



# Details of the two jobs: lint and test.
jobs:
  lint:
    parameters:
      rust_channel:
        type: enum
        enum: ["stable", "nightly"]
        default: stable
      platform:
        type: executor
    executor: << parameters.platform >>
    steps:
      - checkout
      - install_system_deps:
          rust_channel: << parameters.rust_channel >>
          platform: << parameters.platform >>
      - run:
          name: Run cargo clippy
          command: cargo clippy --all-targets --all-features -- -D warnings && cargo clippy --benches

  wasm:
    parameters:
      rust_channel:
        type: enum
        enum: ["stable"]
        default: stable
      platform:
        type: executor
    executor: << parameters.platform >>
    steps:
      - checkout
      - install_system_deps:
          rust_channel: << parameters.rust_channel >>
          platform: << parameters.platform >>
      - run:
          name: Download wasm target
          command: rustup target add wasm32-unknown-unknown
      - run:
          name: Run cargo build on wasm32-unknown-unknown
          command: cargo build --target wasm32-unknown-unknown

  test:
    parameters:
      rust_channel:
        type: enum
        enum: ["stable", "nightly"]
        default: stable
      platform:
        type: executor
    executor: << parameters.platform >>
    steps:
      - checkout
      - install_system_deps:
          rust_channel: << parameters.rust_channel >>
          platform: << parameters.platform >>
      - run:
          name: Run cargo test
          command: cargo test

# The folowing are reusable command snippets can be referred to in any `steps`.
# Commands we currently have: install_system_deps, install_rust_toolchain.
commands:
  install_system_deps:
    parameters:
      platform:
        type: executor
      rust_channel:
        type: enum
        enum: ["stable", "nightly"]
    steps:
      - when:
          condition:
            equal: [ *linux, << parameters.platform >> ]
          steps:
            - run:
                name: Update apt repositories
                command: sudo apt-get update
            - run:
                name: Check glibc version
                command: ldd --version
            - run:
                name: Install OpenSSL
                command: sudo apt-get install -y libssl-dev

      - when:
          condition:
            equal: [ *macos, << parameters.platform >> ]
          steps:
            - run:
                name: Skip homebrew update
                command: echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $BASH_ENV
            - run:
                name: Install OpenSSL@1.1
                command: brew install openssl@1.1

      - install_rust_toolchain:
          rust_channel: << parameters.rust_channel >>
          platform: << parameters.platform >>

  install_rust_toolchain:
    parameters:
      rust_channel:
        type: enum
        enum: ["stable", "nightly"]
      platform:
        type: executor
    steps:
      - unless:
          condition:
            equal: [ *windows, << parameters.platform >> ]
          steps:
            - rust/install:
                version: << parameters.rust_channel >>

      - when:
          condition:
            equal: [ *windows, << parameters.platform >> ]
          steps:
            - run:
                name: Install rustup
                environment:
                  # Override auto-detection of RAM for rustc install.
                  # https://github.com/rust-lang/rustup/issues/2229#issuecomment-585855925
                  RUSTUP_UNPACK_RAM: "21474836480"
                command: |
                  $installer_dir = "$Env:TEMP"
                  echo "Downloading rustup"
                  (New-Object System.Net.WebClient).DownloadFile("https://win.rustup.rs/x86_64", "$installer_dir\rustup-init.exe")
                  echo "Installing rustup"
                  & $installer_dir\rustup-init.exe --profile minimal -y
                  exit $LASTEXITCODE
            - run:
                name: Configure cargo for Windows
                command: |
                  Add-Content -path "${Env:USERPROFILE}\.cargo\config.toml" @"
                  [net]
                  git-fetch-with-cli = true
                  "@