.gitlab-ci.yml 6.01 KB
Newer Older
Eduardo Souza's avatar
Eduardo Souza committed
1 2
stages:
  - build
Eduardo Souza's avatar
Eduardo Souza committed
3
  - rustfmt
Eduardo Souza's avatar
Eduardo Souza committed
4
  - test
Eduardo Souza's avatar
Eduardo Souza committed
5
  - mubench
Eduardo Souza's avatar
Eduardo Souza committed
6 7

before_script:
8
  - source ./init_test_env.sh release
Eduardo Souza's avatar
Eduardo Souza committed
9 10 11 12

build:
  stage: build
  script:
13
    - pwd
Eduardo Souza's avatar
Eduardo Souza committed
14 15
    - rustup update # Just in case? the `rustup default` may make this superflouse
    - rustup toolchain install nightly-2019-11-04 # Needed for rustfmt
16 17
    - rustup toolchain install nightly-2020-07-08 # Latest nightly version for which it builds locally
    - rustup default nightly-2020-07-08
Eduardo Souza's avatar
Eduardo Souza committed
18
    - rustc --version
19
    - if [ ! -d $CI_HOME/aot-mu/mu-client-pypy ]; then # mu-client-pypy for tests
Eduardo Souza's avatar
Eduardo Souza committed
20 21
    -   git clone https://gitlab.anu.edu.au/mu/mu-client-pypy.git $CI_HOME/aot-mu/mu-client-pypy
    -   pushd $CI_HOME/aot-mu/mu-client-pypy
22
    -   git checkout mu-aot-llvm
Eduardo Souza's avatar
Eduardo Souza committed
23 24 25
    -   git apply pypy.patch
    -   popd
    - fi
26 27 28 29 30 31
    - if [ ! -d $CI_HOME/llvm/mu-client-pypy ]; then # mu-client-pypy for benchmarks
    -   git clone https://gitlab.anu.edu.au/mu/mu-client-pypy.git $CI_HOME/llvm/mu-client-pypy
    -   pushd $CI_HOME/llvm/mu-client-pypy
    -   git checkout mu-aot-llvm-bench
    -   git apply pypy.patch
    -   popd
32 33 34 35 36 37
    - else
    -   pushd $CI_HOME/llvm/mu-client-pypy
    -   git reset --hard origin/mu-aot-llvm-bench
    -   git pull
    -   git apply pypy.patch
    -   popd
38
    - fi
Eduardo Souza's avatar
Eduardo Souza committed
39 40 41 42 43 44 45 46 47 48 49
    - if [ ! -d $CI_HOME/llvm/llvm-10-src  ]; then # download and build custom llvm version
    -   pushd $CI_HOME/llvm
    -   git clone https://udesou:$CI_ACCESS_TOKEN@github.com/udesou/llvm-10-src.git
    -   popd
    - else
    -   pushd $CI_HOME/llvm/llvm-10-src
    -   git checkout -f master
    -   git pull
    -   popd
    - fi
    - if [ ! -d $CI_HOME/llvm/my-llvm-build  ]; then
Eduardo Souza's avatar
Eduardo Souza committed
50 51
    -   mkdir -p $CI_HOME/llvm/my-llvm-build
    -   pushd $CI_HOME/llvm/my-llvm-build
Eduardo Souza's avatar
Eduardo Souza committed
52 53 54 55
    -   cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_INSTALL_PREFIX=$CI_HOME/llvm/my-llvm-build $CI_HOME/llvm/llvm-10-src
    -   cmake --build . --target install
    -   popd
    - else
Eduardo Souza's avatar
Eduardo Souza committed
56
    -   pushd $CI_HOME/llvm/my-llvm-build
Eduardo Souza's avatar
Eduardo Souza committed
57 58 59 60
    -   cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_INSTALL_PREFIX=$CI_HOME/llvm/my-llvm-build $CI_HOME/llvm/llvm-10-src
    -   cmake --build . --target install
    -   popd
    - fi
61
    - cd $MU_ZEBU
Eduardo Souza's avatar
Eduardo Souza committed
62 63 64
    - git fetch
    - git reset --hard
    - git pull
65
    - sed -i 's/https:\/\/github.com\/udesou\/mmtk-core.git/https:\/\/udesou:'"$CI_ACCESS_TOKEN"'@github.com\/udesou\/mmtk-core.git/g' src/mmtk-gc/Cargo.toml
Eduardo Souza's avatar
Eduardo Souza committed
66
    - cargo clean
67 68
    - rm Cargo.lock || echo "Cargo.lock does not exist."
    - git config --global credential.helper store
69 70 71 72 73
    - mkdir temp
    - cd temp
    - git clone https://udesou:$CI_ACCESS_TOKEN@github.com/udesou/mmtk-core.git
    - cd ..
    - rm -r temp
74
    - CC=clang cargo build --$ZEBU_BUILD
Eduardo Souza's avatar
Typo.  
Eduardo Souza committed
75
    - export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | sed 's!/mu-impl-fast/target/[^/]*/deps/!/REMOVED/!g') # Delete any existing zebu's (so they don't accidentally get used)
Eduardo Souza's avatar
Eduardo Souza committed
76
    - export LD_LIBRARY_PATH=./emit:$MU_ZEBU/target/$ZEBU_BUILD/deps/:$CI_HOME/antlr4/usr/local/lib:$LD_LIBRARY_PATH
Eduardo Souza's avatar
Eduardo Souza committed
77
    - cd $MU_LLVM_ZEBU
Eduardo Souza's avatar
Eduardo Souza committed
78 79
    - git fetch
    - git reset --hard
Eduardo Souza's avatar
Eduardo Souza committed
80
    - rm Cargo.lock || echo "Cargo.lock does not exist."
Eduardo Souza's avatar
Eduardo Souza committed
81
    - git pull
Eduardo Souza's avatar
Eduardo Souza committed
82
    - cargo clean
83
    - cargo build --$ZEBU_BUILD
Eduardo Souza's avatar
Eduardo Souza committed
84 85
    - $CC -shared -fPIC -ledit -lffi -L$MU_LLVM_ZEBU/target/$ZEBU_BUILD/deps/ -lmu_aot_llvm -o $MU_LLVM_ZEBU/target/$ZEBU_BUILD/libmu_aot_llvm-linked.so # link with -ledit and -lffi
    - mv $MU_LLVM_ZEBU/target/$ZEBU_BUILD/libmu_aot_llvm-linked.so $MU_LLVM_ZEBU/target/$ZEBU_BUILD/libmu_aot_llvm.so
86
    - rm ~/.git-credentials || echo ".git-credentials does not exist."
Eduardo Souza's avatar
Eduardo Souza committed
87 88
  artifacts:
    paths:
89 90 91
      - target/$ZEBU_BUILD/deps/libmu_aot_llvm.so
      - target/$ZEBU_BUILD/deps/libmu_aot_llvm.a
      - target/$ZEBU_BUILD/deps/lib-*
92

Eduardo Souza's avatar
Eduardo Souza committed
93 94 95 96
test_cargo:compiler:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
Eduardo Souza's avatar
Eduardo Souza committed
97
    - RUST_TEST_THREADS=1 cargo test --$ZEBU_BUILD 2>/dev/null
Eduardo Souza's avatar
Eduardo Souza committed
98

Eduardo Souza's avatar
Eduardo Souza committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
test_pyt:binops:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_binops.py -v --color=yes

test_pyt:cmpops:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_cmpops.py -v --color=yes

test_pyt:controlflow:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
115
    - pytest src/tests/tests_py/test_controlflow.py -v --color=yes
Eduardo Souza's avatar
Eduardo Souza committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

test_pyt:convops:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_convops.py -v --color=yes

test_pyt:double:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_double.py -v --color=yes

test_pyt:heap:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_heap.py -v --color=yes

test_pyt:memops:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_memops.py -v --color=yes

test_pyt:milestones:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_milestones.py -v --color=yes

test_pyt:otherops:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_otherops.py -v --color=yes

test_pyt:pertarget_runnable:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - pytest src/tests/tests_py/test_pertarget_runnable.py -v --color=yes

test_pyt:rpython:
  stage: test
  script:
    - cd $MU_LLVM_ZEBU
    - MU_LOG_LEVEL=info pytest src/tests/tests_py/test_rpython*.py -v --color=yes
Eduardo Souza's avatar
Eduardo Souza committed
164

165 166 167 168
mubench:
  stage: mubench
  script:
    - source $CI_HOME/venv3/bin/activate # Switch to python3
Eduardo Souza's avatar
Eduardo Souza committed
169 170 171 172
    - pwd
    - if [ ! -d ci ]; then
    -   mkdir ci
    - fi
173 174 175 176
    - export PYTHONPATH=$CI_HOME/llvm/mu-client-pypy:$CI_HOME/RPySOM/src # change mu-client-pypy to generate stuff using LLVM backend
    - export PYPY=$CI_HOME/llvm/mu-client-pypy
    - mubench local $CI_HOME/llvm/mu-perf-benchmarks/ci/*.yml --dump $CI_HOME/llvm/results/$(git log -1 --pretty="%h_%at") --pipeline ""

Eduardo Souza's avatar
Eduardo Souza committed
177 178 179
rustfmt:
  stage: rustfmt
  script:
Eduardo Souza's avatar
Eduardo Souza committed
180
    - cd $MU_LLVM_ZEBU
Eduardo Souza's avatar
Eduardo Souza committed
181
    - cargo-fmt +nightly-2019-11-04 -- --check --verbose -- src/lib.rs src/llvm_backend.rs src/instr.rs src/aot_mu.rs
Eduardo Souza's avatar
Eduardo Souza committed
182
  allow_failure: true