Skip to content

Commit

Permalink
Updated tooling (GH workflows & templates, pkg manager, etc.)
Browse files Browse the repository at this point in the history
  • Loading branch information
targendaz2 committed Jun 24, 2024
1 parent 0f201d9 commit df0dd3e
Show file tree
Hide file tree
Showing 25 changed files with 1,603 additions and 2,467 deletions.
46 changes: 46 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM node:22-slim

ENV DEBIAN_FRONTEND noninteractive

# Install dependencies
RUN --mount=type=cache,target=/var/cache/apt/install \
apt-get update \
&& apt-get -y install --no-install-recommends \
ca-certificates curl git gnupg2 locales shellcheck wget zsh

# Set locales
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment \
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& echo "LANG=en_US.UTF-8" > /etc/locale.conf \
&& locale-gen en_US.UTF-8

# Install Yarn
RUN --mount=type=cache,target=/var/cache/yarn \
npm install -g corepack \
&& corepack enable \
&& yarn set version stable

# Enable shell history between sessions
RUN --mount=type=cache,target=/var/cache/commandhistory \
mkdir /commandhistory \
&& touch /commandhistory/.zsh_history \
&& chown -R node /commandhistory

# Set Zsh as default shell
RUN usermod --shell /bin/zsh node

USER node

# Install and configure zsh
RUN --mount=type=cache,target=/var/cache/oh-my-zsh \
sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \
-x \
-t robbyrussell \
-p debian \
-p git \
-p node \
-p yarn \
-a "zstyle ':omz:update' mode auto" \
-a "export PROMPT_COMMAND='history -a'" \
-a "export HISTFILE=/commandhistory/.zsh_history" \
-a "function gi() { curl -sLw \"\\\n\" https://www.toptal.com/developers/gitignore/api/\$@ ;}"
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "bats-zsh",
"build": {
"context": "..",
"dockerfile": "./Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"GitHub.vscode-pull-request-github",
"streetsidesoftware.code-spell-checker",
"ms-azuretools.vscode-docker",
"EditorConfig.EditorConfig",
"github.vscode-github-actions",
"VisualStudioExptTeam.vscodeintellicode",
"VisualStudioExptTeam.vscodeintellicode-completions",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"ms-vscode-remote.remote-containers",
"mads-hartmann.bash-ide-vscode",
"jetmartin.bats",
"timonwong.shellcheck",
"redhat.vscode-yaml"
]
}
},
"remoteUser": "node"
}
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[{Dockerfile,*.sh}]
charset = utf-8
indent_style = space
indent_size = 4

[*.{json,markdownlintrc,md,yml}]
charset = utf-8
indent_style = space
indent_size = 2
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Bug Report
description: File a bug report.
title: "[Bug]: "
labels: ["bug"]
body:
- type: textarea
id: expected-behavior
attributes:
label: What did you expect to happen?
validations:
required: true

- type: textarea
id: actual-behavior
attributes:
label: What actually happened?
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: How can you reproduce the bug?
description: Include step-by-step instructions.
validations:
required: true
33 changes: 0 additions & 33 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Feature Request
description: Request a new feature.
title: "[Feature]: "
labels: ["enhancement"]
body:
- type: textarea
id: description
attributes:
label: What feature do you want added?
validations:
required: true

- type: textarea
id: use-case
attributes:
label: What problem would this feature solve?
validations:
required: true
20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/help.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Help Request
description: Ask for help.
title: "[Help]: "
labels: ["help wanted"]
body:
- type: textarea
id: description
attributes:
label: What do you need help with?
validations:
required: true

- type: textarea
id: use-case
attributes:
label: What steps have you taken?
description: How have you tried to answer this question on your own?
validations:
required: true
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: devcontainers
directory: "/"
schedule:
interval: monthly

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly

- package-ecosystem: npm
directory: "/"
schedule:
interval: monthly
allow:
- dependency-type: production
19 changes: 0 additions & 19 deletions .github/workflows/publish-package.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to npmjs

on:
release:
types: [published]

env:
NODE_ENV: production

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: yarn
cache-dependency-path: yarn.lock
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: yarn install --immutable

- name: Publish the package
run: yarn npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Lint and Run Automated Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: yarn
cache-dependency-path: yarn.lock

- name: Run Linters
run: yarn lint

test:
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
include:
- os: ubuntu-latest
installzsh: true
runs-on: ${{ matrix.os }}

steps:
- if: matrix.installzsh
run: sudo apt-get install zsh

- uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: yarn
cache-dependency-path: yarn.lock

- name: Run bats tests
run: npm test --recursive
49 changes: 0 additions & 49 deletions .github/workflows/tests.yml

This file was deleted.

Loading

0 comments on commit df0dd3e

Please sign in to comment.