Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.19 KiB
Newer Older
image: code.podlibre.org:5050/podlibre/castopod-host:latest
lint-commit-msg:
  stage: quality
  script:
    - chmod +x ./scripts/lint-commit.sh
    # lint commit message
    - ./scripts/lint-commit.sh
  before_script:
    # Install all php dependencies
    - composer install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
    # phpstan - increase memory limit to 1GB to prevent script failure
    - php -d memory_limit=1G vendor/bin/phpstan analyse --ansi
    - vendor/bin/rector process --dry-run --ansi
  before_script:
    # Install all npm dependencies
    - npm ci --cache .npm --prefer-offline
  script:
    - npm run prettier
    - npm run typecheck
    - npm run eslint
    - npm run stylelint

tests:
  stage: quality
  script:
    # run phpunit without code coverage
    # TODO: add code coverage
    - vendor/bin/phpunit --no-coverage

    # 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}"
    # 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