break actions in multiple (#12)

feat: add linting workflow for code quality checks
feat: add testing workflow for unit tests and coverage reporting
chore: update .gitignore to include additional files
Co-authored-by: Arthur Abeilice <afa7789@gmail.com>
Reviewed-on: https://git.p2pix.co/doiim/p2pix-front-end/pulls/12
Co-authored-by: arthur <abeilice@kosmos.org>
Co-committed-by: arthur <abeilice@kosmos.org>
This commit is contained in:
arthur
2026-05-08 20:15:47 +00:00
committed by hueso
parent 616302ffbe
commit 9828a44cf8
8 changed files with 240 additions and 125 deletions

123
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,123 @@
name: Deploy to IPFS
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
container: oven/bun:1-alpine
steps:
- name: Install required tools
run: apk add --no-cache git
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build SPA
run: bun run build-only
- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 1
deploy-rsync:
needs: build
runs-on: ubuntu-latest
container: oven/bun:1-alpine
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Deploy via RSYNC
uses: up9cloud/action-rsync@v1
env:
USER: ${{ secrets.SSH_USER }}
HOST: ${{ secrets.SSH_HOST }}
KEY: ${{ secrets.SSH_KEY }}
SOURCE: dist/
TARGET: ${{ github.ref_name }}
deploy-ipfs:
needs: build
runs-on: ubuntu-latest
container: oven/bun:1-alpine
outputs:
cid: ${{ steps.ipfs.outputs.cid }}
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Deploy to IPFS
uses: ipshipyard/ipfs-deploy-action@v1
id: ipfs
with:
path-to-deploy: dist
set-github-status: false
set-pr-comment: false
kubo-api-url: ${{ secrets.KUBO_API_URL }}
kubo-api-auth: ${{ secrets.KUBO_API_AUTH }}
upload-car-artifact: false
deploy-pinata:
needs: [deploy-ipfs, deploy-rsync]
runs-on: ubuntu-latest
container: oven/bun:1-alpine
steps:
- name: Install required tools
run: apk add --no-cache bash curl jq git
- uses: actions/checkout@v4
with:
sparse-checkout: package.json
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Install Pinata CLI
run: curl -fsSL https://cli.pinata.cloud/install | bash
- name: Authenticate Pinata CLI
env:
PINATA_JWT: ${{ secrets.PINATA_JWT }}
run: echo -n "$PINATA_JWT" > ~/.pinata-files-cli
- name: Upload to Pinata
env:
PINATA_GROUP: ${{ secrets.PINATA_GROUP }}
IPFS_CID: ${{ needs.deploy-ipfs.outputs.cid }}
run: |
export PATH="$HOME/.local/share/pinata/:$PATH"
VERSION=$(jq -r .version package.json)
UPLOAD_JSON=$(pinata upload --group "$PINATA_GROUP" --name "p2pix_${VERSION}" ./dist)
CID=$(echo "$UPLOAD_JSON" | jq -r .cid)
if [ -z "$CID" ] || [ "$CID" = "null" ]; then
echo "Error: Could not parse CID. Output: $UPLOAD_JSON"
exit 1
fi
{
echo "## Deploy Summary"
echo "- IPFS CID (kubo): \`$IPFS_CID\`"
echo "- Pinata CID: \`$CID\`"
echo "- Version: \`$VERSION\`"
} >> "$GITHUB_STEP_SUMMARY"

View File

@@ -1,70 +0,0 @@
name: Deploy to IPFS
on:
push:
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build SPA
run: bun run build-only
- name: Deploy via RSYNC
uses: up9cloud/action-rsync@master
env:
USER: ${{secrets.SSH_USER}}
HOST: ${{secrets.SSH_HOST}}
KEY: ${{secrets.SSH_KEY}}
SOURCE: dist/
TARGET: ${{ gitea.ref_name }}
- name: Deploy to IPFS
uses: ipshipyard/ipfs-deploy-action@v1
id: deploy
with:
path-to-deploy: dist
set-github-status: false
set-pr-comment: false
kubo-api-url: ${{ secrets.KUBO_API_URL }}
kubo-api-auth: ${{ secrets.KUBO_API_AUTH }}
upload-car-artifact: false
- name: Install Pinata CLI
if: secrets.PINATA_JWT != ''
shell: bash
run: curl -fsSL https://cli.pinata.cloud/install | bash
- name: Authenticate Pinata CLI (write JWT to file)
if: secrets.PINATA_JWT != ''
env:
PINATA_JWT: ${{ secrets.PINATA_JWT }}
run: |
echo -n "$PINATA_JWT" > ~/.pinata-files-cli
- name: Upload build output to Pinata
if: secrets.PINATA_JWT != ''
id: pinata_upload
run: |
export PATH="$HOME/.local/share/pinata/:$PATH"
VERSION=$(jq -r .version package.json)
UPLOAD_JSON=$(pinata upload --group "${{ secrets.PINATA_GROUP }}" --name "p2pix_${VERSION}" ./dist)
CID=$(echo "$UPLOAD_JSON" | jq -r .cid)
if [ -z "$CID" ] || [ "$CID" = "null" ]; then
echo "Error: Could not parse CID from Pinata upload output. Aborting."
echo "Upload output: $UPLOAD_JSON"
exit 1
fi
echo "CID=$CID" >> $GITHUB_OUTPUT

30
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Lint & Format
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
container: oven/bun:1-alpine
steps:
- name: Install required tools
run: apk add --no-cache git
- uses: actions/checkout@v4
- name: Install dependencies
run: bun install --frozen-lockfile
- name: ESLint
run: bun run lint
- name: Prettier check
run: bun run format:check

28
.github/workflows/tests.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
jobs:
unit:
runs-on: ubuntu-latest
container: oven/bun:1-alpine
steps:
- name: Install required tools
run: apk add --no-cache git
- uses: actions/checkout@v4
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Unit tests (vitest)
run: bunx vitest run --passWithNoTests

2
.gitignore vendored
View File

@@ -14,6 +14,8 @@ dist-ssr
coverage
*.local
vendor/
.dagrobin
.claude
/cypress/videos/
/cypress/screenshots/

View File

@@ -1 +1,3 @@
{}
{
"singleQuote": true
}