Github action: UnhandledPromiseRejectionWarning: Error: Project not found: 'default#default' on while seeding database - github

on github action after deploying prisma I want to seed the database. but this gives me project not found error. why this error is showing even after prisma is deployed?
this is my yaml file
name: "Github Actions Test"
on:
push:
branches:
- wip/checkout2
jobs:
test:
runs-on: ubuntu-latest
env:
PRISMA_ENDPOINT: ${{secrets.PRISMA_ENDPOINT}}
PRISMA_SECRET: ${{secrets.PRISMA_SECRET}}
steps:
- uses: actions/checkout#v1
- name: "Install Node"
uses: actions/setup-node#v1
with:
node-version: "12.x"
- name: "Install global packages"
run: npm install -g yarn prisma-cli concurrently mocha wait-port
- name: "Run docker Container"
run: docker-compose -f docker-compose.yml up --build -d
- name: "Install deps"
run: yarn install
- name: "prisma deploy"
run: yarn deploy:backend
- name: "Seed Backend"
run: yarn seed:backend
- name: "Build app"
run: yarn build
- name: "Start backend and frontend concurrently on background and run tests"
run: |
yarn start &
yarn test

Related

PNPM Github actions flow

I just moved my project from npm and lerna to pnpm but now when using GitHub actions I get the following error
"line 1: pnpm: command not found"
can someone suggest how the .yml file should be, I've posted the current version below?
name: Lint & Unit Test
on: [pull_request]
jobs:
run-linters:
name: Run linter and Unit tests
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout#v3
- name: ACTIONS_ALLOW_UNSECURE_COMMANDS
run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV
- name: Set up Node.js
uses: actions/setup-node#v3
with:
node-version: 16.18.1
- name: Portal Install Node.js dependencies
working-directory: ./portals
run: |
pnpm install
- name: Portals Lint & tests
working-directory: ./portals
run: |
cat .env.example > .env
pnpm run build:tailwind
pnpm run lint
pnpm test
- name: Services Install Node.js dependencies
working-directory: ./services
run: |
pnpm install
- name: Services Lint & tests
working-directory: ./services
run: |
pnpm run lint
pnpm test
You might need to use first the pnpm/action-setup action, in order to install pnpm.
on:
- push
- pull_request
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup#v2
with:
version: 6.0.2

Github actions workflow error: You have an error in your yaml syntax

I am trying to deploy to google cloud engine using github actions and my yaml config is as follows,
name: "Deploy to GAE"
on:
push:
branches: [production]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Install Dependencies
run: composer install -n --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: GCP Authenticate
uses: GoogleCloudPlatform/github-actions/setup-gcloud#master
with:
version: "273.0.0"
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Set GCP_PROJECT
env:
GCP_PROJECT: ${{ secrets.GCP_PROJECT }}
run: gcloud --quiet config set project ${GCP_PROJECT}
- name: Deploy to GAE
run: gcloud app deploy app.yaml
and github actions is throwing me the below error
Invalid workflow file: .github/workflows/main.yml#L10
You have an error in your yaml syntax on line 10
fyi, line #10 is - uses: actions/checkout#v2
The steps indentation level is incorrect, it should be inside deploy
name: "Deploy to GAE"
on:
push:
branches: [production]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Install Dependencies
run: composer install -n --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: GCP Authenticate
uses: GoogleCloudPlatform/github-actions/setup-gcloud#master
with:
version: "273.0.0"
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Set GCP_PROJECT
env:
GCP_PROJECT: ${{ secrets.GCP_PROJECT }}
run: gcloud --quiet config set project ${GCP_PROJECT}
- name: Deploy to GAE
run: gcloud app deploy app.yaml

Every step must define a `uses` or `run` key GH actions

I am trying to setup yaml file for github actions. However I am not sure what am I doing wrong, I've added uses and run for every step but it still throws the error.
I am getting the following error:
every step must define a `uses` or `run` key
on:
pull_request:
branches:
- master
jobs:
ios:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout#v2
- name: Setup java
uses: actions/setup-java#v1
- name: Setup Flutter
uses: subosito/flutter-action#v1
with:
flutter-version: '2.8.1'
- run: flutter pub get
- run: flutter build apk
- name: Install pods
- run: cd ./ios && pod install
- name: Run fastlane
uses: maierj/fastlane-action#v1.4.0
You have an error here:
- name: Install pods
- run: cd ./ios && pod install
It should be:
- name: Install pods
run: cd ./ios && pod install

ci github-actions "env-cmd: not found"

I am trying to setup a CI workflow with github-actions and run in a few problems.
The idea:
Create build and upload as artifact
Download artifact, run 4 different runners that use the downloaded artifact and run the tests.
Issue:
I can manage to run the build and upload, it also downloads the artifacts but then I got stuck with error:
My workflow file
name: CI Pull Request
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
env:
CI: false
jobs:
install:
runs-on: ubuntu-latest
container: cypress/browsers:node12.18.3-chrome87-ff82
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Run install & build
run: |
npm ci
npm run build --if-present
- name: Save build folder
uses: actions/upload-artifact#v2
with:
name: build
if-no-files-found: error
path: build
- name: Cypress install
uses: cypress-io/github-action#v2
with:
# Disable running of tests within install job
runTests: false
build: npm build
ui-chrome-tests:
runs-on: ubuntu-latest
container: cypress/browsers:node12.18.3-chrome87-ff82
needs: install
strategy:
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1, 2, 3, 4, 5]
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Download the build folders
uses: actions/download-artifact#v2
with:
name: build
path: build
- name:
- name: "UI Tests - Chrome"
uses: cypress-io/github-action#v2
with:
# we have already installed all dependencies above
install: false
start: |
npm install env-cmd
npm run start
wait-on: "http://localhost:3000"
wait-on-timeout: 120
browser: chrome
record: false
parallel: true
group: "UI - Chrome"
spec: cypress/tests/ui/*
command: npm run e2e
env:
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
And my package.json:
"scripts": {
"e2e": "cypress run",
"test:cypress": "run-p --race start e2e",
"start": "rm -f .env; sh -ac 'env-cmd -f .env.local craco start'",
"build": "craco build",
"test": "craco test",
"cypress:open": "cypress open",
"eject": "react-scripts eject",
"format": "prettier --write src/**/*",
"lint": "eslint --fix src/**/*",
"deploy:staging": "./deploy.sh -s",
"deploy:production": "./deploy.sh -p"
},
Any hints/ tipps how to solve it? I thought by running npm install and uploading + downloading the artifact env-cmd should be available?
Thanks and much appreciation!
Made a workaround by adding everything into each container for now.
name: CI Pull Request
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- master
pull_request:
types: [assigned, opened, synchronize, reopened, ready_for_review]
branches:
- master
env:
CI: false
jobs:
ui-chrome-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container: cypress/browsers:node12.18.3-chrome87-ff82
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Run Server
run: |
npm ci
npm run start & npx wait-on http://localhost:3000
- name: "UI Tests - Chrome"
uses: cypress-io/github-action#v2
with:
install: false
start: npm run e2e
browser: chrome
spec: cypress/integration/**
env:
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Github Action: [!] Error: Cannot find module 'rollup-plugin-commonjs'

In my package.json there are rollup and rollup-plugin-commonjs
but inside github actions it could not find those packages!
If I do not add rollup in global package installation step of github-action it shows that rollup is not found. But after adding both rollup and rollup-plugin-commonjs I get [!] Error: Cannot find module 'rollup-plugin-commonjs'
this is my workflow file:
name: Github Action
on:
push:
branches:
- fix/auto-test
jobs:
test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout#v1
- name: Bootstrap app on Ubuntu
uses: actions/setup-node#v1
with:
node-version: '11.x.x'
- name: Install global packages
run: npm install -g prisma rollup rollup-plugin-commonjs
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Project dependencies test
uses: actions/cache#v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install project deps
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn
- name: Run docker
run: docker-compose -f docker-compose.test.prisma.yml up --build -d
- name: Sleep
uses: jakejarvis/wait-action#master
with:
time: '30s'
- name: Reset the database for safety
run: yarn reset:backend
- name: Deploy
run: yarn deploy:backend
- name: Build this great app
run: yarn build
- name: start app and worker concurrently and create some instances
run: |
yarn start &
yarn start:worker &
xvfb-run --auto-servernum yarn test:minimal:runner