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

Migrate to Deno #286

Merged
merged 16 commits into from
Jan 1, 2025
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
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ If applicable, add screenshots to help explain your problem.

## Possible solutions

Do you have an idea of what could resolve this? If yes, fill in this section making sure to link to the relevant library/documentation, or the stack overflow question that addresses this bug.
Do you have an idea of what could resolve this? If yes, fill in this section
making sure to link to the relevant library/documentation, or the stack overflow
question that addresses this bug.

## Additional context

Expand Down
16 changes: 12 additions & 4 deletions .github/ISSUE_TEMPLATE/new-feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@ labels: enhancement
assignees: ""
---

**Note:** _These sections are recommendations and aren't required. Feel free to add or remove sections depending on the complexity of the feature. If you plan to work with another dev, try to be detailed and clear._
**Note:** _These sections are recommendations and aren't required. Feel free to
add or remove sections depending on the complexity of the feature. If you plan
to work with another dev, try to be detailed and clear._

# Describe the new feature

A clear and concise description of what you want to happen.

## Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered. Delete if not applicable (For example, if you considered a few different libraries and aren't sure which to use).
A clear and concise description of any alternative solutions or features you've
considered. Delete if not applicable (For example, if you considered a few
different libraries and aren't sure which to use).

## Planning

Use the below as a guide to create your issue. It doesn't have to be too complicated, but it should keep track of what is needed, and what has already been done.
Use the below as a guide to create your issue. It doesn't have to be too
complicated, but it should keep track of what is needed, and what has already
been done.

### API

Expand Down Expand Up @@ -46,7 +52,9 @@ Make it beautiful.

## Example

Delete if this isn't required. Useful for showing an example of how this new feature could be used, especially if another person will be helping with or taking over the issue.
Delete if this isn't required. Useful for showing an example of how this new
feature could be used, especially if another person will be helping with or
taking over the issue.

```
from anus_lib import DoEverything
Expand Down
5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
target-branch: "develop"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Deno Build
permissions:
"contents": "write"

on:
push:
branches: ["master", "main", "develop"]
pull_request:

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Install dependencies
run: |
deno install
- name: Compile
run: |
deno compile -o ./poke-guesser-bot -ERN src/main.ts
- name: Upload artifact (Windows)
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v4
with:
name: poke-guesser-bot-${{ matrix.os }}
path: poke-guesser-bot.exe
- name: Upload artifact (Ubuntu and Mac)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: poke-guesser-bot-${{ matrix.os }}
path: poke-guesser-bot
create-release:
needs: [build]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')

steps:
- uses: actions/checkout@v4
name: Checkout Code

# Windows
- uses: actions/download-artifact@v4
name: Download Windows
with:
name: poke-guesser-bot-windows-latest
path: release-artifacts/

- name: Rename Windows Binary
run: mv release-artifacts/poke-guesser-bot.exe release-artifacts/poke-guesser-bot-Windows.exe

- uses: actions/download-artifact@v4
name: Download Linux
with:
name: poke-guesser-bot-ubuntu-latest
path: release-artifacts/

- name: Rename Linux Binary
run: mv release-artifacts/poke-guesser-bot release-artifacts/poke-guesser-bot-Linux

- uses: actions/download-artifact@v4
name: Download Mac
with:
name: poke-guesser-bot-macos-latest
path: release-artifacts/

- name: Rename Mac Binary
run: mv release-artifacts/poke-guesser-bot release-artifacts/poke-guesser-bot-Mac

- name: Create release
uses: ncipollo/release-action@v1.14.0
with:
replacesArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "release-artifacts/*"
body: ${{ github.event.head_commit.message }}
prerelease: true
name: Nightly Release
tag: nightly-build

- name: Update nightly-build tag
run: |
git tag -f nightly-build
git push -f origin nightly-build
shell: bash
1 change: 0 additions & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: ["master", "main", "develop"]
pull_request:
branches: ["master", "main", "develop"]
workflow_dispatch:

jobs:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deno Formatting

on:
push:
branches: ["master", "main", "develop"]
pull_request:

jobs:
format:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Install dependencies
run: |
deno install
- name: Check format
run: |
deno fmt
git --no-pager diff --exit-code --color=never
18 changes: 0 additions & 18 deletions .github/workflows/jest.yml

This file was deleted.

17 changes: 10 additions & 7 deletions .github/workflows/prettier.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Prettier Formatting
name: Deno Linting

on:
push:
branches: ["master", "main", "develop"]
pull_request:
branches: ["master", "main", "develop"]

jobs:
check-format:
name: Check Format
lint:
name: Check Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Install dependencies
run: |
npm ci
- name: Run prettier
deno install
- name: Check lint
run: |
npm run format
deno lint --fix
git --no-pager diff --exit-code --color=never
17 changes: 17 additions & 0 deletions .github/workflows/molt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Molt Update

on:
schedule:
- cron: "0 22 * * *"
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hasundue/molt-action@v1
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Deno Test

on:
push:
branches: ["master", "main", "develop"]
pull_request:

jobs:
test:
name: Check Test Files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Install dependencies
run: |
deno install
- name: Test
run: |
deno test
10 changes: 0 additions & 10 deletions .prettierignore

This file was deleted.

28 changes: 9 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
# Stage 1: Build
FROM node:22.12.0-bookworm-slim AS builder
WORKDIR /usr/src/app
COPY package.json .
COPY package-lock.json .
COPY tsconfig.json .
COPY src ./src
RUN npm ci
RUN npm run build

# Stage 2: Run
FROM node:22.12.0-bookworm-slim
FROM denoland/deno:2.1.4
# Add wait script
COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /wait
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/package.json .
COPY --from=builder /usr/src/app/package-lock.json .
COPY --from=builder /usr/src/app/build .
COPY --from=builder /usr/src/app/src/languages ./languages
RUN npm ci --omit=dev
ENV WAIT_COMMAND="npm start"
WORKDIR /app
USER deno
COPY deno.json .
COPY deno.lock .
RUN deno install
COPY . .
RUN deno cache src/main.ts
ENV WAIT_COMMAND="deno run -ERN src/main.ts"
# comma separated list of pairs host:port for which you want to wait.
ENV WAIT_HOSTS=db:5432
# max number of seconds to wait for all the hosts to be available before failure. The default is 30 seconds.
Expand Down
Loading
Loading