build_and_test #238
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_and_test | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
PIP_BREAK_SYSTEM_PACKAGES: 1 | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
unix: | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [ubuntu-latest] | |
build_tool: [bazel, cmake] | |
name: "${{matrix.runs-on}} ${{matrix.build_tool}}" | |
runs-on: ${{matrix.runs-on}} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Show env | |
run: env | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install bazel | |
if: matrix.build_tool == 'bazel' | |
# Install Bazel, see https://docs.bazel.build/versions/master/install-ubuntu.html#step-1-install-required-packages | |
run: | | |
sudo apt install curl gnupg | |
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg | |
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/ | |
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list | |
sudo apt update && sudo apt install bazel -y | |
- name: Show bazel version | |
if: matrix.build_tool == 'bazel' | |
run: bazel --version | |
- name: Update cmake | |
if: matrix.build_tool == 'cmake' | |
uses: jwlawson/[email protected] | |
- name: Show cmake version | |
if: matrix.build_tool == 'cmake' | |
run: cmake --version | |
- name: Show platform info | |
run: python -m platform | |
- name: Install virtualenv | |
run: | | |
sudo apt-get install python3-pip -y | |
sudo pip3 install virtualenv | |
- name: Show nproc | |
run: echo nproc=$(nproc) | |
- name: Build and run tests | |
run: bash ./scripts/build_and_run_tests_${{matrix.build_tool}}.sh -j $(nproc) |