Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.29 KiB
Newer Older

cache:
  paths:
    - vendor/
    - node_modules/

before_script:
  - apt-get update -y

  # Install git which is required by composer (the php image doesn't have it)
  - apt-get install git -y

  - apt-get install -y libicu-dev

  - docker-php-ext-install intl

  # Install composer
  - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  - php composer-setup.php
  - php -r "unlink('composer-setup.php');"

  # Install NodeJS for NPM
  - curl -sL https://deb.nodesource.com/setup_lts.x | bash -
  - apt-get update && apt-get install -y nodejs

  - php composer.phar install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
    # run phpunit without code coverage
    # TODO: add code coverage
    - vendor/bin/phpunit --no-coverage

code-style:
  stage: quality
  script:
    - vendor/bin/ecs check --ansi
    - vendor/bin/rector process --dry-run --ansi
bundle_app:
  stage: bundle
  script:
    # make scripts/bundle.sh executable
    - chmod +x ./scripts/bundle-prepare.sh
    - chmod +x ./scripts/bundle.sh
    # bundle castopod-host with commit ref as version
    - ./scripts/bundle-prepare.sh
    - ./scripts/bundle.sh ${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}
    name: "castopod-host-${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
      - castopod-host-${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}
  except:
    - main
    - beta
    - alpha

release_app:
  stage: release
  script:
    # make release scripts executable
    - chmod +x ./scripts/bundle-prepare.sh
    - chmod +x ./scripts/bundle.sh
    - chmod +x ./scripts/package.sh
    # prepare bundle before release, both bundle and package scripts will be run by semantic-release
    - ./scripts/bundle-prepare.sh
    # IMPORTANT: delete local git tags before release to prevent eventual script failure (ie. tag already exists)
    - git tag | xargs git tag -d

    # run semantic-release script (configured in `.releaserc.json` file)
    - npm run release
  only:
    - main
    - alpha
    - beta