Skip to content

Commit

Permalink
Merge pull request #34 from oxen-io/ci_improvements
Browse files Browse the repository at this point in the history
Ci improvements
  • Loading branch information
Aerilym authored Sep 17, 2024
2 parents 6fa49fe + f7c6cd8 commit 7b2225e
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 3 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Builds
on:
- pull_request

jobs:
builds:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: '.tool-versions'

- 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: Set environment variables
run: |
grep '^export ' ./apps/staking/scripts/mock-build-env.sh | sed 's/export //' >> $GITHUB_ENV
- name: Run builds
run: pnpm build
42 changes: 42 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Linting
on:
- push
- pull_request

jobs:
linting:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: '.tool-versions'

- 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: Run linter
run: pnpm lint
42 changes: 42 additions & 0 deletions .github/workflows/types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Type Checks
on:
- push
- pull_request

jobs:
type-checks:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: '.tool-versions'

- 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: Run type checks
run: pnpm check-types
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ You can run all tests at once with the following command:
pnpm test
```

## GitHub Actions

You can mock all the GitHub actions by running the following command:

```shell
pnpm gh
```

This will run the linting, type checking, unit tests, and build scripts for all apps and packages.

## Committing your changes

Before a commit is accepted the staged changes will be formatted using [prettier](https://prettier.io/) and linted
Expand Down
15 changes: 15 additions & 0 deletions apps/staking/scripts/mock-build-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

export NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=1234567890qwertyuiop
export NEXT_PUBLIC_SENT_STAKING_API_URL=http://localhost:5000/
export NEXT_PUBLIC_SENT_EXPLORER_API_URL=http://localhost:5001/
export FAUCET_WALLET_PRIVATE_KEY=0x1234567890123456789012345678901234567890123456789012345678901234
export FAUCET_DB_SECRET_KEY=1234567890123456789012345678901234567890123456789012345678901234
export FAUCET_CHAIN=testnet
export NEXTAUTH_URL=http://localhost:3000
export NEXTAUTH_SECRET=1234567890qwertyuiop
export DISCORD_CLIENT_ID=12345678901234567890
export DISCORD_CLIENT_SECRET=1234567890qwertyuiop
export TELEGRAM_BOT_TOKEN=1234567890:qwertyuiopasdfghjkl
export NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=1234567890qwertyuiop
export NEXT_PUBLIC_ENV_FLAG=prd
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"check-types": "pnpm turbo check-types",
"lint": "pnpm turbo lint",
"test": "pnpm turbo test",
"gh": "pnpm turbo gh",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"engines": "./scripts/engines.sh",
"clean:nm": "./scripts/clean-node-modules.sh",
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { type InitialLog, TimedLog } from './timedLog';
import { TimedLog, type InitialLog } from './timedLog';

export enum LOG_LEVEL {
DEBUG = 'debug',
Expand Down
10 changes: 10 additions & 0 deletions packages/ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: ['@session/eslint-config/next.js'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
1 change: 1 addition & 0 deletions packages/ui/components/ui/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
type ReactNode,
useState,
} from 'react';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/** @ts-ignore TS doesnt know what its talking about */
import { useDebounce } from '@uidotdev/usehooks';
import { cn } from '../../lib/utils';
Expand Down
2 changes: 2 additions & 0 deletions packages/util/logger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { pino } from 'pino';
import { LOG_LEVEL, SessionLogger, type SessionLoggerOptions } from '@session/logger';
import { isProduction } from './env';
Expand Down
10 changes: 9 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
"check-telemetry": {
"cache": false
},
"test": {}
"test": {},
"gh": {
"dependsOn": [
"^check-types",
"^lint",
"^test",
"^build"
]
}
}
}

0 comments on commit 7b2225e

Please sign in to comment.