Skip to content

Commit

Permalink
add ci gh action, make deploy depend on tests job
Browse files Browse the repository at this point in the history
  • Loading branch information
carafelix committed Jun 20, 2024
1 parent 3ddf0e8 commit da24872
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: tests

on:
push:
branches:
- main
- dev

jobs:
tests:
runs-on: ubuntu-latest
name: tests
env:
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
XATA_DB: ${{secrets.XATA_DB}}
SUDO_SECRET: ${{ secrets.SUDO_SECRET }}
steps:
- uses: actions/checkout@v4
- run: |
touch .dev.vars
echo SUDO_SECRET="$SUDO_SECRET" >> .dev.vars
echo XATA_API_KEY="$XATA_API_KEY" >> .dev.vars
echo XATA_DB="$XATA_DB" >> .dev.vars
- run: npm install
- run: npm run test

10 changes: 7 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Deploy

on:
push:
branches:
- main
workflow_run:
workflows: ["tests"]
branches: [main]
types:
- completed


jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
name: Deploy
steps:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "cloudflare-workers-openapi",
"name": "poesia-api",
"version": "0.0.1",
"private": true,
"scripts": {
"test": "vitest",
"test": "vitest run",
"deploy": "wrangler deploy",
"dev": "wrangler dev --port 8787",
"cf-typegen": "wrangler types"
Expand Down
24 changes: 12 additions & 12 deletions test/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ describe('API Tests', () => {
name: 'José Lezama Lima',
}])
})
it('only list author that match a certain country', () => {
})
it('only list author born after x date', () => {
})
it('only list author born before x date', () => {
})
it('only list author that died after x date', () => {
})
it('only list author that died before x date', () => {
})
it('only list author lived between x-y date', () => {
})
// it('only list author that match a certain country', () => {
// })
// it('only list author born after x date', () => {
// })
// it('only list author born before x date', () => {
// })
// it('only list author that died after x date', () => {
// })
// it('only list author that died before x date', () => {
// })
// it('only list author lived between x-y date', () => {
// })
})
})
})

0 comments on commit da24872

Please sign in to comment.