Skip to content

Commit

Permalink
📝 chore: Added linter and CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
fwestling committed Mar 21, 2024
1 parent 5abfb0b commit 19a2cfc
Show file tree
Hide file tree
Showing 24 changed files with 1,952 additions and 116 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
5 changes: 5 additions & 0 deletions .changeset/chilled-rivers-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@first-australia/latitude-scheduler": patch
---

Updated tooling and added linter
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/odd-walls-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@first-australia/latitude-scheduler": patch
---

Fixed all linter errors
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
CI: true
NODE_VERSION: 20
PNPM_CACHE_FOLDER: .pnpm-store

jobs:
test:
uses: ./.github/workflows/test.yml
name: Test
release:
name: Release
needs: test
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ NODE_VERSION }}

- name: install pnpm
run: npm i pnpm@latest -g

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- name: setup pnpm config
run: pnpm config set store-dir $PNPM_CACHE_FOLDER

- name: install dependencies
run: pnpm install

- name: create and publish versions
uses: changesets/action@v1
with:
version: pnpm ci:version
commit: "chore: update versions"
title: "chore: update versions"
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Run tests

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
name: Run tests
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Type Check
run: pnpm tsc

- name: Test
run: pnpm test

- name: Upload artifact for test stats
uses: actions/upload-artifact@v4
with:
name: tests
path: ./test-results
13 changes: 13 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
},
"ignore": ["dist/"]
}
}
35 changes: 35 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# EXAMPLE USAGE:
#
# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
# pre-push:
# commands:
# packages-audit:
# tags: frontend security
# run: yarn audit
# gems-audit:
# tags: backend security
# run: bundle audit
#
# pre-commit:
# parallel: true
# commands:
# eslint:
# glob: "*.{js,ts,jsx,tsx}"
# run: yarn eslint {staged_files}
# rubocop:
# tags: backend style
# glob: "*.rb"
# exclude: '(^|/)(application|routes)\.rb$'
# run: bundle exec rubocop --force-exclusion {all_files}
# govet:
# tags: backend style
# files: git ls-files -m
# glob: "*.go"
# run: go vet {files}
# scripts:
# "hello.js":
# runner: node
# "any.go":
# runner: go run
33 changes: 27 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "latitude-scheduler",
"version": "1.0.0",
"description": "",
"name": "@first-australia/latitude-scheduler",
"version": "0.0.1",
"description": "This repository is the latest iteration of the FIRST Australia scheduling software (primarily for use in scheduling FIRST LEGO League tournaments).",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand All @@ -11,15 +11,25 @@
"scripts": {
"dev": "ts-node src/index.ts",
"build": "tsup",
"test": "jest"
"test": "jest",
"lint": "pnpm dlx @biomejs/biome lint ./src ",
"lint:files": "pnpm dlx @biomejs/biome lint ./src 2>&1 | egrep '\\.(ts|tsx):' ",
"lint:fix": "pnpm dlx @biomejs/biome lint ./src --apply",
"format": "pnpm dlx @biomejs/biome format ./src --write",
"ci:version": "pnpm changeset version",
"ci:publish": "pnpm publish -r",
"postinstall": "pnpm lefthook install"
},
"keywords": [],
"author": "",
"author": "Fred Westling",
"license": "ISC",
"devDependencies": {
"@biomejs/biome": "^1.6.1",
"@changesets/cli": "^2.27.1",
"@types/jest": "^29.5.11",
"@types/luxon": "^3.3.7",
"jest": "^29.7.0",
"lefthook": "^1.6.7",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"tsup": "^8.0.1",
Expand All @@ -28,5 +38,16 @@
"dependencies": {
"luxon": "^3.4.4",
"uuid": "^9.0.1"
}
},
"directories": {
"test": "tests"
},
"repository": {
"type": "git",
"url": "git+https://github.com/firstaustralia/latitude-scheduler.git"
},
"bugs": {
"url": "https://github.com/firstaustralia/latitude-scheduler/issues"
},
"homepage": "https://github.com/firstaustralia/latitude-scheduler#readme"
}
Loading

0 comments on commit 19a2cfc

Please sign in to comment.