This example demonstrates how a CI setup using Travis CI can look like.
The prisma
cli is the core component of your development workflow. prisma
should be installed as a global dependency, you can install this with npm install -g prisma
Clone the Prisma monorepo and navigate to this directory or download only this example with the following command:
curl https://codeload.github.com/prismagraphql/prisma/tar.gz/master | tar -xz --strip=2 prisma-master/examples/travis
Next, navigate into the downloaded folder and initiate a new git repository:
cd travis
git init .
In your GitHub account, create a new repository and copy its git URL, for example:
git@github.com:marktani/travis-prisma.git
Add a new remote to your local git repository:
git remote add origin git@github.com:marktani/travis-prisma.git
Now, link your GitHub account in your Travis CI account, and push the downloaded example to your repository:
git push --set-upstream origin master
In your Travis CI account, review the build and confirm that the build went through.
Here is a description of the performed steps that are expected to happen (compare to .travis.yml
as well):
- We install the
npm
dependencies withnpm install
. - We spin up a new Prisma server and database using
docker-compose up -d
. - We confirm that the Docker setup is correct with
docker ps
. - We sleep 20 seconds to allow for the two Docker containers to finish their setup.
- We run
prisma deploy
with the locally installed version of Prisma. This will set up a new servicetravis
at stagetest
and seed some data according toprisma.yml
. - We run a short test script that queries the new service and checks the result against the expected result in
test.txt
. - We output a success message.