Skip to content

Commit

Permalink
chore(#81): add poc ci config files
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Sep 2, 2022
1 parent 5f6e605 commit c9a4204
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 0 deletions.
136 changes: 136 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
version: 2.1

defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:16.17

jobs:
build:
<<: *defaults
steps:
- checkout

- run:
name: Install Codecov
command: yarn add codecov

- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found.
- v1-dependencies-

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- persist_to_workspace:
root: ~/repo
paths:
- .

# lint:
# <<: *defaults
# steps:
# - attach_workspace:
# at: ~/repo

# - run:
# name: Run lint
# command: yarn lint --format ./node_modules/eslint-junit/index.js
# environment:
# ESLINT_JUNIT_OUTPUT: ./reports/junit/eslint.xml

# - run:
# name: Renovate config validator
# command: yarn lint:renovate

# - run:
# name: Bundlewatch
# command: yarn bundlewatch

# test_unit:
# <<: *defaults
# steps:
# - attach_workspace:
# at: ~/repo

# - run:
# name: Run unit tests
# command: yarn test:unit --reporters=jest-junit --runInBand
# environment:
# JEST_JUNIT_OUTPUT_DIR: ./reports/junit/
# NODE_OPTIONS: --max_old_space_size=8192

# - run:
# name: Upload coverage report
# command: yarn dlx codecov

# - store_test_results:
# path: ./reports/junit/

# - store_artifacts:
# path: ./reports/junit

test_e2e:
machine:
image: ubuntu-2004:2022.07.1
working_directory: ~/repo
environment:
DDEV_NONINTERACTIVE: "true"
steps:
- attach_workspace:
at: ~/repo

- run:
name: Install ddev
command: |
curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh && bash install_ddev.sh
- run:
name: Start server running
command: |
cd docs/drupal && ddev start -y
- run:
name: Install Drupal
command: |
cd docs/drupal && ddev drupal-install
- run:
name: Install cypress
command: npx cypress install

- run:
name: Run end-to-end tests
command: yarn test:e2e
# - store_artifacts:
# path: ./examples/druxt-site/test/cypress/screenshots
# - store_artifacts:
# path: ./examples/druxt-site/test/cypress/videos

# - run:
# name: Run DruxtJS.org end-to-end tests
# command: yarn docs:test
# - store_artifacts:
# path: ./docs/nuxt/test/cypress/screenshots
# - store_artifacts:
# path: ./docs/nuxt/test/cypress/videos

workflows:
version: 2

build_test:
jobs:
- build
# - lint:
# requires:
# - build
# - test_unit:
# requires:
# - build
- test_e2e:
requires:
- build
54 changes: 54 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
stages:
- build
- test

cache:
paths:
- drupal/vendor/

build:
stage: build
image: php:7.4
before_script:
- apt-get update -yqq
- apt-get install -yqq git libpq-dev libcurl4-gnutls-dev libicu-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev libonig-dev libzip-dev nodejs

# Install PHP extensions
- docker-php-ext-install mbstring pdo_pgsql curl intl gd xml zip bz2 opcache

# Install Composer
- curl -sS https://getcomposer.org/installer | php

# Install NVM and Yarn
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
- export NVM_DIR="$HOME/.nvm" && . "$NVM_DIR/nvm.sh" --no-use
- nvm install && nvm use
- npm install --global yarn

script:
# Validate and build composer packages.
- cd drupal && php composer.phar validate && php composer.phar install

# Install and build Nuxt.
- cd ../nuxt && npm install && npm run build
artifacts:
paths:
- drupal/web

test_e2e:
stage: test
image: drud/ddev-gitpod-base:20220817
dependencies:
- build
services:
- name: docker:dind
alias: dockerdaemon
variables:
DOCKER_HOST: tcp://dockerdaemon:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
before_script:
- sudo chown -R gitpod:gitpod .
script:
# Start DDev and install the Drupal backend.
- cd drupal && ddev start -y && ddev drupal-install

0 comments on commit c9a4204

Please sign in to comment.