Lullabot / drupal9ci

Command Line Interface for implementing Continuous Integration in Drupal 9
GNU General Public License v3.0
161 stars 55 forks source link

Cannot touch 'storage/testing.sqlite': No such file or directory #59

Closed safetypins closed 2 years ago

safetypins commented 3 years ago

I ran the install script, and have made a few changes. This is what I got from the install:

# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
  build:
    docker:
      # Specify the version you desire here
      - image: circleci/php:7.1-browsers

    steps:
      - checkout

      - run: sudo apt update # PHP CircleCI 2.0 Configuration File# PHP CircleCI 2.0 Configuration File sudo apt install zlib1g-dev libsqlite3-dev
      - run: sudo apt-get update
      - run: sudo apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
      - run: sudo docker-php-ext-configure gd --with-freetype --with-jpeg
      - run: sudo docker-php-ext-install -j$(nproc) gd

      # Download and cache dependencies
      - restore_cache:
          keys:
            # "composer.lock" can be used if it is committed to the repo
            - v1-dependencies-{{ checksum "composer.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: composer install -n --prefer-dist

      - save_cache:
          key: v1-dependencies-{{ checksum "composer.json" }}
          paths:
            - ./vendor
      - restore_cache:
          keys:
            - node-v1-{{ checksum "package.json" }}
            - node-v1-
      - run: yarn install
      - save_cache:
          key: node-v1-{{ checksum "package.json" }}
          paths:
            - node_modules

      # prepare the database
      - run: touch storage/testing.sqlite
      - run: php artisan migrate --env=testing --database=sqlite_testing --force

      # run tests with phpunit or codecept
      #- run: ./vendor/bin/phpunit
      - run: ./vendor/bin/codecept build
      - run: ./vendor/bin/codecept run

And this is what I'm currently running:

# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
  build:
    docker:
      # Specify the version you desire here
      - image: circleci/php:7.4-node-browsers

    steps:
      - checkout

      - run: sudo apt update # PHP CircleCI 2.0 Configuration File# PHP CircleCI 2.0 Configuration File sudo apt install zlib1g-dev libsqlite3-dev
      - run: sudo apt-get update
      - run: sudo apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
      - run: sudo docker-php-ext-configure gd --with-freetype --with-jpeg
      - run: sudo docker-php-ext-install -j$(nproc) gd

      # Download and cache dependencies
      - restore_cache:
          keys:
            # "composer.lock" can be used if it is committed to the repo
            - v1-dependencies-{{ checksum "composer.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-{{ checksum "package.json" }}

      - run: composer install -n --prefer-dist

      - save_cache:
          key: v1-dependencies-{{ checksum "composer.json" }}
          paths:
            - ./vendor
      - restore_cache:
          keys:
            - node-v1-{{ checksum "package.json" }}
      - run: yarn install
      - save_cache:
          key: node-v1-{{ checksum "package.json" }}
          paths:
            - node_modules

      # prepare the database
      - run: touch storage/testing.sqlite
      - run: php artisan migrate --env=testing --database=sqlite_testing --force

      # run tests with phpunit or codecept
      #- run: ./vendor/bin/phpunit
      - run: ./vendor/bin/codecept build
      - run: ./vendor/bin/codecept run

I had to add the install command to get php's gd library installed. I also changed the image to 7.4-node-browsers, because I needed a newer php version, and the yarn install command was failing without node.

This is the error message related to sqlite:

#!/bin/bash -eo pipefail
touch storage/testing.sqlite
touch: cannot touch 'storage/testing.sqlite': No such file or directory

Exited with code exit status 1
CircleCI received exit code 1

I'm not actually sure I need sqlite - I'm planning to run visual regression tests against my staging environments.

juampynr commented 3 years ago
 # prepare the database
 - run: touch storage/testing.sqlite
 - run: php artisan migrate --env=testing --database=sqlite_testing --force

This is common in Laravel projects. Are you running a Laravel project alongside a Drupal one? Otherwise you may not need these two lines.

The error in particular, touch: cannot touch 'storage/testing.sqlite': No such file or directory states that the system can't create testing.sqlite because storage does not exist. However, you may not need these two lines anyway.