Skip to content

Commit

Permalink
refactor(ci): composite the action (#120)
Browse files Browse the repository at this point in the history
* refactor(ci): composite the action

Signed-off-by: mateonunez <[email protected]>

* perf(ci): implement healthcheck

Signed-off-by: mateonunez <[email protected]>

---------

Signed-off-by: mateonunez <[email protected]>
  • Loading branch information
mateonunez authored Nov 1, 2023
1 parent 8610ddc commit a3c939d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 79 deletions.
94 changes: 15 additions & 79 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,105 +12,41 @@ jobs:
setup-dependencies:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [16, 18, 20]
node: [18, 20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: ${{matrix.node}}
cache: 'pnpm'
- run: pnpm fetch

ci-cli:
package-tests:
needs: setup-dependencies
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [16, 18]
node: [18, 20]
package: [cli, drill, falcon, huston, rover]
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: ${{matrix.node}}
cache: 'pnpm'
- run: pnpm install
- run: cd packages/cli && pnpm test

ci-drill:
needs: setup-dependencies
runs-on: ${{matrix.os}}
timeout-minutes: 20
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16, 18]
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- run: docker-compose up -d
- run: pnpm install
- run: sleep 10
- run: cd packages/drill && pnpm test

ci-falcon:
needs: setup-dependencies
runs-on: ${{matrix.os}}
timeout-minutes: 20
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16, 18]
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- run: docker-compose up -d
- run: pnpm install
- run: sleep 10
- run: cd packages/falcon && pnpm test

ci-huston:
needs: setup-dependencies
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16, 18]
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- run: pnpm install
- run: cd packages/huston && pnpm test

ci-rover:
needs: setup-dependencies
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16, 18]
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- run: pnpm install
- run: cd packages/rover && pnpm test
- name: Wait for databases to be healthy
run: |
while [ "$(docker-compose ps mysql | grep '(healthy)')" == "" ] || [ "$(docker-compose ps postgres | grep '(healthy)')" == "" ]; do
echo "Waiting for databases to be healthy..."
sleep 5
done
- run: cd packages/${{matrix.package}} && pnpm test
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ services:
MYSQL_ROOT_PASSWORD: toor
networks:
- asterism_network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "--password=toor"]
interval: 10s
timeout: 5s
retries: 5

postgres:
image: postgres:15-alpine
Expand All @@ -22,6 +27,11 @@ services:
POSTGRES_PASSWORD: toor
networks:
- asterism_network
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "db"]
interval: 10s
timeout: 5s
retries: 5

networks:
asterism_network:
Expand Down

0 comments on commit a3c939d

Please sign in to comment.