Skip to content

Commit

Permalink
chore: add matrix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarolyi committed Apr 28, 2024
1 parent 1c97f94 commit 839902f
Show file tree
Hide file tree
Showing 36 changed files with 3,777 additions and 353 deletions.
7 changes: 6 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
blobs
coverage
dist
integration
node_modules
test
**/*.spec.ts
.dockerignore
.eslintrc.js
.gitignore
.nvmrc
compose.yml
Dockerfile
Dockerfile.test
README.md
README.md
vitest.config.ts
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
node: true,
jest: true,
},
ignorePatterns: [".eslintrc.js"],
ignorePatterns: [".eslintrc.js", "integration"],
rules: {
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
Expand Down
2 changes: 2 additions & 0 deletions .github/secret_scanning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
paths-ignore:
- "test"
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build

on:
workflow_call:

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy

on:
workflow_call:
inputs:
tags-policy:
required: true
type: string

jobs:
deploy:
name: Build and Push to Dockerhub
runs-on: ubuntu-22.04
steps:
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Collect image metadata
uses: docker/metadata-action@v5
id: meta
with:
images: pkarolyi/garden-snail
tags: ${{ inputs.tags-policy }}
- name: Build and push image to Dockerhub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
83 changes: 2 additions & 81 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,86 +10,7 @@ concurrency:

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
lint:
name: Lint
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint
uses: ./.github/workflows/build.yml
test:
name: Test (unit)
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Test
run: pnpm test:cov
test-e2e:
name: Test (e2e)
runs-on: ubuntu-22.04
uses: ./.github/workflows/test.yml
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Test e2e
run: pnpm test:e2e
test-integration:
name: Test (integration)
runs-on: ubuntu-22.04
needs: [build, lint, test, test-e2e]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Build docker images
run: docker compose build
- name: Test API with turborepo
run: docker compose run test
117 changes: 8 additions & 109 deletions .github/workflows/push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,114 +10,13 @@ concurrency:

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
lint:
name: Lint
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint
uses: ./.github/workflows/build.yml
test:
name: Test (unit)
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Test
run: pnpm test:cov
test-e2e:
name: Test (e2e)
runs-on: ubuntu-22.04
uses: ./.github/workflows/test.yml
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.12"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Test e2e
run: pnpm test:e2e
test-integration:
name: Test (integration)
runs-on: ubuntu-22.04
needs: [build, lint, test, test-e2e]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Build docker images
run: docker compose build
- name: Test API with turborepo
run: docker compose run test
publish-edge-image:
name: Build and Push 'edge' to Dockerhub
runs-on: ubuntu-22.04
needs: [build, lint, test, test-e2e, test-integration]
steps:
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up buildx
uses: docker/setup-buildx-action@v3
- name: Collect image metadata
uses: docker/metadata-action@v5
id: meta
with:
images: pkarolyi/garden-snail
tags: type=edge,branch=main
- name: Build and push image to Dockerhub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
uses: ./.github/workflows/deploy.yml
needs: [build, test]
secrets: inherit
with:
tags-policy: "type=edge,branch=main"
Loading

0 comments on commit 839902f

Please sign in to comment.