Skip to content

Commit

Permalink
Create some gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Jun 4, 2024
1 parent a34a0cd commit a4286c1
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 27 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Linting & formatting

on:
push:
branches: ["master", "actions"]
workflow_dispatch:

jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Format code
run: pnpm run format

- name: Check for Changes
id: check_changes
run: |
git diff --exit-code || echo "::set-output name=changes::true"
- name: Commit Changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Auto-format code"
- name: Push Changes
if: steps.check_changes.outputs.changes == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}

lint:
runs-on: ubuntu-latest
needs: formatting
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Lint it
run: pnpm run lint:no-fmt
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test using vitest

on:
push:
branches: "master"
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Test it
run: pnpm run test
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest",
"lint": "prettier --check . && eslint .",
"lint:no-fmt": "eslint .",
"format": "prettier --write ."
},
"devDependencies": {
"@skeletonlabs/skeleton": "^2.10.0",
"@skeletonlabs/tw-plugin": "^0.4.0",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
Expand Down
25 changes: 0 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a4286c1

Please sign in to comment.