Skip to content

Commit

Permalink
Merge pull request #83 from radical-data/github-actions
Browse files Browse the repository at this point in the history
Add CI workflow with caching and linting
  • Loading branch information
jokroese authored Jul 5, 2024
2 parents 760b989 + 7f4e624 commit f74bd69
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
NODE_VERSION: '22'

jobs:
lint:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-
- name: Install dependencies
run: npm install

- name: Lint code
run: npm run lint
4 changes: 2 additions & 2 deletions src/lib/scripts/seedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function getRandomCoordinate(min: number, max: number): number {
}

function generateRandomWord(): string {
// Source: https://stackoverflow.com/a/8084248
return (Math.random() + 1).toString(36).substring(9);
}

Expand Down Expand Up @@ -55,6 +54,7 @@ function generateAndSaveMoments(count: number, filePath: string): void {
// Remove empty properties from each feature
const simplifiedMoments = {
...moments,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
features: moments.features.map(({ properties, ...rest }) => rest)
};

Expand All @@ -71,7 +71,7 @@ function generateAndSaveDescriptions(count: number, filePath: string): void {
saveToFile(descriptions, filePath);
}

function saveToFile(data: any, filePath: string): void {
function saveToFile<T>(data: T, filePath: string): void {
const dir = dirname(filePath);
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
Expand Down

0 comments on commit f74bd69

Please sign in to comment.