Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: modernize #471

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Dockerfile
.tmp
.github
.travis.yml
LICENSE

# Git
.github
Expand All @@ -46,12 +45,6 @@ LICENSE
target
**/target
# node mods


.yarn/cache
.yarn/install-state.gz

.github
.husky
.vscode
scripts
Expand All @@ -64,3 +57,4 @@ target
denolint.json
README.md
.env
pruned
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"ignorePatterns": ["services/website"],
"ignorePatterns": ["**/dist/*"],
"rules": {
"comma-dangle": ["error", "always-multiline"],
"@typescript-eslint/no-base-to-string": 0,
Expand Down
2 changes: 1 addition & 1 deletion .github/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
yarn commitlint --edit $1
pnpm exec commitlint --edit $1
2 changes: 1 addition & 1 deletion .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
yarn run build && yarn run generate && git add commands.lock.json && yarn lint-staged
pnpm run build && pnpm run generate && git add commands.lock.json && pnpm exec lint-staged
29 changes: 29 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "group:allNonMajor", ":dependencyDashboard"],
"labels": ["dependencies"],
"schedule": ["before 4pm"],
"cloneSubmodules": true,
"npm": {
"postUpdateOptions": ["yarnDedupeHighest"],
"rangeStrategy": "bump",
"packageRules": [
{
"matchUpdateTypes": ["patch"],
"matchCurrentVersion": "/^0\\./",
"automerge": true,
"platformAutomerge": true
},
{
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": ">=1.0.0",
"automerge": true,
"platformAutomerge": true
},
{
"matchDepTypes": ["engines"],
"enabled": false
}
]
}
}
68 changes: 49 additions & 19 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,70 @@
name: Continuous Deployment (thoth)

on:
workflow_dispatch:
push:
branches: [main]
paths:
- '**.ts'
- 'src/**/*.ts'
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
- 'Dockerfile'
- 'locales/**'

env:
slug: ghcr.io/Fyko/thoth
dockerfile: ./Dockerfile

jobs:
docker:
name: Deploy Docker Image
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Build
id: build
uses: redhat-actions/buildah-build@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v3
with:
image: fyko/thoth
tags: latest ${{ github.sha }} # important!
dockerfiles: |
./services/bot/Dockerfile
build-args: |
CREATED_AT=${{ env.datetime }}
GITHUB_SHA=${{ github.sha }}

- name: Publish
uses: redhat-actions/push-to-registry@v2
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ env.slug }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.slug }}-buildx-

- name: Login to Google Container Registry
uses: docker/login-action@v3
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.slug }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=sha

- name: Build
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
shell: bash
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
35 changes: 0 additions & 35 deletions .github/workflows/cd_thothd.yml

This file was deleted.

42 changes: 15 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,27 @@ name: Testing

on:
push:
branches-ignore:
- feat/translations
branches-ignore: [feat/translations]
pull_request:
branches-ignore:
- feat/translations
branches-ignore: [feat/translations]

jobs:
lint:
tests:
name: Lint and Build
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Volta
uses: volta-cli/action@v3
- name: Install Node.js v20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Dependencies
run: yarn --immutable
- name: Install dependencies
uses: discordjs/discord.js/packages/actions/src/pnpmCache@e96a8a977fdbd44fb8795fdbbcfb42fb667c4554

- name: Run ESLint
run: yarn lint
- name: Lint
run: pnpm run lint

build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v3

- name: Setup Volta
uses: volta-cli/action@v3

- name: Install Dependencies
run: yarn --immutable

- name: Compile code
run: yarn build
- name: Build
run: pnpm run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ out
.nuxt
dist
.vscode
pruned

# Rust
target/
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
pnpm-lock.yaml
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"useTabs": true,
"quoteProps": "as-needed",
"singleQuote": true,
"trailingComma": "all",
"endOfLine": "lf"
}
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

199 changes: 0 additions & 199 deletions .yarn/plugins/@yarnpkg/plugin-production-install.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

14 changes: 0 additions & 14 deletions .yarn/plugins/plugin-git-hooks.cjs

This file was deleted.

873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.4.1.cjs

This file was deleted.

16 changes: 0 additions & 16 deletions .yarnrc.yml

This file was deleted.

Loading