authelia/.travis.yml
Amir Zarrinkafsh 58734a9d7a Optimise Travis build and deploy steps
These should only run on the master or tagged branches. This also means that while we are utilising Travis that there aren't long 20-30 blocks waiting on a PR to go green due to the build steps.
2020-01-03 09:01:29 +01:00

131 lines
3.6 KiB
YAML

language: go
required: sudo
go:
- "1.13"
services:
- docker
addons:
chrome: stable
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
install:
- export PATH=$PATH:./cmd/authelia-scripts/:/tmp
- source bootstrap.sh
jobs:
include:
- stage: build & test
before_script:
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
- nvm install v12 && nvm use v12
- go mod download
script:
- authelia-scripts --log-level debug ci
# Run all suites in a dedicated container
- &e2e-test
stage: end-to-end suite tests
env:
- SUITE_NAME=BypassAll
before_script:
# Install chrome driver
# TODO(c.michaud): this could be done in authelia-scripts instead for devs to not do the install themselves.
# or even provide a docker image with a selenium server.
- wget -N https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_linux64.zip -P ~/
- unzip ~/chromedriver_linux64.zip -d ~/
- rm ~/chromedriver_linux64.zip
- sudo mv -f ~/chromedriver /usr/bin/chromedriver
- sudo chmod +x /usr/bin/chromedriver
- sudo ln -s /usr/bin/google-chrome-stable /usr/bin/chromium-browser
- go mod download
script:
# Run the suite
- authelia-scripts --log-level debug suites test $SUITE_NAME --headless
# TODO(c.michaud): check if all suites are listed based on `authelia-scripts suites list` command.
- <<: *e2e-test
env:
- SUITE_NAME=Docker
- <<: *e2e-test
env:
- SUITE_NAME=DuoPush
- <<: *e2e-test
env:
- SUITE_NAME=HighAvailability
- <<: *e2e-test
env:
- SUITE_NAME=Kubernetes
- <<: *e2e-test
env:
- SUITE_NAME=LDAP
- <<: *e2e-test
env:
- SUITE_NAME=Mariadb
- <<: *e2e-test
env:
- SUITE_NAME=NetworkACL
- <<: *e2e-test
env:
- SUITE_NAME=Postgres
- <<: *e2e-test
env:
- SUITE_NAME=ShortTimeouts
- <<: *e2e-test
env:
- SUITE_NAME=Standalone
- <<: *e2e-test
env:
- SUITE_NAME=Traefik
- &build-images
stage: build images
if: branch = "master" && type != "pull_request" || branch =~ /^v/
env:
- ARCH=amd64
script:
- while sleep 9m; do echo '===== Prevent build from terminating ====='; done &
- authelia-scripts docker build --arch=$ARCH
- kill %1
after_success:
- authelia-scripts docker push-image --arch=$ARCH
before_deploy:
- docker create --name authelia-binary authelia/authelia:${TRAVIS_TAG:1}-$ARCH
- docker cp authelia-binary:/usr/app/authelia ./authelia-linux-$ARCH
- docker cp authelia-binary:/usr/app/public_html ./
- tar -czf authelia-linux-$ARCH.tar.gz authelia-linux-$ARCH public_html
- sha256sum authelia-linux-$ARCH.tar.gz > authelia-linux-$ARCH.tar.gz.sha256
deploy:
provider: releases
api_key: "$GITHUB_API_KEY"
file_glob: true
file: "authelia-linux-$ARCH.tar.gz*"
skip_cleanup: true
on:
tags: true
- <<: *build-images
env:
- ARCH=arm32v7
- <<: *build-images
env:
- ARCH=arm64v8
- stage: deploy manifests
if: branch = "master" && type != "pull_request" || branch =~ /^v/
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
script:
- authelia-scripts docker push-manifest
notifications:
email:
recipients:
- clement.michaud34@gmail.com
on_success: change
on_failure: always