|
| 1 | +# Syntax reference: |
| 2 | +# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions |
| 3 | + |
| 4 | +name: TGen Tests |
| 5 | +permissions: read-all |
| 6 | + |
| 7 | +defaults: |
| 8 | + run: |
| 9 | + shell: bash |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: [main] |
| 14 | + pull_request: |
| 15 | + types: [opened, synchronize] |
| 16 | + |
| 17 | +env: |
| 18 | + CARGO_TERM_COLOR: always |
| 19 | + |
| 20 | +jobs: |
| 21 | + tgen: |
| 22 | + # use the oldest kernel supported by github's CI (make sure to update the |
| 23 | + # minimum supported kernel version in documentation when changing) |
| 24 | + # https://github.com/actions/virtual-environments |
| 25 | + runs-on: ubuntu-20.04 |
| 26 | + |
| 27 | + container: |
| 28 | + image: 'ubuntu:22.04' |
| 29 | + # the default shm-size for ubuntu:18.04, but with the size increased from |
| 30 | + # 65536k. github's default docker seccomp policy seems to disallow |
| 31 | + # process_vm_readv and process_vm_writev; disable it altogether. See |
| 32 | + # https://docs.docker.com/engine/security/seccomp/ |
| 33 | + options: '--tmpfs /dev/shm:rw,nosuid,nodev,exec,size=1024g --security-opt seccomp=unconfined' |
| 34 | + |
| 35 | + env: |
| 36 | + CC: 'clang' |
| 37 | + CONTAINER: 'ubuntu:22.04' |
| 38 | + BUILDTYPE: 'release' |
| 39 | + RUSTPROFILE: minimal |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout shadow |
| 43 | + uses: actions/checkout@v3 |
| 44 | + with: |
| 45 | + path: shadow |
| 46 | + # Run on PR head instead of merge result. Running on the merge |
| 47 | + # result can give confusing results, and we require PR to be up to |
| 48 | + # date with target branch before merging, anyway. |
| 49 | + # See https://github.com/shadow/shadow/issues/2166 |
| 50 | + ref: ${{ github.event.pull_request.head.sha }} |
| 51 | + persist-credentials: false |
| 52 | + |
| 53 | + - name: Checkout tgen |
| 54 | + uses: actions/checkout@v3 |
| 55 | + with: |
| 56 | + path: tgen |
| 57 | + repository: shadow/tgen |
| 58 | + ref: 7a5cf4554f813cc996637d942f169aeb745e37ff |
| 59 | + persist-credentials: false |
| 60 | + |
| 61 | + - name: Get month |
| 62 | + id: get-month |
| 63 | + run: | |
| 64 | + echo "month=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT |
| 65 | +
|
| 66 | + - name: Install dependencies |
| 67 | + run: | |
| 68 | + cd shadow |
| 69 | + . ci/container_scripts/install_deps.sh |
| 70 | + . ci/container_scripts/install_extra_deps.sh |
| 71 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 72 | + # dependencies for tgen |
| 73 | + DEBIAN_FRONTEND=noninteractive apt-get install -y libigraph-dev |
| 74 | + mkdir -p ~/.local/bin |
| 75 | +
|
| 76 | + - name: Restore cargo registry cache |
| 77 | + uses: actions/cache@v3 |
| 78 | + with: |
| 79 | + path: | |
| 80 | + ~/.cargo/registry/index/ |
| 81 | + ~/.cargo/registry/cache/ |
| 82 | + ~/.cargo/git/db/ |
| 83 | + # invalidate the cache once per month |
| 84 | + key: cargo-registry-${{ steps.get-month.outputs.month }} |
| 85 | + restore-keys: | |
| 86 | + cargo-registry- |
| 87 | +
|
| 88 | + - name: Build tgen |
| 89 | + run: | |
| 90 | + cd tgen |
| 91 | + mkdir build && cd build |
| 92 | + cmake .. |
| 93 | + make -j$(nproc) |
| 94 | + cd .. |
| 95 | + ln -s $(pwd)/build/src/tgen ~/.local/bin/tgen |
| 96 | +
|
| 97 | + - name: Build shadow |
| 98 | + run: | |
| 99 | + cd shadow |
| 100 | + . ci/container_scripts/build_and_install.sh |
| 101 | +
|
| 102 | + - name: Test |
| 103 | + run: | |
| 104 | + cd shadow |
| 105 | + ./setup test -- --build-config extra --label-regex tgen |
| 106 | +
|
| 107 | + - name: Last 200 log lines |
| 108 | + if: failure() |
| 109 | + run: | |
| 110 | + tail -n 200 shadow/build/Testing/Temporary/LastTest.log |
| 111 | +
|
| 112 | + - name: Compress logs |
| 113 | + if: failure() |
| 114 | + run: | |
| 115 | + shopt -s globstar |
| 116 | + tar -cJf shadow/build/Testing/Temporary{.tar.xz,/} |
| 117 | + for f in shadow/build/src/test/tgen/**/*.data; do tar -cJf "$f.tar.xz" "$f/"; done |
| 118 | +
|
| 119 | + - name: Upload shadow data directory |
| 120 | + uses: actions/upload-artifact@v3 |
| 121 | + if: failure() |
| 122 | + with: |
| 123 | + name: shadow-data-dir |
| 124 | + path: shadow/build/src/test/tgen/**/*.data.tar.xz |
| 125 | + |
| 126 | + - name: Upload shadow log file |
| 127 | + uses: actions/upload-artifact@v3 |
| 128 | + if: failure() |
| 129 | + with: |
| 130 | + name: shadow-log-file |
| 131 | + path: shadow/build/Testing/Temporary.tar.xz |
0 commit comments