diff --git a/.circleci/config.yml b/.circleci/config.yml index 4175da6c..ae8095a3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,26 +1,82 @@ -# Use the latest 2.1 version of CircleCI pipeline process engine. -# See: https://circleci.com/docs/configuration-reference version: 2.1 +orbs: + browser-tools: circleci/browser-tools@1.4.1 -# Define a job to be invoked later in a workflow. -# See: https://circleci.com/docs/configuration-reference/#jobs -jobs: - say-hello: - # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. - # See: https://circleci.com/docs/configuration-reference/#executor-job +jobs: # a collection of steps + dusk: # runs not using Workflows must have a `build` job as entry point + docker: # run the steps with Docker + - image: cimg/php:8.2.4-browsers # ...with this image as the primary container; this is where all `steps` will run + auth: + username: mydockerhub-user + password: $DOCKERHUB_PASSWORD # context / project UI env-var reference + working_directory: ~/laravel # directory where steps will run + steps: # a set of executable commands + - checkout # special step to check out source code to working directory + - run: sudo pecl install pcov + - run: sudo composer selfupdate + - restore_cache: # special step to restore the dependency cache if `composer.lock` does not change + keys: + - composer-v1-{{ checksum "composer.lock" }} + # fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/) + - composer-v1- + - run: composer install -n --prefer-dist + - save_cache: # special step to save the dependency cache with the `composer.lock` cache key template + key: composer-v1-{{ checksum "composer.lock" }} + paths: + - vendor + - restore_cache: # special step to restore the dependency cache if `package-lock.json` does not change + keys: + - node-v1-{{ checksum "package-lock.json" }} + # fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/) + - node-v1- + - run: npm ci + - save_cache: # special step to save the dependency cache with the `package-lock.json` cache key template + key: node-v1-{{ checksum "package-lock.json" }} + paths: + - node_modules + - run: touch database/testing.sqlite + - run: touch database/database.sqlite + - run: php artisan migrate --env=testing --database=sqlite_testing --force + - run: php artisan dusk:chrome-driver 70 + - run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + - run: sudo dpkg -i google-chrome-stable_current_amd64.deb + - run: sudo apt-get install -f + - run: npm run prod + - run: + name: Serve Application + background: true + command: php artisan serve + - run: php artisan dusk + - run: php artisan test + - store_artifacts: + path: ./tests/Browser/console + destination: console + - store_artifacts: + path: ./tests/Browser/screenshots + destination: screenshots + # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples + resource_class: large + + vue-tests: docker: - - image: cimg/base:stable - # Add steps to the job - # See: https://circleci.com/docs/configuration-reference/#steps + - image: cimg/node:20.2.0 + working_directory: ~/laravel steps: - checkout - - run: - name: "Say hello" - command: "echo Hello, World!" + - restore_cache: + keys: + - node-v1-{{ checksum "package-lock.json" }} + - node-v1- + - run: npm ci + - save_cache: + key: node-v1-{{ checksum "package-lock.json" }} + paths: + - node_modules + - run: npm run test # Assuming you have a "test" script in your package.json for running Vue tests -# Orchestrate jobs using workflows -# See: https://circleci.com/docs/configuration-reference/#workflows workflows: - say-hello-workflow: + version: 2 + build-and-test: jobs: - - say-hello + - dusk + - vue-tests