dist: focal

arch:
  - amd64
  - arm64-graviton2

os: linux

language: shell

notifications:
  email:
  - team@appwrite.io

before_install:
- curl -fsSL https://get.docker.com | sh
- echo '{"experimental":"enabled"}' | sudo tee /etc/docker/daemon.json
- mkdir -p $HOME/.docker
- echo '{"experimental":"enabled"}' | sudo tee $HOME/.docker/config.json
- sudo service docker start
- >
  if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then
    echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin
  fi
- docker --version
- docker buildx create --use
- chmod -R u+x ./.travis-ci
- export COMPOSE_INTERACTIVE_NO_CLI=1
# Only pass a single runtime for CI stability
- echo "_APP_FUNCTIONS_RUNTIMES=php-8.0" >> .env

install:
- docker-compose up -d --build
- sleep 10

script:
- docker ps -a
- docker-compose logs appwrite
- docker-compose logs mariadb
- docker-compose logs appwrite-worker-functions
- docker-compose exec appwrite doctor
- docker-compose exec appwrite vars
- docker-compose exec appwrite test --debug
- docker-compose logs appwrite

after_failure:
- docker-compose logs appwrite

deploy:
  - provider: script
    edge: true
    script: ./.travis-ci/deploy.sh
    on:
      repo: appwrite/appwrite
      branch: deploy
