language: cpp
compiler:
  - gcc
jobs:
   include:
      - os: linux
        dist: focal
  # - osx
addons:
  apt:
    packages:
      - libpng-dev
      - zlib1g-dev
before_script:
  - mkdir build
  - cd build
  - curl -L https://github.com/Wargus/stratagus/archive/master.zip -O master.zip || true
  - unzip master.zip
  - cmake $EXTRA_CMAKE_FLAGS -DSTRATAGUS=stratagus -DSTRATAGUS_INCLUDE_DIR="$PWD/stratagus-master/gameheaders" ..
script: make
after_success:
  - "if [ $TRAVIS_OS_NAME == osx ]; then \
        if [ $TRAVIS_REPO_SLUG == Wargus/wargus -a \
             $TRAVIS_BRANCH == master -a \
             $TRAVIS_PULL_REQUEST == 'false' ]; then \
           cd $TRAVIS_BUILD_DIR;
           git clone https://${GH_TOKEN}@github.com/Wargus/stratagus.wiki.git;
           export STRATAGUS=$(pwd)/stratagus.wiki/$TRAVIS_OS_NAME/stratagus;
           mac/bundle.sh;
           tar czvf Wargus.app.tar.gz mac/Wargus.app;
           cp Wargus.app.tar.gz stratagus.wiki/$TRAVIS_OS_NAME/;
           cd stratagus.wiki/;
           git config --global user.email \"travis-ci@travis.org\";
           git config --global user.name \"Travis CI\";
           git add $TRAVIS_OS_NAME/Wargus.app.tar.gz;
           git commit --amend -C HEAD;
           git push -fq origin master;
           cd ..;
        fi;
    fi"
