Merge pull request #284 from thowell/ce #1312
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [main, deepmind] | |
pull_request: | |
branches: [main] | |
jobs: | |
mujoco_mpc: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
additional_label: "with Clang 12" | |
cmake_args: >- | |
-G Ninja | |
-DCMAKE_C_COMPILER:STRING=clang-12 | |
-DCMAKE_CXX_COMPILER:STRING=clang++-12 | |
-DMJPC_BUILD_GRPC_SERVICE:BOOL=ON | |
tmpdir: "/tmp" | |
- os: macos-12 | |
cmake_args: >- | |
-G Ninja | |
-DMJPC_BUILD_GRPC_SERVICE:BOOL=ON | |
tmpdir: "/tmp" | |
name: "MuJoCo MPC on ${{ matrix.os }} ${{ matrix.additional_label }}" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare Linux | |
if: ${{ runner.os == 'Linux' }} | |
run: > | |
sudo apt-get update && sudo apt-get install | |
libgl1-mesa-dev | |
libxinerama-dev | |
libxcursor-dev | |
libxrandr-dev | |
libxi-dev | |
ninja-build | |
zlib1g-dev | |
- name: Prepare macOS | |
if: ${{ runner.os == 'macOS' }} | |
run: brew install ninja zlib | |
- name: Prepare Windows | |
if: ${{ runner.os == 'Windows' }} | |
# Install llvm 16 manually, remove after | |
# https://github.com/actions/runner-images/issues/8125 is resolved and that | |
# version is included in the image by default | |
run: > | |
choco install nasm | |
choco upgrade llvm | |
- name: For the deepmind branch, use MuJoCo HEAD rather than a fixed commit | |
if: ${{ github.ref_name == 'deepmind' }} | |
run: | |
echo "cmake_extra_args=-DMUJOCO_MPC_MUJOCO_GIT_TAG:STRING=main" > "$GITHUB_ENV" | |
- name: Configure MuJoCo MPC | |
shell: bash | |
run: > | |
mkdir build && | |
cd build && | |
cmake .. -DCMAKE_BUILD_TYPE:STRING=Release | |
${{ matrix.cmake_args }} | |
$cmake_extra_args | |
- name: Build MuJoCo MPC | |
working-directory: build | |
run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} | |
- name: Test MuJoCo MPC | |
working-directory: build | |
run: > | |
cd mjpc/test && | |
ctest -C Release --output-on-failure . | |
- name: Notify team chat | |
shell: bash | |
env: | |
GCHAT_API_URL: ${{ secrets.GCHAT_API }} | |
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
CHATMSG_AUTHOR_NAME: ${{ github.event.head_commit.author.name }} | |
CHATMSG_AUTHOR_EMAIL: ${{ github.event.head_commit.author.email }} | |
CHATMSG_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
CHATMSG_JOB_ID: ${{ matrix.os }} ${{ matrix.additional_label }} | |
if: ${{ failure() && github.event_name == 'push' && env.GCHAT_API_URL != '' }} | |
run: | | |
CHATMSG="$(cat <<-'EOF' | python3 | |
import json | |
import os | |
env = lambda x: os.getenv(x, '') | |
data = dict( | |
result=env('JOB_URL'), | |
job=env('CHATMSG_JOB_ID'), | |
commit=env('GITHUB_SHA')[:6], | |
name=env('CHATMSG_AUTHOR_NAME').replace('```', ''), | |
email=env('CHATMSG_AUTHOR_EMAIL'), | |
msg=env('CHATMSG_COMMIT_MESSAGE').replace('```', '') | |
) | |
text = '<{result}|*FAILURE*>: job `{job}` commit `{commit}`\n```Author: {name}<{email}>\n\n{msg}```'.format(**data) | |
print(json.dumps({'text' : text})) | |
EOF | |
)" && | |
curl "$GCHAT_API_URL&threadKey=$GITHUB_SHA&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" \ | |
-X POST \ | |
-H "Content-Type: application/json" \ | |
--data-raw "${CHATMSG}" |