Skip to content

Commit

Permalink
Merge pull request #8 from async3619/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
async3619 authored Nov 1, 2024
2 parents 17be34a + bbdd830 commit b244228
Show file tree
Hide file tree
Showing 81 changed files with 63,112 additions and 540 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/.idea
/.git
/bin
/scripts
/.github
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.git
/dist
/node_modules
/schemas
/src/queries.data.ts
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off"
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
}
}
21 changes: 8 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- dev

jobs:
build-and-deploy:
Expand All @@ -14,16 +15,6 @@ jobs:
with:
persist-credentials: false

- name: Cache nextjs build
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]sx?') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Cache node_modules
id: node-cache
uses: actions/cache@v2
Expand All @@ -39,7 +30,7 @@ jobs:
- name: Install and Build
uses: actions/setup-node@v3
with:
node-version: "18.x"
node-version: "20.11.1"

- name: Install yarn
run: |
Expand All @@ -49,6 +40,10 @@ jobs:
run: |
yarn
- name: Generate codes for GraphQL
run: |
yarn codegen
- name: Lint
run: |
yarn lint
Expand All @@ -57,13 +52,13 @@ jobs:
env:
FORCE_COLOR: 3
run: |
yarn test
yarn coverage --ci --verbose --testTimeout=10000
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: solv
name: cage

- name: Build
run: |
Expand Down
50 changes: 34 additions & 16 deletions .github/workflows/test.yml → .github/workflows/docker-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build and Deploy
name: Docker Image Deploy

on:
push:
branches:
- dev
tags:
- "*"

jobs:
build-and-deploy:
Expand All @@ -14,16 +14,6 @@ jobs:
with:
persist-credentials: false

- name: Cache nextjs build
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]sx?') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Cache node_modules
id: node-cache
uses: actions/cache@v2
Expand All @@ -39,7 +29,7 @@ jobs:
- name: Install and Build
uses: actions/setup-node@v3
with:
node-version: "18.x"
node-version: "20.11.1"

- name: Install yarn
run: |
Expand All @@ -49,6 +39,10 @@ jobs:
run: |
yarn
- name: Generate codes for GraphQL
run: |
yarn codegen
- name: Lint
run: |
yarn lint
Expand All @@ -57,13 +51,37 @@ jobs:
env:
FORCE_COLOR: 3
run: |
yarn test
yarn coverage --ci --verbose --testTimeout=10000
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: solv
name: cage

- name: Build
run: |
yarn build
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set Environment Variable for Tagging
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Build, tag, and push image to Docker Hub
env:
DOCKER_BUILDKIT: 1
GITHUB_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name }}
run: |
docker build -t $GITHUB_OWNER/$GITHUB_REPO:$RELEASE_VERSION .
docker build -t $GITHUB_OWNER/$GITHUB_REPO:latest .
docker push $GITHUB_OWNER/$GITHUB_REPO:$RELEASE_VERSION
docker push $GITHUB_OWNER/$GITHUB_REPO:latest
- uses: sarisia/actions-status-discord@v1
if: always()
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
/yarn-error.log
/dist
/coverage
/.env
/followers.json
/dump
/data.sqlite
/config.json
/src/queries.ts
/src/queries.data.ts
12 changes: 12 additions & 0 deletions .graphqlconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Untitled GraphQL Schema",
"schemaPath": "./schemas/github.graphqls",
"extensions": {
"endpoints": {
"Default GraphQL Endpoint": {
"url": "https://api.github.com/graphql",
"introspect": false
}
}
}
}
39 changes: 37 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,44 @@
{
"branches": ["main"],
"branches": ["main", { "name": "dev", "prerelease": true }],
"ci": true,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalCommits",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
},
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features ✨"
},
{
"type": "fix",
"section": "Bug Fixes \uD83D\uDC1E"
},
{
"type": "chore",
"section": "Internal \uD83E\uDDF0",
"hidden": true
},
{
"type": "refactor",
"section": "Internal \uD83E\uDDF0",
"hidden": false
},
{
"type": "perf",
"section": "Internal \uD83E\uDDF0",
"hidden": false
}
]
}
}
],
"@semantic-release/npm",
"@semantic-release/github",
[
Expand Down
55 changes: 55 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM node:20.18-alpine as builder

RUN apk add --update --no-cache curl git openssh openssl

USER node
WORKDIR /home/node

COPY --chown=node:node package*.json ./
COPY --chown=node:node yarn.lock ./
RUN yarn install --frozen-lockfile

COPY --chown=node:node . .

ARG NODE_ENV=production
ARG APP_ENV=production

ENV NODE_ENV ${NODE_ENV}

RUN ["yarn", "build"]

FROM node:20.18-alpine as prod-deps

USER node
WORKDIR /home/node

# copy from build image
COPY --from=builder /home/node/yarn.lock ./yarn.lock
COPY --from=builder /home/node/package.json ./package.json
RUN yarn install --frozen-lockfile --prod

ARG NODE_ENV=production
ARG APP_ENV=production

ENV NODE_ENV ${NODE_ENV}

CMD [ "node", "dist/src/index" ]

FROM node:20.18-alpine as production

USER node
WORKDIR /home/node

# copy from build image
COPY --from=prod-deps /home/node/node_modules ./node_modules
COPY --from=builder /home/node/dist ./dist
COPY --from=builder /home/node/yarn.lock ./yarn.lock
COPY --from=builder /home/node/package.json ./package.json
RUN yarn install --frozen-lockfile --prod

ARG NODE_ENV=production
ARG APP_ENV=production

ENV NODE_ENV ${NODE_ENV}

CMD [ "node", "dist/src/index" ]
Loading

0 comments on commit b244228

Please sign in to comment.