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

feat: Setup CI/CD Pipeline, Linters, and Development Environment #1

Merged
merged 3 commits into from
Mar 14, 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
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Auto detect text files and perform LF normalization
* text=auto
* text=lf
*.js linguist-detect=false
30 changes: 30 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Code Check on Push

on:
push:
branches-ignore:
- main

jobs:
lint-and-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install
working-directory: ./blurhasher

- name: Run linter
run: npm run lint
working-directory: ./blurhasher

- name: Build
run: npm run build
working-directory: ./blurhasher
29 changes: 29 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pull Request Check

on:
pull_request:
branches: [main]

jobs:
lint-and-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install
working-directory: ./blurhasher

- name: Run linter
run: npm run lint
working-directory: ./blurhasher

- name: Build
run: npm run build
working-directory: ./blurhasher
80 changes: 80 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Release CI/CD

on:
push:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install
working-directory: ./blurhasher

- name: Run linter
run: npm run lint
working-directory: ./blurhasher

build:
needs: lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: npm install
working-directory: ./blurhasher

- name: Build
run: npm run build
working-directory: ./blurhasher

- name: Archive built files
run: tar -czvf build.tar.gz -C ./blurhasher dist package.json package-lock.json

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: built-files
path: build.tar.gz

semantic-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: built-files
path: ./blurhasher

- name: Semantic Release
run: npx semantic-release
working-directory: ./blurhasher
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

database/
uploads/
**/.DS_Store
**/node_modules
**/dist
**/data.db
**/data.db
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint"]
}
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"editor.formatOnSave": true,
"prettier.trailingComma": "es5",
"files.eol": "\n",
"eslint.validate": ["javascript", "typescript"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"files.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/dist": true
},
"search.exclude": {
"**/node_modules": true,
"**/dist": true
},
"editor.rulers": [120]
}
Loading