Skip to content

Commit

Permalink
Add CI testing using Github Actions.
Browse files Browse the repository at this point in the history
As Travis-CI is migrating, and will remove some options for OSS projects to get free workflows, we add github actions (we can remove travis CI afterwards).

It will look like this:
https://github.com/jblespiau/open_spiel-1/actions/runs/554623616

We only have a more recent version of MacOS, with Python 3.9. The current Travis do not specify the Python 3 version, while I explicitly pin it to be Python 3.7 here.

I kept the versions the same as in .travis.yml otherwise (we have a Python 3.6, for Nox testing, we should likely upgrade it to be 3.7, but I would prefer this to be an orthogonal change.

I just have a failure for the test with Julia:
https://github.com/jblespiau/open_spiel-1/runs/1595264912?check_suite_focus=true

It should be easy to fix this using in the install script:

```
  # This is needed on Ubuntu 19.10 and above, see:
  # google-deepmind#201
  if [[ "$JULIA_HOME" != "$HOME/packages/julias/julia-1.3.1" ]]; then
    if [[ -f /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ]]; then
      echo "Julia not in $HOME. Copy libstdc++.so.6 (requires sudo)"
      sudo cp -f /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $JULIA_HOME/lib/julia
```

but I simply disabled the test in this PR, and we can follow-up with that.

PiperOrigin-RevId: 356724390
Change-Id: I69141b172c73333daaefd60534376e38dc36fdea
  • Loading branch information
jblespiau committed Feb 10, 2021
1 parent 3e345fc commit af2d251
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: build_and_test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
matrix:
include:
# Build and run tests without all optional dependencies (default behavior)
# Ubuntu 18.04.2 LTS released on 26 April 2018
- os: ubuntu-18.04
OS_PYTHON_VERSION: 3.6
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
BUILD_WITH_ORTOOLS: "OFF"
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
- os: "ubuntu-20.04"
OS_PYTHON_VERSION: 3.8
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
BUILD_WITH_ORTOOLS: "OFF"
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
# Build and run tests with all optional dependencies, including building a
# shared library with linkable third party dependencies in place.
- os: ubuntu-20.04
DEFAULT_OPTIONAL_DEPENDENCY: "ON"
BUILD_WITH_JULIA: "OFF"
TRAVIS_USE_NOX: 0
BUILD_SHARED_LIB: "ON"
BUILD_WITH_ORTOOLS: "ON"
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: "https://github.com/google/or-tools/releases/download/v8.0/or-tools_ubuntu-20.04_v8.0.8283.tar.gz"
# macOS Catalina 10.15
- os: macos-10.15
OS_PYTHON_VERSION: 3.7
TRAVIS_USE_NOX: 0
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
BUILD_WITH_ORTOOLS: "OFF"
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
## Tests using PIP
# Build and run tests without all optional dependencies (default behavior) and
# use nox
- os: ubuntu-20.04
OS_PYTHON_VERSION: 3.8
TRAVIS_USE_NOX: 1
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
BUILD_WITH_ORTOOLS: "OFF"
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
- os: ubuntu-18.04
OS_PYTHON_VERSION: 3.6
TRAVIS_USE_NOX: 1
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
BUILD_WITH_ORTOOLS: "OFF"
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
- os: "macos-10.15"
OS_PYTHON_VERSION: 3.7
TRAVIS_USE_NOX: 1
DEFAULT_OPTIONAL_DEPENDENCY: "OFF"
BUILD_SHARED_LIB: "OFF"
BUILD_WITH_ORTOOLS: "OFF"
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""

runs-on: ${{ matrix.os }}
env:
OS_PYTHON_VERSION: ${{ matrix.OS_PYTHON_VERSION }}
TRAVIS_USE_NOX: ${{ matrix.TRAVIS_USE_NOX }}
DEFAULT_OPTIONAL_DEPENDENCY: ${{ matrix.DEFAULT_OPTIONAL_DEPENDENCY }}
BUILD_WITH_JULIA: ${{ matrix.BUILD_WITH_JULIA }}
BUILD_SHARED_LIB: ${{ matrix.BUILD_SHARED_LIB }}
BUILD_WITH_ORTOOLS: ${{ matrix.BUILD_WITH_ORTOOLS }}
BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ${{ matrix.BUILD_WITH_ORTOOLS_DOWNLOAD_URL }}

steps:
- uses: actions/checkout@v2
- name: Install
run: |
pwd
chmod +x install.sh
./install.sh
- name: Build and test
run: |
python3 --version
./open_spiel/scripts/travis_script.sh
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[![Documentation Status](https://readthedocs.org/projects/openspiel/badge/?version=latest)](https://openspiel.readthedocs.io/en/latest/?badge=latest)
[![Build Status](https://travis-ci.org/deepmind/open_spiel.svg?branch=master)](https://travis-ci.org/deepmind/open_spiel)
![build_and_test](https://github.com/deepmind/open_spiel/workflows/build_and_test/badge.svg)

OpenSpiel is a collection of environments and algorithms for research in general
reinforcement learning and search/planning in games. OpenSpiel supports n-player
Expand Down
9 changes: 9 additions & 0 deletions open_spiel/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,19 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${OS_PYTHON_VERSION} 10
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OSX
brew search python
[[ -x `which realpath` ]] || brew install coreutils || echo "** Warning: failed 'brew install coreutils' -- continuing"
[[ -x `which cmake` ]] || brew install cmake || echo "** Warning: failed 'brew install cmake' -- continuing"
[[ -x `which python3` ]] || brew install python3 || echo "** Warning: failed 'brew install python3' -- continuing"
# On Github Actions, macOS 10.15 comes with Python 3.9.
# Only 3.8 is supported by Tensorflow 2.2, and only 3.7 currently runs on CI.
if [[ "$CI" ]]; then
brew install "python@${OS_PYTHON_VERSION}"
brew unlink python@3.9
brew link --force --overwrite "python@${OS_PYTHON_VERSION}"
fi
`python3 -c "import tkinter" > /dev/null 2>&1` || brew install tcl-tk || echo "** Warning: failed 'brew install tcl-tk' -- continuing"
python3 --version
[[ -x `which clang++` ]] || die "Clang not found. Please install or upgrade XCode and run the command-line developer tools"
[[ -x `which curl` ]] || brew install curl || echo "** Warning: failed 'brew install curl' -- continuing"
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Expand Down

0 comments on commit af2d251

Please sign in to comment.