Skip to content

Commit

Permalink
chore: CI stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Jun 28, 2022
1 parent 6bf74cc commit 3cb3ada
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: [zwave-js] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: z-wave-js # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
72 changes: 72 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test and Release

# Run this job on all pushes to main and for pull requests
on:
push:
branches:
# This avoids having duplicate builds in non-forked PRs
- "main"
pull_request: {}

# Cancel previous PR/branch runs when a new commit is pushed
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
# ===================
# Catches style errors
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x] # This should be LTS

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

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install --immutable

- name: Compile TypeScript code
run: yarn build

- name: Run linter
run: yarn run lint

# ===================
# Runs unit tests
unit-tests:
if: contains(github.event.head_commit.message, '[skip ci]') == false

runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x] # This should be LTS

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

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install --immutable

# Compilation is necessary, or the tests won't run
- name: Compile TypeScript code
run: yarn run build

- name: Run component tests
run: yarn run test:ci
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "Dominic Griesel <dominic.griesel@nabucasa.com>",
"license": "MIT",
"scripts": {
"build": "tsc --verbose",
"build": "tsc",
"clean": "tsc --clean",
"watch": "yarn run build --watch --pretty",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fastifyLib from "fastify";
const fastify = fastifyLib({ logger: true });

// Declare a route
fastify.get("/", async (request, reply) => {
fastify.get("/", async (_request, _reply) => {
return { hello: "world!" };
});

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"outDir": "build",
"importsNotUsedAsValues": "error",
"pretty": true,
},
Expand Down

0 comments on commit 3cb3ada

Please sign in to comment.