Skip to content

Commit

Permalink
feat: v4 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
samialdury authored Mar 27, 2023
1 parent f22b78e commit 8a0f689
Show file tree
Hide file tree
Showing 61 changed files with 5,875 additions and 10,765 deletions.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

6 changes: 0 additions & 6 deletions .env

This file was deleted.

6 changes: 4 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.eslintrc.js
.prettierrc.js
node_modules
build
coverage
commitlint.config.cjs
lint-staged.config.cjs
vitest.config.ts
37 changes: 0 additions & 37 deletions .eslintrc.js

This file was deleted.

45 changes: 45 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "https://json.schemastore.org/eslintrc",
"root": true,
"env": {
"node": true,
"es2022": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint"],
"extends": [
// Common
"eslint:recommended",
"plugin:import/recommended",
// TS
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict",
// Prettier
"plugin:prettier/recommended"
],
"settings": {
"import/resolver": {
"typescript": {}
}
},
"rules": {
"import/newline-after-import": "error",
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],
"object-shorthand": ["error", "always"],
"no-console": "error",
"func-style": ["error", "declaration"],
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/promise-function-async": "error"
}
}
4 changes: 4 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NODE_ENV="development"
LOGGER_LEVEL="trace"
PROXY_PORT=8000
COMMIT_SHA="local"
19 changes: 11 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

🙏 Please double-check your configuration before opening a new issue.

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -25,15 +26,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
18 changes: 0 additions & 18 deletions .github/dependabot.yml

This file was deleted.

108 changes: 108 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

env:
NODE_VERSION: 18
PNPM_VERSION: 7
IMAGE_PLATFORMS: 'linux/amd64,linux/arm64'
IMAGE_REGISTRY: 'ghcr.io'
IMAGE_NAME: ${{ github.repository }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
BRANCH_OR_TAG: ${{ github.event.pull_request.head.ref || github.ref_name }}

jobs:
check:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ env.PNPM_VERSION }}

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm

- name: Install NPM dependencies
run: make install-ci

- name: Build TypeScript
run: make build-ci

- name: Run tests
run: make test-ci

- name: Format & lint
run: make lint-ci

docker:
needs: [check]
runs-on: ubuntu-22.04
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
if: contains(env.IMAGE_PLATFORMS, ',')
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Extract metadata for Docker
id: docker-meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Git metadata
id: git-meta
run: |
echo "BRANCH_OR_TAG_NORMALIZED_WITH_SHA=$(echo ${{ env.BRANCH_OR_TAG }} | tr '/' '-'),${{ env.COMMIT_SHA }}" >> $GITHUB_OUTPUT
- name: Build and push image to registry
uses: docker/build-push-action@v4
with:
context: .
push: true
provenance: false
build-args: |
NODE_VERSION=${{ env.NODE_VERSION }}
PNPM_VERSION=${{ env.PNPM_VERSION }}
COMMIT_SHA=${{ steps.git-meta.outputs.BRANCH_OR_TAG_NORMALIZED_WITH_SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ env.IMAGE_PLATFORMS }}
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
38 changes: 0 additions & 38 deletions .github/workflows/docker-hub.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish release to Docker Hub

on:
workflow_dispatch:
release:
types:
- published

env:
NODE_VERSION: 18
PNPM_VERSION: 7
IMAGE_PLATFORMS: 'linux/amd64,linux/arm64'
IMAGE_REGISTRY: 'ghcr.io'
IMAGE_NAME: ${{ github.repository }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
BRANCH_OR_TAG: ${{ github.event.pull_request.head.ref || github.ref_name }}

jobs:
publish:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
if: contains(env.IMAGE_PLATFORMS, ',')
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Extract metadata for Docker
id: docker-meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.IMAGE_NAME }}
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Git metadata
id: git-meta
run: |
echo "BRANCH_OR_TAG_NORMALIZED_WITH_SHA=$(echo ${{ env.BRANCH_OR_TAG }} | tr '/' '-'),${{ env.COMMIT_SHA }}" >> $GITHUB_OUTPUT
- name: Build and push image to registry
uses: docker/build-push-action@v4
with:
context: .
push: true
provenance: false
build-args: |
NODE_VERSION=${{ env.NODE_VERSION }}
PNPM_VERSION=${{ env.PNPM_VERSION }}
COMMIT_SHA=${{ steps.git-meta.outputs.BRANCH_OR_TAG_NORMALIZED_WITH_SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ env.IMAGE_PLATFORMS }}
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
Loading

0 comments on commit 8a0f689

Please sign in to comment.