Skip to content

Commit ef532c2

Browse files
committed
👷 Separate PostgreSQL pipeline
1 parent c3a9386 commit ef532c2

2 files changed

Lines changed: 86 additions & 45 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Create project'
2+
description: 'Runs create-node-project and performs tests'
3+
inputs:
4+
options:
5+
description: 'create-node-app options'
6+
required: true
7+
default: ''
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
14+
- name: Cache dependencies
15+
uses: actions/cache@v3
16+
with:
17+
path: ~/.npm
18+
key: npm-${{ hashFiles('package-lock.json') }}
19+
restore-keys: npm-
20+
21+
- name: Install dependencies
22+
run: npm ci --ignore-scripts
23+
24+
- name: Build the project
25+
run: npm run build
26+
27+
- name: Run npm link
28+
run: npm link
29+
30+
- name: Create project
31+
run: create-node-app ${{ inputs.options }}
32+
33+
- name: Build created project
34+
working-directory: ./node-app
35+
run: npm run build
36+
37+
- name: Run lint
38+
working-directory: ./node-app
39+
run: npm run ci-lint
40+
41+
- name: Run tests
42+
working-directory: ./node-app
43+
run: npm run ci-test
44+
45+
- name: Run start
46+
working-directory: ./node-app
47+
run: |
48+
npm run start &
49+
start_pid=$!
50+
sleep 10
51+
kill $start_pid

‎.github/workflows/create-projects.yml‎

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,44 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
create-app-command:
21-
- "create-node-app -f --api rest --database postgres-knex --pipeline cloudrun-gitlab"
22-
- "create-node-app -f --api graphql --database postgres-knex --pipeline cloudrun-gitlab"
23-
- "create-node-app -f --api rest --database none --pipeline cloudrun-gitlab"
24-
- "create-node-app -f --api graphql --database none --pipeline cloudrun-gitlab"
25-
- "create-node-app -f --api rest --database none --pipeline none"
26-
- "create-node-app -f --api none --database none --pipeline cloudrun-gitlab"
20+
create-app-options:
21+
- "--api rest --database none --pipeline cloudrun-gitlab"
22+
- "--api graphql --database none --pipeline cloudrun-gitlab"
23+
- "--api rest --database none --pipeline none"
24+
- "--api none --database none --pipeline cloudrun-gitlab"
2725
runs-on: ubuntu-latest
2826

2927
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v3
32-
33-
- name: Cache dependencies
34-
uses: actions/cache@v3
28+
- id: create-node-app
29+
uses: ./.github/actions/test-create-project
3530
with:
36-
path: ~/.npm
37-
key: npm-${{ hashFiles('package-lock.json') }}
38-
restore-keys: npm-
39-
40-
- name: Install dependencies
41-
run: npm ci --ignore-scripts
42-
43-
- name: Build the project
44-
run: npm run build
45-
46-
- name: Run npm link
47-
run: npm link
48-
49-
- name: Create project
50-
run: ${{ matrix.create-app-command }}
51-
52-
- name: Build created project
53-
working-directory: ./node-app
54-
run: npm run build
31+
options: ${{ matrix.create-app-options }}
5532

56-
- name: Run lint
57-
working-directory: ./node-app
58-
run: npm run ci-lint
33+
create-projects-with-postgres:
34+
needs: "build"
35+
services:
36+
postgres:
37+
image: postgres
38+
env:
39+
POSTGRES_PASSWORD: node-app_docker
40+
POSTGRES_USER: node-app_docker
41+
POSTGRES_DB: node-app_docker
42+
options: >-
43+
--health-cmd pg_isready
44+
--health-interval 10s
45+
--health-timeout 5s
46+
--health-retries 5
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
create-app-options:
51+
- "--api none --database postgres-knex --pipeline none"
52+
- "--api rest --database postgres-knex --pipeline cloudrun-gitlab"
53+
- "--api graphql --database postgres-knex --pipeline cloudrun-gitlab"
54+
runs-on: ubuntu-latest
5955

60-
- name: Run tests
61-
working-directory: ./node-app
62-
run: npm run ci-test
63-
64-
- name: Run start
65-
working-directory: ./node-app
66-
run: |
67-
npm run start &
68-
start_pid=$!
69-
sleep 10
70-
kill $start_pid
56+
steps:
57+
- id: create-node-app
58+
uses: AckeeCZ/test-create-project
59+
with:
60+
options: ${{ matrix.create-app-options }}

0 commit comments

Comments
 (0)