Giter Club home page Giter Club logo

dais's Introduction

Dais

Build Status Code Climate Code Climate Codecov

Dais holds back CirclCI/Github Actions builds on GitHub pull requests until Platform.sh has brought up the corresponding environment.

It is meant as a helper utility for running browser based tests on CircleCI/Github Actions against a Platform.sh environment.

Prerequisites

Platform.sh must be setup with GitHub integration and --build-pull-requests=true.

If using CircleCI, it must be set up to only build pull requests. Otherwise it will build as soon as a branch is pushed, before the pull request is created, and thus the build environment doesn't get the pull request variables needed to find the corresponding Platform.sh environment.

If using Github Actions, the workflow should trigger on pull_request.

Some tests to run. The framework used is not important, as long as it has a configuration file with the URL to use.

Usage

Set up the DAIS_PLATFORMSH_KEY and DAIS_PLATFORMSH_ID env variables on in CI.

Add the phar file to the commands run on CI and give it the configuration file of the test framework as argument. The file should have a %site-url% placeholder that will be replaced with the URL of the Platform.sh environment, with any trailing slashes stripped.

If your Platform.sh project uses Routes you can refer to route URLs using the pattern %route-url:[route-index]%. %route-url:1% is the URL to the first route etc.

Working .circleci/config.yml:

version: 2

jobs:
  build:
    docker:
      - image: notnoopci/php:7.1.5-browsers
    working_directory: ~/build
    steps:
      - checkout
      # Set a timezone to avoid PHP notices/errors in date functions.
      - run: |
          echo "date.timezone = UTC" | sudo tee /usr/local/etc/php/conf.d/date.ini
          composer install
          wget https://github.com/xendk/dais/releases/download/0.9.0/dais-0.9.0.phar
          php dais-0.9.0.phar --sha $CIRCLE_SHA1 --pr-number $CI_PULL_REQUEST behat.yml
          ./vendor/bin/behat --format=junit --out=/tmp/test-reports/behat --format=pretty --out=std
      - store_test_results:
          path: /tmp/test-reports/

The equivalent command for Github Actions:

php dais-0.9.0.phar --sha ${{github.event.pull_request.head.sha}} --pr-number ${{github.event.pull_request.number}} behat.yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.