Skip to content

Commit

Permalink
new ci workflows (#1041)
Browse files Browse the repository at this point in the history
Adds the CI workflows to run on PRs, also organizes imports and other small lint/typecheck fixes. After this merges, I'll add the actual merge requirement rules in the repo
  • Loading branch information
itsMapleLeaf authored Mar 27, 2024
1 parent 686fea7 commit b994162
Show file tree
Hide file tree
Showing 19 changed files with 88 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Install Tools & Dependencies
description: Installs pnpm, Node.js & package dependencies
name: Setup Node.js & pnpm
description: Setup Node.js and pnpm and install dependencies

runs:
using: composite
steps:
- name: Setup PNPM
- name: Setup pnpm
uses: pnpm/action-setup@v3

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm

- name: Install dependencies
run: pnpm install
shell: bash
run: pnpm install
6 changes: 2 additions & 4 deletions .github/workflows/blog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
- name: Setup Node.js & install dependencies
uses: ./.github/actions/setup-node-pnpm

- name: Draft minor release blog post
run: node scripts/draft-release-post.mjs
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/format-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Format main branch

on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
format:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js & install dependencies
uses: ./.github/actions/setup-node-pnpm

- name: Format
run: pnpm run format

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[ci] format"
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- name: Check out code using Git
uses: actions/checkout@v4

- name: Install Tools & Dependencies
uses: ./.github/actions/install
- name: Setup Node.js & install dependencies
uses: ./.github/actions/setup-node-pnpm

- name: Search NPM for new and deprecated integrations
run: pnpm run update:integrations
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Checks

on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
script: [lint, typecheck]
fail-fast: false
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js & install dependencies
uses: ./.github/actions/setup-node-pnpm

- name: Run ${{ matrix.script }}
run: pnpm run ${{ matrix.script }}
4 changes: 2 additions & 2 deletions .github/workflows/weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- name: Check out code using Git
uses: actions/checkout@v4

- name: Install Tools & Dependencies
uses: ./.github/actions/install
- name: Setup Node.js & install dependencies
uses: ./.github/actions/setup-node-pnpm

- name: Search NPM for new and deprecated integrations
run: pnpm run update:integrations --unsafe
Expand Down
2 changes: 1 addition & 1 deletion scripts/migrate-integrations.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import yaml from "json-to-pretty-yaml";
import fs from "node:fs";
import path from "node:path";
import yaml from "json-to-pretty-yaml";
import slugify from "slugify";

function main() {
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-integrations.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import matter from "gray-matter";
import yaml from "json-to-pretty-yaml";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import matter from "gray-matter";
import yaml from "json-to-pretty-yaml";
import slugify from "slugify";
import glob from "tiny-glob";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collapse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from "clsx";
import { createEffect, createSignal, onCleanup, onMount, splitProps, type JSX } from "solid-js";
import { type JSX, createEffect, createSignal, onCleanup, onMount, splitProps } from "solid-js";

export default function Collapse(
props: { children: JSX.Element; isOpen: boolean } & JSX.IntrinsicElements["div"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/DropdownMultiSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSignal, For, type JSX } from "solid-js";
import { For, type JSX, createSignal } from "solid-js";
import { getElement, getElements } from "~/helpers/dom.js";
import ChevronIcon from "~/icons/ChevronIcon.jsx";
import CheckCircleIcon from "~/icons/integrations/CheckCircleIcon.jsx";
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/discord.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetch, { FormData, Headers, type Response } from "node-fetch";
import { posix } from "node:path";
import fetch, { FormData, Headers, type Response } from "node-fetch";
import { z } from "zod";

const discordMessageAttachmentSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/integrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCollection, type CollectionEntry } from "astro:content";
import { type CollectionEntry, getCollection } from "astro:content";
import { IntegrationCategories } from "~/content/config.js";
import type { MapKeys } from "./types.ts";

Expand Down
6 changes: 4 additions & 2 deletions src/icons/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ const categoryIcons = new Map([
]);

export function iconForCategory(category: string) {
return randomFromArray(categoryIcons.get(category) ?? categoryIcons.get("other") ?? []);
return (
randomFromArray(categoryIcons.get(category) ?? categoryIcons.get("other") ?? []) ?? PuzzleIcon
);
}

export function iconForIntegration(integration: CollectionEntry<"integrations">) {
const icons = integration.data.categories.flatMap(
(category) => categoryIcons.get(category) ?? [],
);

return randomFromArray(icons);
return randomFromArray(icons) ?? PuzzleIcon;
}
2 changes: 1 addition & 1 deletion src/pages/_components/ExampleShowcase.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from "clsx";
import { createEffect, createSignal, For } from "solid-js";
import { For, createEffect, createSignal } from "solid-js";
import Collapse from "~/components/Collapse.jsx";
import { positiveMod } from "~/helpers/math.js";
import agenciesImage from "../_assets/example-agencies.png";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/showcase.json.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { APIRoute } from "astro";
import { getCollection } from "astro:content";
import type { APIRoute } from "astro";

export const GET: APIRoute = async () => {
const showcase = await getCollection("showcase");
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/v1/integrations/[...page].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { APIRoute } from "astro";
import { integrations as LAST_MODIFIED } from "~/data/last-modified.json";
import {
getFilteredIntegrations,
validateCategories,
validCategories,
validateCategories,
} from "~/helpers/integrations.ts";
import { paginate } from "~/helpers/paginate.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCollection } from "astro:content";
import rss from "@astrojs/rss";
import type { APIRoute } from "astro";
import { getCollection } from "astro:content";

function sortPosts(a: { data: { publishDate: Date } }, b: { data: { publishDate: Date } }) {
return Number(b.data.publishDate) - Number(a.data.publishDate);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/themes/submit/_components/ThemeImageUploader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSignal, For, onMount, Show } from "solid-js";
import { For, Show, createSignal, onMount } from "solid-js";
import type { JSX } from "solid-js/jsx-runtime";
import FileUploadIcon from "~/icons/FileUploadIcon.jsx";

Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"jsx": "preserve",
"jsxImportSource": "solid-js"
},
"include": ["**/*", ".eslintrc.cjs"],
"exclude": ["node_modules", "dist", ".vercel", "public"]
}

0 comments on commit b994162

Please sign in to comment.