summaryrefslogtreecommitdiff
path: root/.cirrus.yml
blob: c73bb6b99018ca346514332dde91857b088357c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# This CI is used to test Arm cases. We can set the maximum 16 tasks.
# The entire testing design is inspired from .github/workflows/compilers.yml.

# By default, Cirrus mounts an empty volume to `/tmp`
# which triggers all sorts of warnings like "system temporary path is world-writable: /tmp".
# Lets workaround it by specifying a custom volume mount point.
env:
  CIRRUS_VOLUME: /cirrus-ci-volume
  CIRRUS_CLONE_DEPTH: 50
  LANG: C.UTF-8
  optflags: '-O1'
  debugflags: '-ggdb3'
  RUBY_PREFIX: /tmp/ruby-prefix
  RUBY_DEBUG: ci rgengc
  RUBY_TESTOPTS: >-
    -q
    --color=always
    --tty=no
  RUST_BACKTRACE: 1
  INIT_ENV:

config_template: &CONFIG_TEMPLATE
  auto_cancellation: $CIRRUS_BRANCH != 'master'
  only_if: changesInclude('.cirrus.yml', 'yjit.{c,h,rb}', 'yjit/**.{mk,rs,toml}')
  skip: >-
    $CIRRUS_CHANGE_MESSAGE =~ '.*\[DOC\].*' ||
    $CIRRUS_PR_LABELS =~ '.*Documentation.*' ||
    changesIncludeOnly('doc/**', '**.{md,rdoc,ronn,[1-8]}', '.document')
  arm_container:
    # We use the arm64 images at https://github.com/ruby/ruby-ci-image/pkgs/container/ruby-ci-image .
    image: ghcr.io/ruby/ruby-ci-image:$CC
    # Define the used cpu core in each matrix task. We can use total 16 cpu
    # cores in entire matrix. [cpu] = [total cpu: 16] / [number of tasks]
    cpu: 8
    # We can request maximum 4 GB per cpu.
    # [memory per task] = [memory per cpu: 4 GB] * [cpu]
    memory: 32G

  id_script: id
  info_script: |
    nproc
    free -h
  set_env_script:
    # Set `GNUMAKEFLAGS`, because the flags are GNU make specific.
    - echo "GNUMAKEFLAGS=-s -j$((1 + $CIRRUS_CPU))" >> "$CIRRUS_ENV"
    - '[ -z "$INIT_ENV" ] || printenv | sort | comm -13 - <(set -x; source $INIT_ENV && printenv | sort) | tee -a "$CIRRUS_ENV"'
    - cat "$CIRRUS_ENV"
  bundled_gems_cache:
    folder: .downloaded-cache
    fingerprint_script:
      sed 's/  */ /g;s/ *#.*//;/^$/d;s/\([^ ]*\) \([^ ]*\)/\1-\2.gem/;s/ .*//' gems/bundled_gems
    populate_script: |
      sudo apt-get install --no-install-recommends -q -y wget
      mkdir -p .downloaded-cache
      sed 's/  */ /g;s/ *#.*//;/^$/d;s/\([^ ]*\) \([^ ]*\)/\1-\2.gem/;s/ .*//' gems/bundled_gems |
      wget -nv -P .downloaded-cache -nd -B https://rubygems.org/downloads/ -i -
  # Arm containers are executed in AWS's EKS, and it's not yet supporting IPv6
  # See https://github.com/aws/containers-roadmap/issues/835
  disable_ipv6_script: sudo ./tool/disable_ipv6.sh
  autogen_script: ./autogen.sh
  configure_script: >-
    ./configure -C
    --enable-debug-env
    --disable-install-doc
    --with-ext=-test-/cxxanyargs,+
    --prefix="$RUBY_PREFIX"
    $configure

task:
  name: Arm64 Graviton2 / $CC
  env:
    matrix:
      CC: gcc-11
  << : *CONFIG_TEMPLATE
  make_extract-extlibs_script: make extract-extlibs
  make_incs_script: make incs
  make_script: make
  make_test_script: make test
  make_install_script: make install
  install_gems_for_test_script: $RUBY_PREFIX/bin/gem install --no-doc timezone tzinfo
  make_test-tool_script: make test-tool
  make_test-all_script: make test-all
  make_test-spec_script: make test-spec

# The following is to test YJIT on ARM64 CPUs available on Cirrus CI
yjit_task:
  name: Arm64 Graviton2 / $CC YJIT
  env:
    INIT_ENV: $HOME/.cargo/env
    matrix:
      - CC: gcc-11
        configure: --enable-yjit
  install_rust_script:
    - sudo apt-get update -y
    - sudo apt-get install -y curl
    - "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y $rustup_init"
  << : *CONFIG_TEMPLATE
  make_miniruby_script: make miniruby
  make_bindgen_script: |
    if [[ "$CC" = "clang-12" ]]; then
      make yjit-bindgen
    else
      echo "only running bindgen on clang image"
    fi
  boot_miniruby_script: ./miniruby --yjit-call-threshold=1 -e0
  test_dump_insns_script: ./miniruby --yjit-call-threshold=1 --yjit-dump-insns -e0
  output_stats_script: ./miniruby --yjit-call-threshold=1 --yjit-stats -e0
  full_build_script: make
  cargo_test_script: cd yjit && cargo test
  make_test_script: make test RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx"
  make_test_all_script: make test-all RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx" TESTOPTS="$RUBY_TESTOPTS"
  make_test_spec_script: make test-spec RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx"
  clippy_script: cd yjit && cargo clippy --all-targets --all-features