From fb59ff3a6d55a48f71c4dc1d4163838e650e720a Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Thu, 19 Jan 2023 19:57:11 +1000 Subject: [PATCH] Update CI & Configs --- .github/workflows/ci.yml | 30 +++++++------------ .github/workflows/nightly.yml | 27 +++++++++++++++++ .github/workflows/pr.yml | 21 +++++++++++++ .trunk/.gitignore | 7 +++++ .trunk/configs/.markdownlint.yaml | 10 +++++++ .../configs/.prettierignore | 0 .../configs/prettier.config.cjs | 0 .trunk/configs/svgo.config.js | 14 +++++++++ .trunk/trunk.yaml | 28 +++++++++++++++++ vercel.json | 3 +- 10 files changed, 118 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .trunk/.gitignore create mode 100644 .trunk/configs/.markdownlint.yaml rename .prettierignore => .trunk/configs/.prettierignore (100%) rename prettier.config.cjs => .trunk/configs/prettier.config.cjs (100%) create mode 100644 .trunk/configs/svgo.config.js create mode 100644 .trunk/trunk.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3c24a14..65d74786 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,36 +1,26 @@ name: CI -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [master] - pull_request: - branches: [master] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: +on: push jobs: build-and-package: runs-on: ubuntu-latest - steps: - # Checks-out repository - name: Checkout uses: actions/checkout@v2 - uses: pnpm/action-setup@v2.2.4 with: version: latest - - uses: actions/setup-node@v3 - with: - node-version: latest - - run: pnpm install - - run: pnpm format:check - - run: pnpm build - - run: pnpm package - # Upload Artifact + - name: Install Dependencies + run: pnpm install + + - name: Build Package + run: pnpm build + + - name: Package Output + run: pnpm package + - name: Upload Artifact uses: "marvinpinto/action-automatic-releases@latest" with: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..e4e997e3 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,27 @@ +name: Nightly +on: + schedule: + - cron: 0 8 * * 1-5 + workflow_dispatch: {} + +jobs: + trunk_check: + name: Trunk Check Upload + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: latest + + - name: Install Dependencies + run: pnpm install + + - name: Trunk Check + uses: trunk-io/trunk-action@v1 + with: + trunk-token: ${{ secrets.TRUNK_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..9674cb70 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,21 @@ +name: Pull Request + +on: pull_request + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: latest + + - name: Install Dependencies + run: pnpm install + + - name: Build Package + run: pnpm build diff --git a/.trunk/.gitignore b/.trunk/.gitignore new file mode 100644 index 00000000..cf2f2547 --- /dev/null +++ b/.trunk/.gitignore @@ -0,0 +1,7 @@ +*out +*logs +*actions +*notifications +plugins +user_trunk.yaml +user.yaml diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml new file mode 100644 index 00000000..fb940393 --- /dev/null +++ b/.trunk/configs/.markdownlint.yaml @@ -0,0 +1,10 @@ +# Autoformatter friendly markdownlint config (all formatting rules disabled) +default: true +blank_lines: false +bullet: false +html: false +indentation: false +line_length: false +spaces: false +url: false +whitespace: false diff --git a/.prettierignore b/.trunk/configs/.prettierignore similarity index 100% rename from .prettierignore rename to .trunk/configs/.prettierignore diff --git a/prettier.config.cjs b/.trunk/configs/prettier.config.cjs similarity index 100% rename from prettier.config.cjs rename to .trunk/configs/prettier.config.cjs diff --git a/.trunk/configs/svgo.config.js b/.trunk/configs/svgo.config.js new file mode 100644 index 00000000..277f5f2e --- /dev/null +++ b/.trunk/configs/svgo.config.js @@ -0,0 +1,14 @@ +module.exports = { + plugins: [ + { + name: "preset-default", + params: { + overrides: { + removeViewBox: false, // https://github.com/svg/svgo/issues/1128 + sortAttrs: true, + removeOffCanvasPaths: true + } + } + } + ] +}; diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml new file mode 100644 index 00000000..dfc13ebd --- /dev/null +++ b/.trunk/trunk.yaml @@ -0,0 +1,28 @@ +version: 0.1 +cli: + version: 1.3.2 +plugins: + sources: + - id: trunk + ref: v0.0.8 + uri: https://github.com/trunk-io/plugins +lint: + enabled: + - markdownlint@0.33.0 + - prettier@2.8.3 + - oxipng@8.0.0 + - svgo@3.0.2 + - git-diff-check + - actionlint@1.6.22 + - gitleaks@8.15.2 +runtimes: + enabled: + - go@1.18.3 + - node@18.12.1 +actions: + disabled: + - trunk-announce + - trunk-check-pre-push + - trunk-fmt-pre-commit + enabled: + - trunk-upgrade-available diff --git a/vercel.json b/vercel.json index 09ab5a5f..7ae9a3de 100644 --- a/vercel.json +++ b/vercel.json @@ -1,6 +1,5 @@ { "github": { "silent": true - }, - "rewrites": [{ "source": "/(.*)", "destination": "/" }] + } }