Skip to content

Commit

Permalink
wip: add fancy 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 084bee3
Show file tree
Hide file tree
Showing 34 changed files with 3,780 additions and 352 deletions.
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ blobs
coverage
dist
node_modules
test
**/*.spec.ts
.dockerignore
.eslintrc.js
.gitignore
.nvmrc
compose.yml
Dockerfile
Dockerfile.test
README.md
README.md
vitest.config.ts
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
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy

on:
workflow_call:
inputs:
tags-policy:
required: true
type: string
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true

jobs:
deploy:
name: Build and Push 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: ${{ 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 }}
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
119 changes: 9 additions & 110 deletions .github/workflows/push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,122 +2,21 @@ name: Build, Test and Publish edge

on:
push:
branches: ["main"]
branches: ["main", "add-fancy-tests"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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]
with:
tags-policy: type=edge,branch=main
secrets: inherit
Loading

0 comments on commit 084bee3

Please sign in to comment.