Skip to content

Commit

Permalink
fix(devenv): setup tasks & configs migrating to pnpm - #133
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
  • Loading branch information
DerekNonGeneric committed Nov 19, 2022
1 parent c1dd3c7 commit a190edc
Show file tree
Hide file tree
Showing 40 changed files with 5,366 additions and 11,506 deletions.
18 changes: 17 additions & 1 deletion .devcontainer/Dockerfile
@@ -1,9 +1,25 @@
# See here for image contents: https://github.com/openinf/docker-fish

FROM dereknongeneric/fish
FROM dereknongeneric/fish:latest

# Needed by Linguist
# See: https://github.com/github/linguist/blob/HEAD/README.md#dependencies
# TODO(@DerekNonGeneric): add these to shared devcontainer image and remove this
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends build-essential cmake pkg-config libicu-dev zlib1g-dev libcurl4-openssl-dev libssl-dev ruby-dev

################################################################################
# The below is for the codespaces devcontainer. Uncomment if you want to use it.
################################################################################

# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/codespaces-linux/.devcontainer/base.Dockerfile

# FROM mcr.microsoft.com/vscode/devcontainers/universal:2-focal

# ** [Optional] Uncomment this section to install additional packages. **
# USER root
#
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
#
# USER codespace
38 changes: 23 additions & 15 deletions .devcontainer/devcontainer.json
@@ -1,12 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options,
// see documentation tentatively (until migrated) located at the following URL:
// https://github.com/openinf/openinf.github.io/tree/live/.devcontainer/library-scripts/docs
{
"name": "Jekyll (Community)",
"name": "Jekyll (OpenINF Community)",
"build": {
"dockerfile": "Dockerfile"
},

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.defaultProfile.linux": "fish"
"runArgs": ["--cap-add=SYS_ADMIN", "--security-opt", "seccomp=unconfined"],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container-specific settings.json values on container
// create.
"settings": {
"terminal.integrated.profiles.linux": {
"fish": {
"path": "fish"
}
}
}
}
},

// Add the IDs of extensions you want installed when the container is created.
Expand All @@ -21,12 +35,8 @@
"davidanson.vscode-markdownlint",
// https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
"dbaeumer.vscode-eslint",
// https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens
"eamodio.gitlens",
// https://marketplace.visualstudio.com/items?itemName=editorconfig.editorconfig
"editorconfig.editorconfig",
// https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
"esbenp.prettier-vscode",
// https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree
"Gruntfuggly.todo-tree",
// https://marketplace.visualstudio.com/items?itemName=ionutvmi.path-autocomplete
Expand Down Expand Up @@ -55,7 +65,8 @@
"yzhang.markdown-all-in-one"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// Use 'forwardPorts' to make a list of ports inside the container available
// locally.
"forwardPorts": [
// Jekyll server
4000,
Expand All @@ -67,17 +78,14 @@

"overrideCommand": false,

"features": {
"sshd": "latest"
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "fish .devcontainer/post-create.fish",

"remoteEnv": {
"PATH": "${containerEnv:PATH}:~/.rbenv/shims/"
},

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// Comment out to connect as root instead.
// More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
10 changes: 5 additions & 5 deletions .devcontainer/post-create.fish
Expand Up @@ -2,7 +2,7 @@

# If there's a .ruby-version, then run `rbenv install`.
if test -e .ruby-version
rbenv install
rbenv install --verbose
end

echo 'set -Ux fish_user_paths ~/.rbenv/shims/ $fish_user_paths' >>~/.config/fish/config.fish
Expand Down Expand Up @@ -30,13 +30,13 @@ end
if test -e .nvmrc
# Install the specified version of Node.js.
nvm install
npm install -g npm # ensure latest version of npm is installed
npm audit fix # address any vulns in the npm CLI app itself
corepack enable
corepack prepare pnpm@latest --activate
end

# If there's a package.json, then run `npm install`.
# If there's a package.json, then run `pnpm install`.
if test package.json
npm install
pnpm install
end

echo 'rbenv rehash && nvm use' >>~/.config/fish/config.fish
Expand Down
6 changes: 5 additions & 1 deletion .ecrc → .ecrc.json5
Expand Up @@ -9,7 +9,11 @@
"/vendor/**/*",
"/lib/**/*",
"doc/.jekyll-cache/**/*",
"doc/_site/**/*"
"doc/_site/**/*",
".pnpm-lock.yaml",
"Gemfile.lock",
".markdownlint.jsonc",
".vscode/tasks.json"
],
"AllowedContentTypes": [],
"PassedFiles": [],
Expand Down
3 changes: 2 additions & 1 deletion .eslintignore
Expand Up @@ -15,6 +15,7 @@ Gemfile
Gemfile.lock
package.json
package-lock.json
pnpm-lock.yaml
yarn.lock

# Use the following if your site is built via Jekyll.
Expand Down Expand Up @@ -84,4 +85,4 @@ _tmp/
_backup/
# TODO: Comment the following line out if you don't want to
# ignore your build folder.
build/
# /build/
21 changes: 19 additions & 2 deletions .eslintrc.json
Expand Up @@ -172,7 +172,7 @@
}
},
{
"files": ["package.json", ".ecrc.json"],
"files": ["package.json", ".ecrc.json5"],
"parser": "jsonc-eslint-parser",
"parserOptions": {
"allowComments": true,
Expand All @@ -182,6 +182,7 @@
"extends": [
"plugin:jsonc/base",
"plugin:jsonc/recommended-with-json",
"plugin:jsonc/recommended-with-json5",
"plugin:json-schema-validator/recommended",
"plugin:jsonc/prettier"
],
Expand All @@ -197,11 +198,27 @@
},
{
"files": ["**.t?(o)ml", "**/*.t?(o)ml"],
"parser": "toml-eslint-parser"
"parser": "toml-eslint-parser",
"plugins": ["toml", "jsonc", "json-schema-validator"],
"extends": [
"plugin:toml/recommended",
"plugin:json-schema-validator/recommended",
"plugin:jsonc/prettier"
]
},
{
"files": [".github/**/*.yml", "*.y?(a)ml", "**/*.y?(a)ml"],
"parser": "yaml-eslint-parser",
"plugins": [
"eslint-plugin-yml",
"eslint-plugin-jsonc",
"json-schema-validator"
],
"extends": [
"plugin:yml/recommended",
"plugin:json-schema-validator/recommended",
"plugin:jsonc/prettier"
],
"rules": {
"unicorn/filename-case": [
"error",
Expand Down
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Expand Up @@ -36,7 +36,8 @@ updates:
- 'deps-dev'
- 'javascript'
ignore:
# Ignore all major TypeScript type definition updates from DefinitelyTyped for Node.js.
# Ignore all major TypeScript type definition updates from DefinitelyTyped
# for Node.js coming from Dependabot.
- dependency-name: '@types/node'
update-types: ['version-update:semver-major']

Expand Down
61 changes: 31 additions & 30 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -8,15 +8,16 @@
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

# $schema: https://json.schemastore.org/github-workflow
name: 'CodeQL'

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '32 4 * * 1'

Expand All @@ -32,39 +33,39 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'ruby' ]
language: ['javascript', 'ruby']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
57 changes: 57 additions & 0 deletions .github/workflows/codeql.yml
@@ -0,0 +1,57 @@
# $schema: https://json.schemastore.org/github-workflow
name: 'CodeQL'

on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
# "At 10:00 UTC on Monday" https://time.is/UTC#time_difference
- cron: '0 10 * * 1' # https://crontab.guru/#0_10_*_*_1

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['javascript', 'ruby']

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/setup-node@v3.5.1
with:
node-version-file: '.nvmrc'

- name: Setup Ruby, JRuby and TruffleRuby
uses: ruby/setup-ruby@v1.120.0
with:
# Engine and version to use, see the syntax in the README. Reads from .ruby-version or .tool-versions if unset.
ruby-version: '.ruby-version'
bundler-cache: true
# The working directory to use for resolving paths for .ruby-version, .tool-versions and Gemfile.lock.
working-directory: './'

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: '${{ matrix.language }}'

- name: Run microsite build script
run: |
./build/tasks/compile/compile-site.mjs
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{ matrix.language }}'
4 changes: 3 additions & 1 deletion .github/workflows/lint-and-test.yml
Expand Up @@ -16,7 +16,9 @@ jobs:
node-version: lts/gallium
- name: Install
run: |
npm ci
corepack enable
corepack prepare pnpm@latest --activate
pnpm install
# Checks to see if any files in the PR match one of the listed file types.
# We can use this filter to decide whether or not to run linters or tests.
# You can check if a file with a listed file type is in the PR by doing:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -27,3 +27,6 @@ dist/

# Ignore TypeScript log files.
tsconfig.tsbuildinfo

# Ignore pnpm-specific files/folders not to track.
.pnpm-store/
15 changes: 15 additions & 0 deletions .prettierignore
@@ -1,8 +1,23 @@
!.*
!.*.*
!**/.*
!**/.*.*
!.**/**/*
!.**/**.*.*
!.**/.*/*
!.**/.*.*.*

.git/
**/_site/
**/node_modules/
/vendor/**
package.json

LICENSE
README.md
Gemfile
Gemfile.lock
package.json
package-lock.json
pnpm-lock.yaml
yarn.lock

0 comments on commit a190edc

Please sign in to comment.