Files
medusa-store/.github/workflows/test-cli-with-database.yml
Philip Korsholm aca90a47ac Feat(medusa): Integration testing of cli (#1689)
* add initial testing files

* prepare for github

* remove empty files

* remove ids

* set user and password for postgres service

* remove node setup

* remove unused flag from yarn install

* correct medusajs package

* arguments for create-medusa project

* make create command into one line

* working directory update

* update workflow

* add build

* run scripts from medusa-cli

* move scripts to medusa-cli

* add install

* get server output

* rename build to install

* update login script to get feedback

* add arguments to login script

* add argument for directory to get-product

* pass cli-test to get-products script

* add wait command

* fix waiting

* update wait-for-server

* echo status

* update start testing

* refactor code into test-action

* add list config for testing

* include shell

* update get-products script

* test to see if action fails when given wrong input

* use custom action for testing devleopment server and extend waiting for server to spin up

* update actions

* remove cache version

* yarn and build in cli-test directory

* update core

* update working directories

* test working dir after cd up

* update

* fix directories

* update directories

* use setup server action

* invoke correct action

* test

* update cli action

* remove action

* test with medusa-dev

* remove medusa dev for now

* test

* include medusa-dev

* remove invalid medusa new command

* try moving project one dir up

* add silent to curl output from live server wait

* update seed data directory

* test

* remove sub workflow

* add matrix and postgres override for medusa-config

* fix matrix syntax

* add database url to job

* update yaml

* cli should fail on logging in

* create setup server action

* update test-server

* update scripts

* run scripts directory instead of cli scripts

* make directories current

* remove tests from cli

* run only on pr

* update name

* remove batch job model (for testing purposes)

* remove ls from test server action

* get content from develop

* undo changes to generate reference

* remove comments from scripts

* test failing command

* redo migrate command failing

* move scripts into interation tests

* Apply suggestions from code review

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2022-06-17 11:53:41 +02:00

101 lines
2.6 KiB
YAML

name: CLI Pipeline
on: [pull_request]
jobs:
test-cli-with-database:
env:
REDIS_URL: redis://localhost:6379
DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
strategy:
matrix:
db: [sqlite, postgres]
services:
redis:
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: cli-test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.5
with:
fetch-depth: 0
- name: Setup development server
uses: ./.github/actions/setup-server
with:
cache-extension: "cli-test"
- name: Install Medusa cli
run: yarn global add @medusajs/medusa-cli
- name: Create Medusa project
run: |
medusa new cli-test
working-directory: ..
- name: Install postgres config
if: matrix.db == 'postgres'
run: |
curl \
https://raw.githubusercontent.com/medusajs/medusa-starter-default/feat/postgres-config/medusa-config.js \
--output medusa-config.js
working-directory: ../cli-test
- name: run medusa dev
run: medusa-dev --force-install
working-directory: ../cli-test
- name: Run migrations
run: medusa migrations run
working-directory: ../cli-test
- name: Seed db
run: yarn seed
working-directory: ../cli-test
- name: Create admin user
run: medusa user -e test@test.com -p password -i admin_123
working-directory: ../cli-test
########################## Test medusa develop ###############################
- name: Run development server
run: medusa develop > /dev/null 2>&1 &
working-directory: ../cli-test
- name: Testing development server
uses: ./.github/actions/test-server
########################### Test medusa start ################################
- name: Starting medusa
run: medusa start > /dev/null 2>&1 &
working-directory: ../cli-test
- name: Testing server
uses: ./.github/actions/test-server