<commit_before>image: ekidd/rust-musl-builder:stable-openssl11

stages:
  - test
  - build
  - acceptance-test

test:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - target/
      - cargo-home/

  stage: test
  script:
    - cp -r $HOME/.cargo cargo-home
    - export CARGO_HOME=$PWD/cargo-home
    - rustc --version && cargo --version
    - cargo build --all
    - cargo test --all --verbose

build-x86_64-unknown-linux-musl:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - target/
      - cargo-home/

  stage: build

  artifacts:
    name: "gerritbot-$CI_JOB_NAME"
    paths:
      - target/x86_64-unknown-linux-musl/release/gerritbot
      - target/x86_64-unknown-linux-musl/release/examples/gerritbot-console

  script:
    - cp -r $HOME/.cargo cargo-home
    - export CARGO_HOME=$PWD/cargo-home
    - |
      cargo build \
        --release \
        --target x86_64-unknown-linux-musl \
        --package gerritbot \
        --bin gerritbot \
        --example gerritbot-console

build-armv7-unknown-linux-gnueabihf:
  image: japaric/armv7-unknown-linux-gnueabihf

  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - cargo-home/

  stage: build

  artifacts:
    name: "gerritbot-$CI_JOB_NAME"
    paths:
      - target/armv7-unknown-linux-gnueabihf/release/gerritbot

  before_script:
    - apt-get install -y curl strace
    - useradd -s /bin/bash rust
    - mkdir -p /home/rust
    - "chown rust: /home/rust"
    - |
      su - rust <<RUST
      set -ex
      curl -o rustup-init https://sh.rustup.rs
      sh rustup-init -y
      source ~/.cargo/env
      rustup target add armv7-unknown-linux-gnueabihf
      RUST

  script:
    - |
      su - rust <<RUST
      set -ex
      source ~/.cargo/env
      cd $CI_PROJECT_DIR
      cp -r ~/.cargo cargo-home

      export \
        CARGO_HOME=$PWD/cargo-home \
        CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=$CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER \
        CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER=$CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER \
        CC_armv7_unknown_linux_gnueabihf=$CC_armv7_unknown_linux_gnueabihf \
        OPENSSL_DIR=$OPENSSL_DIR \
        OPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR \
        OPENSSL_LIB_DIR=$OPENSSL_LIB_DIR \
        QEMU_LD_PREFIX=$QEMU_LD_PREFIX
        RUST_TEST_THREADS=1

      env

      rm -rf target

      cargo build \
        --release \
        --target armv7-unknown-linux-gnueabihf \
        --package gerritbot \
        --bin gerritbot
      RUST

acceptance-test:x86_64-unknown-linux-musl:
  stage: acceptance-test

  dependencies:
    - build-x86_64-unknown-linux-musl

  before_script:
    - sudo apt-get update
    - sudo apt-get install -y openjdk-8-jre-headless python3 python3-pip<commit_msg>pass CI_COMMIT_SHA to raspberry pi build<commit_after>image: ekidd/rust-musl-builder:stable-openssl11

stages:
  - test
  - build
  - acceptance-test

test:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - target/
      - cargo-home/

  stage: test
  script:
    - cp -r $HOME/.cargo cargo-home
    - export CARGO_HOME=$PWD/cargo-home
    - rustc --version && cargo --version
    - cargo build --all
    - cargo test --all --verbose

build-x86_64-unknown-linux-musl:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - target/
      - cargo-home/

  stage: build

  artifacts:
    name: "gerritbot-$CI_JOB_NAME"
    paths:
      - target/x86_64-unknown-linux-musl/release/gerritbot
      - target/x86_64-unknown-linux-musl/release/examples/gerritbot-console

  script:
    - cp -r $HOME/.cargo cargo-home
    - export CARGO_HOME=$PWD/cargo-home
    - |
      cargo build \
        --release \
        --target x86_64-unknown-linux-musl \
        --package gerritbot \
        --bin gerritbot \
        --example gerritbot-console

build-armv7-unknown-linux-gnueabihf:
  image: japaric/armv7-unknown-linux-gnueabihf

  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - cargo-home/

  stage: build

  artifacts:
    name: "gerritbot-$CI_JOB_NAME"
    paths:
      - target/armv7-unknown-linux-gnueabihf/release/gerritbot

  before_script:
    - apt-get install -y curl strace
    - useradd -s /bin/bash rust
    - mkdir -p /home/rust
    - "chown rust: /home/rust"
    - |
      su - rust <<RUST
      set -ex
      curl -o rustup-init https://sh.rustup.rs
      sh rustup-init -y
      source ~/.cargo/env
      rustup target add armv7-unknown-linux-gnueabihf
      RUST

  script:
    - |
      su - rust <<RUST
      set -ex
      source ~/.cargo/env
      cd $CI_PROJECT_DIR
      cp -r ~/.cargo cargo-home

      export \
        CARGO_HOME=$PWD/cargo-home \
        CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=$CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER \
        CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER=$CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER \
        CC_armv7_unknown_linux_gnueabihf=$CC_armv7_unknown_linux_gnueabihf \
        OPENSSL_DIR=$OPENSSL_DIR \
        OPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR \
        OPENSSL_LIB_DIR=$OPENSSL_LIB_DIR \
        QEMU_LD_PREFIX=$QEMU_LD_PREFIX \
        RUST_TEST_THREADS=1 \
        CI_COMMIT_SHA=$CI_COMMIT_SHA

      env

      rm -rf target

      cargo build \
        --release \
        --target armv7-unknown-linux-gnueabihf \
        --package gerritbot \
        --bin gerritbot
      RUST

acceptance-test:x86_64-unknown-linux-musl:
  stage: acceptance-test

  dependencies:
    - build-x86_64-unknown-linux-musl

  before_script:
    - sudo apt-get update
    - sudo apt-get install -y openjdk-8-jre-headless python3 python3-pip
{'fraction_non_alphanumeric': 0.10195381882770871, 'fraction_numerical': 0.014564831261101243, 'mean_word_length': 2.168823860438942, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3984151', 'n_tokens_mistral': 2224, 'n_tokens_neox': 2110, 'n_words': 345}