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

chore: initial release #1

Merged
merged 2 commits into from
Nov 26, 2024
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.*
*
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_size = 4
indent_style = tab
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nvmrc=~/.nvm/nvm.sh
source $nvmrc
nvm use
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2019
},
"rules": {
}
}
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: '11:00'
timezone: Japan
labels:
- "dependencies"
allow:
- dependency-type: "production"
commit-message:
prefix: deps

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: '11:00'
timezone: Japan
labels:
- "CI/CD"
commit-message:
prefix: ci
21 changes: 21 additions & 0 deletions .github/workflows/actions_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release GitHub Actions

on:
workflow_dispatch:
inputs:
tag:
description: "Tag for the release"
required: true

permissions:
contents: read

jobs:
release:
permissions:
actions: read
id-token: write
contents: write
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
with:
tag: "${{ github.event.inputs.tag }}"
24 changes: 24 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Code Scanning"

on:
push:
branches:
- main
pull_request:

jobs:
CodeQL-Build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
16 changes: 16 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency Review'

on:
pull_request:

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/dependency-review-action@v4
33 changes: 33 additions & 0 deletions .github/workflows/dev-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Dev Image CI'

on:
push:
branches:
- main
paths:
- '.github/workflows/dev-image.yml'
- '.dockerignore'
- '.nvmrc'
- 'Dockerfile'
- 'Makefile'
pull_request:
types:
- opened
- synchronize
paths:
- '.github/workflows/dev-image.yml'
- '.dockerignore'
- '.nvmrc'
- 'Dockerfile'
- 'Makefile'

jobs:
dev-image-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: make build
- run: make cirun cmd="npm ci"
# - run: make ciall
- run: make cirun cmd="npm run format:check"
- run: make cirun cmd="npm run lint"
36 changes: 36 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Daily Test

on:
schedule:
- cron: '13 13 * * *'
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- 'ubuntu-20.04'
- 'ubuntu-latest'
hugo-version:
- 'latest'
- '0.61.0'
extended:
- true
- false
steps:
- uses: actions/checkout@v4

- name: Setup Hugo
uses: ./
with:
hugo-version: ${{ matrix.hugo-version }}
extended: ${{ matrix.extended }}

- name: Run hugo version
run: echo "::set-output name=hugo_version::$(hugo version)"
id: hugo_version

- name: '${{ steps.hugo_version.outputs.hugo_version }}'
run: echo '${{ steps.hugo_version.outputs.hugo_version }}'
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 'Test'

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-22.04'
- 'ubuntu-20.04'
- 'ubuntu-latest'
- 'macos-latest'
- 'windows-latest'
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- run: npm ci

- name: Run prettier
if: startsWith(matrix.os, 'ubuntu-22.04')
run: npm run format:check

- name: Run eslint
if: startsWith(matrix.os, 'ubuntu-22.04')
run: npm run lint

- name: Run ncc
if: startsWith(matrix.os, 'ubuntu-22.04')
run: npm run build

- run: npm test

- name: Upload test coverage as artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}
path: coverage

- uses: codecov/codecov-action@v5
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
coverage
.npm
.eslintcache
.env
node_modules
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
2 changes: 2 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npm ci
git remote prune origin
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.11.1
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"git.ignoreLimitWarning": true,
"deno.enable": false
}
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG NODE_VERSION

FROM node:${NODE_VERSION}-buster-slim

SHELL ["/bin/bash", "-l", "-c"]

RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \
ca-certificates \
wget && \
rm -rf /var/lib/apt/lists/*

WORKDIR /git
ENV GIT_VERSION="2.28.0"
RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \
tar -zxf "./v${GIT_VERSION}.tar.gz" && \
rm "./v${GIT_VERSION}.tar.gz" && \
cd "./git-${GIT_VERSION}" && \
make configure && \
./configure --prefix=/usr && \
make all && \
make install

WORKDIR /repo
ENV RUNNER_TEMP="/tmp"

CMD [ "bash" ]
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2023 StepSecurity
Copyright (c) 2019 Shohei Ueda (peaceiris)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmd := "bash"
msg := ""
IMAGE_NAME := actions_hugo_dev:latest
NODE_VERSION := $(shell cat ./.nvmrc)
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)


.PHONY: build
build:
$(DOCKER_BUILD)

.PHONY: run
run:
$(DOCKER_RUN) $(cmd)

.PHONY: cirun
cirun:
$(DOCKER_RUN_CI) $(cmd)

.PHONY: test
test:
$(DOCKER_RUN) npm test

.PHONY: all
all:
$(DOCKER_RUN) npm run all

.PHONY: ciall
ciall:
$(DOCKER_RUN_CI) npm run all
Loading
Loading