Skip to content

Commit

Permalink
Merge branch 'main' into e2e-p2
Browse files Browse the repository at this point in the history
  • Loading branch information
m110 committed Sep 10, 2024
2 parents 642870a + c74dd1e commit 8a57d1e
Show file tree
Hide file tree
Showing 47 changed files with 1,199 additions and 287 deletions.
62 changes: 1 addition & 61 deletions .github/workflows/ci.web.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: ci.web
on:
push:
paths:
- 'web/**'
- '.github/workflows/*.web.yml'
workflow_call:

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
Expand Down Expand Up @@ -64,60 +61,3 @@ jobs:

- name: Test
run: npm run test:unit

e2e_tests:
timeout-minutes: 10
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
container:
image: mcr.microsoft.com/playwright:v1.46.1-jammy
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

cache-dependency-path: "web/package-lock.json"

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"

# As described on https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Generate API Client from OpenAPI
run: npm run openapi

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Run tests
run: npm run e2e

- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
103 changes: 103 additions & 0 deletions .github/workflows/e2e.web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: e2e.web
on:
workflow_call:

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
e2e:
timeout-minutes: 10
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
env:
CI: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

cache-dependency-path: "web/package-lock.json"

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"

# As described on https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Generate API Client from OpenAPI
run: npm run openapi

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

# Cache Playwright browsers
# https://github.com/microsoft/playwright/issues/7249#issuecomment-1154603556
- name: Get Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV

- uses: actions/cache@v4
id: playwright-cache
with:
path: "~/.cache/ms-playwright"
key: "${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}"
restore-keys: |
${{ runner.os }}-playwright-
# If the Playwright browser binaries weren't able to be restored, we tell
# paywright to install everything for us.
- name: Install Playwright's dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps

- name: Run server
run: npm run e2e:server

- uses: emilioschepis/wait-for-endpoint@v1.0.3
with:
url: http://localhost:8080/health
method: GET
expected-status: 200
timeout: 30000
interval: 250

- name: Run tests
run: npm run e2e

- name: Upload test artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: web/playwright-report/
retention-days: 15

- name: Print docker logs
run: |
cd ../server
docker compose logs || true
if: always()
19 changes: 4 additions & 15 deletions .github/workflows/main.server.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
name: main.server

on:
push:
paths:
- 'server/**'
- '.github/workflows/*.server.yml'
- "server/**"
- "!server/*.md"
- ".github/workflows/*.server.yml"
branches:
- main

jobs:
ci:
uses: ./.github/workflows/ci.server.yml

# tag:
# uses: ./.github/workflows/tag.yml
# needs: ci
# permissions:
# id-token: write
# contents: read
# secrets:
# PAT: ${{ secrets.PAT }}
# AWS_ECR_ROLE: ${{ secrets.AWS_ECR_ROLE }}
# AWS_REGION: ${{ secrets.AWS_REGION }}
# AWS_ECR_REGISTRY: ${{ secrets.AWS_ECR_REGISTRY }}
# AWS_ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY }}
17 changes: 17 additions & 0 deletions .github/workflows/main.web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: main.web

on:
push:
branches:
- main
paths:
- "web/**"
- "!web/*.md"
- ".github/workflows/*.web.yml"

jobs:
ci:
uses: ./.github/workflows/ci.web.yml

e2e:
uses: ./.github/workflows/e2e.web.yml
14 changes: 14 additions & 0 deletions .github/workflows/pr.e2e.web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Ran only when a pull request against main is opened
name: pr.e2e.web

on:
pull_request:
branches: [main]
paths:
- "web/**"
- "!web/*.md"
- ".github/workflows/*.web.yml"

jobs:
ci:
uses: ./.github/workflows/e2e.web.yml
6 changes: 4 additions & 2 deletions .github/workflows/pr.server.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: pr.server

on:
push:
paths:
- 'server/**'
- '.github/workflows/*.server.yml'
- "server/**"
- "!server/*.md"
- ".github/workflows/*.server.yml"
branches-ignore:
- main

Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/pr.web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pr.web

on:
push:
branches-ignore:
- main
paths:
- "web/**"
- "!web/*.md"
- ".github/workflows/*.web.yml"

jobs:
ci:
uses: ./.github/workflows/ci.web.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bin
.env.secrets
terraform/*.tfstate
terraform/*.tfstate.backup
.vscode
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Subscribed is a webhook provider that allows software developers to quickly add

> In early-stage development of a Webhooks provider platform... things will change, a lot.
![sbs](./web/sbs.gif)

## License

[GNU Affero General Public License v3.0](./LICENSE)
11 changes: 6 additions & 5 deletions server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

## Setup

1. Clone the repository `git clone git@github.com:subscribeddotdev/subscribed-backend.git`
2. Build the container with all the CLI tools that this repo depends on: `task setup`
3. Run the project: `task run`
4. View logs: `task logs`
1. Clone the repository `git clone git@github.com:subscribeddotdev/subscribed.git`
2. Navigate to the server folder: `cd subscribed/server`
3. Build the container with all the CLI tools that this repo depends on: `task setup`
4. Run the project: `task run`
5. View logs: `task logs`

## Running tests:

Expand All @@ -24,4 +25,4 @@
- Running migrations downwards `task mig:down`
- Generating handlers from the Open API spec `task openapi`
- Generating ORM models `task orm`
- Generating models from the event specification `task events`
- Generating models from the event specification `task events`
Loading

0 comments on commit 8a57d1e

Please sign in to comment.