diff --git a/.github/actions/test-server/action.yml b/.github/actions/test-server/action.yml index 5bdf141b24..3956e1bea9 100644 --- a/.github/actions/test-server/action.yml +++ b/.github/actions/test-server/action.yml @@ -1,5 +1,5 @@ name: "Test server" -description: "Test the currently running medusa server to see if a user has been created and that the server is seeded" +description: "Test the currently running medusa server to see if a user has been created" inputs: email: @@ -10,10 +10,11 @@ inputs: description: "password of user to log in" required: false default: "password" - pathToSeedData: - description: "path to seed data" - required: false - default: "../cli-test/data/seed.json" + # TODO: Add back seed test + # pathToSeedData: + # description: "path to seed data" + # required: false + # default: "../cli-test/data/seed.json" runs: using: "composite" @@ -24,9 +25,9 @@ runs: - name: Log in with user shell: "bash" run: ./integration-tests/scripts/cli/login.sh ${{ inputs.email }} ${{ inputs.password }} - - name: GetProducts - shell: "bash" - run: ./integration-tests/scripts/cli/get-products.sh ${{ inputs.pathToSeedData }} + # - name: GetProducts + # shell: "bash" + # run: ./integration-tests/scripts/cli/get-products.sh ${{ inputs.pathToSeedData }} - name: Kill server shell: "bash" diff --git a/.github/workflows/test-cli-with-database.yml b/.github/workflows/test-cli-with-database.yml index 4e55729817..9e0bdf7281 100644 --- a/.github/workflows/test-cli-with-database.yml +++ b/.github/workflows/test-cli-with-database.yml @@ -1,90 +1,82 @@ -#name: CLI Pipeline -#on: -# pull_request: -# -#jobs: -# test-cli-with-database: -# env: -# NODE_ENV: CI -# REDIS_URL: redis://localhost:6379 -# DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test" -# 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@v3 -# with: -# fetch-depth: 0 -# -# - name: Setup development server -# uses: ./.github/actions/setup-server -# with: -# cache-extension: "cli-test" -# node-version: "16.14" -# -# - name: Install Medusa cli -# run: npm i -g @medusajs/medusa-cli -# -# - name: Create Medusa project -# run: | -# medusa new cli-test --skip-db -# working-directory: .. -# -# - 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 & -# working-directory: ../cli-test -# -# - name: Testing development server -# uses: ./.github/actions/test-server -# -# Test medusa start -# -# - name: Starting medusa -# run: medusa start & -# working-directory: ../cli-test -# -# - name: Testing server -# uses: ./.github/actions/test-server +name: CLI Pipeline +on: + pull_request: + +jobs: + test-cli-with-database: + env: + NODE_ENV: CI + REDIS_URL: redis://localhost:6379 + DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test" + POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test" + services: + redis: + image: redis + 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@v3 + with: + fetch-depth: 0 + + - name: Setup development server + uses: ./.github/actions/setup-server + with: + cache-extension: "cli-test" + node-version: "16.14" + + - name: Install Medusa cli + run: npm i -g @medusajs/medusa-cli@preview + + - name: Create Medusa project + run: | + medusa new cli-test --skip-db --v2 + working-directory: .. + + - 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: Create admin user + run: medusa user -e test@test.com -p password -i admin_123 + working-directory: ../cli-test + + - name: Run development server + run: medusa develop & + working-directory: ../cli-test + + - name: Testing development server + uses: ./.github/actions/test-server + + - name: Starting medusa + run: medusa start & + working-directory: ../cli-test + + - name: Testing server + uses: ./.github/actions/test-server diff --git a/integration-tests/scripts/cli/login.sh b/integration-tests/scripts/cli/login.sh index bf9ab24e2f..a4a99df646 100755 --- a/integration-tests/scripts/cli/login.sh +++ b/integration-tests/scripts/cli/login.sh @@ -5,7 +5,7 @@ status_code=$(curl \ -H "Content-Type: application/json"\ -d '{"email":"'$1'", "password":"'$2'"}'\ --write-out %{http_code}\ - http://localhost:9000/admin/auth) + http://localhost:9000/auth/admin/emailpass) if [[ "$status_code" -ne 200 ]] ; then echo "Site status changed to $status_code"