Skip to content

Commit

Permalink
ci: test all in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
suin committed Jun 20, 2024
1 parent ed1b436 commit 5bba2f3
Show file tree
Hide file tree
Showing 10 changed files with 330 additions and 21 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Ubuntu",
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"workspaceFolder": "/workspace",
"remoteEnv": {
"PATH": "/root/.proto/shims:/root/.proto/bin:${containerEnv:PATH}"
},
"customizations": {
"jetbrains": {
"backend": "IntelliJ"
}
},
"postCreateCommand": ".devcontainer/setup.sh"
}
3 changes: 3 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

curl -fsSL https://moonrepo.dev/install/proto.sh | PROTO_HOME=/usr/local bash -s -- --yes
11 changes: 2 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- if: github.ref_name != 'main'
uses: actions-rs/cargo@v1
with:
command: install
args: sd
- if: github.ref_name != 'main'
run: sd /appthrust/proto-toml-plugins/main/ /appthrust/proto-toml-plugins/${{ github.event.pull_request.head.ref }}/ .prototools
- if: github.ref_name != 'main'
run: cat .prototools
- name: Install
uses: moonrepo/setup-toolchain@v0
env:
PROTO_LOG: debug
with:
auto-install: true
cache: false
- run: bun install --frozen-lockfile
- run: bun test
175 changes: 175 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore

# Logs

logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Caches

.cache

# Diagnostic reports (https://nodejs.org/api/report.html)

report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Runtime data

pids
_.pid
_.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

# Coverage directory used by tools like istanbul

coverage
*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variable files

.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)

.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output

.vuepress/dist

# vuepress v2.x temp and cache directory

.temp

# Docusaurus cache and generated files

.docusaurus

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
13 changes: 1 addition & 12 deletions .prototools
Original file line number Diff line number Diff line change
@@ -1,12 +1 @@
black = "24.3.0"
k3d = "5.6.0"
k9s = "0.32.4"
moon = "1.23.4"
tilt = "0.33.12"

[plugins]
black = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/black/plugin.toml"
k3d = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/k3d/plugin.toml"
k9s = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/k9s/plugin.toml"
moon = "source:https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml"
tilt = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/tilt/plugin.toml"
bun = "1.1.15"
80 changes: 80 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"files": {
// relative path from the workspace root
"ignore": [".moon"]
},
"vcs": {
"enabled": true,
"clientKind": "git",
"defaultBranch": "main",
"useIgnoreFile": true
},
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"lineWidth": 120
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useFilenamingConvention": {
"level": "warn",
"options": {
"strictCase": false,
"requireAscii": true,
"filenameCases": ["kebab-case"]
}
},
"noDefaultExport": "warn",
"noNegationElse": "warn",
"useBlockStatements": "warn",
"useCollapsedElseIf": "warn",
"useConsistentArrayType": {
"level": "warn",
"options": {
"syntax": "shorthand"
}
},
"useForOf": "warn",
"useFragmentSyntax": "warn",
"useShorthandArrayType": "warn",
"useShorthandAssign": "warn"
},
"complexity": {
"useLiteralKeys": "off"
},
"correctness": {
"useArrayLiterals": "warn",
"noUnusedVariables": "warn"
},
"nursery": {
"useSortedClasses": "off", // why-not: eslint-plugin-tailwindcss does this
// ↓ We want to enable this rule, but we can't. Because it doesn't support monorepos at the moment. It's because it can't see the nearest package.json. This issue has been reported to the Issue: https://github.com/biomejs/biome/issues/2010
// "noUndeclaredDependencies": "error"`
"noDuplicateElseIf": "warn",
"noDuplicateJsonKeys": "warn",
"noEvolvingTypes": "warn",
"noRestrictedImports": {
"level": "warn",
"options": {
"paths": {
"fs": "Use fs/promises instead of fs",
"node:fs": "Use node:fs/promises instead of node:fs",
"dns": "Use dns/promises instead of dns",
"node:dns": "Use node:dns/promises instead of node:dns"
}
}
},
"noUselessUndefinedInitialization": "warn",
"useConsistentBuiltinInstantiation": "warn",
"useDefaultSwitchClause": "warn",
"useExplicitLengthCheck": "warn"
}
}
}
}
Binary file added bun.lockb
Binary file not shown.
17 changes: 17 additions & 0 deletions install.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test } from "bun:test";
import { mkdtemp } from "node:fs/promises";
import os from "node:os";
import { dirname } from "node:path";
import { $, Glob } from "bun";

const tomlPattern = new Glob("*/*.toml");
const tomlPaths = await Array.fromAsync(tomlPattern.scan("."));
const dirs = tomlPaths.map(dirname);

test.each(dirs)("proto install %s latest --pin local", async (name) => {
const dir = await mkdtemp(`${os.tmpdir()}/test-${name}-`);
const tomlPath = `${import.meta.dir}/${name}/plugin.toml`;
$.cwd(dir);
console.log(await $`proto plugin add ${name} source:${tomlPath}`.text());
console.log(await $`proto install ${name} latest --pin local`.text());
});
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "proto-toml-plugin",
"type": "module",
"devDependencies": {
"@biomejs/biome": "^1.8.1",
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
27 changes: 27 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,

// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}

0 comments on commit 5bba2f3

Please sign in to comment.