Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase config #31

Merged
merged 5 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "ars-antiqua"
}
}
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@ jobs:
nix develop -c pnpm run test:unit
- name: Run Integration Tests
run: |
nix develop -c pnpm run test:integration
nix develop -c pnpm run test:integration
- name: Build Project
run: nix develop -c pnpm run build
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: build
path: build/
33 changes: 33 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy to Firebase Hosting on PR
on:
workflow_run:
workflows: ["Build"]
types:
- completed

permissions:
checks: write
contents: read
pull-requests: write
actions: read

jobs:
build_and_preview:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch != 'main' &&
github.event.workflow_run.head_repository.full_name == github.repository
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_ARS_ANTIQUA }}
projectId: ars-antiqua
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ vite.config.ts.timestamp-*
.vercel
/.svelte-kit
/build
test-results/
test-results/
coverage/

# Firebase
.firebase/
firebase-debug.log
16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
14 changes: 6 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
description = "Development environment for Ars Antiqua Online Edition";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
playwright.url = "github:pietdevries94/playwright-web-flake";
};

outputs = { self, nixpkgs, flake-utils, playwright }:
flake-utils.lib.eachDefaultSystem (system:
let
Expand All @@ -21,6 +19,7 @@
nodejs_22
pnpm
playwright-test
nodePackages.firebase-tools
];
commonEnv = {
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
Expand All @@ -35,7 +34,6 @@
export PLAYWRIGHT_BROWSERS_PATH=${commonEnv.PLAYWRIGHT_BROWSERS_PATH}
'';
};

checks.default = pkgs.runCommand "check-env" {
inherit buildInputs;
inherit (commonEnv) PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD PLAYWRIGHT_BROWSERS_PATH;
Expand All @@ -45,30 +43,30 @@
echo "Node.js v22 not found. Installed version: $(node --version)"
exit 1
fi

echo "Checking pnpm availability..."
pnpm --version || (echo "pnpm not found" && exit 1)

echo "Checking PLAYWRIGHT_BROWSERS_PATH..."
if [ -z "$PLAYWRIGHT_BROWSERS_PATH" ]; then
echo "PLAYWRIGHT_BROWSERS_PATH is not set"
exit 1
fi

echo "Checking if PLAYWRIGHT_BROWSERS_PATH exists..."
if [ ! -d "$PLAYWRIGHT_BROWSERS_PATH" ]; then
echo "PLAYWRIGHT_BROWSERS_PATH directory does not exist"
exit 1
fi

echo "Checking for specific browsers..."
for browser in chromium firefox webkit; do
if [ ! -d "$PLAYWRIGHT_BROWSERS_PATH/$browser"* ]; then
echo "$browser not found in PLAYWRIGHT_BROWSERS_PATH"
exit 1
fi
done

echo "Checking Firebase tools availability..."
if [ ! -e "${pkgs.nodePackages.firebase-tools}/bin/firebase" ]; then
echo "Firebase tools not found in the expected location"
exit 1
fi
touch $out
'';
}
Expand Down
23 changes: 15 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "vite dev --open",
"build": "vite build",
"serve": "serve build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
Expand All @@ -14,33 +15,39 @@
"test:integration": "playwright test",
"test:integration:ui": "playwright test --ui",
"test:unit": "vitest --run",
"test:unit:coverage": "vitest run --coverage",
"test:unit:watch": "vitest"
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@skeletonlabs/skeleton": "2.10.2",
"@skeletonlabs/tw-plugin": "0.4.0",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "^9.6.0",
"@types/node": "22.5.5",
"@vitest/coverage-v8": "^2.1.1",
"autoprefixer": "10.4.20",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"postcss": "8.4.47",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.7",
"svelte-check": "^4.0.0",
"tailwindcss": "3.4.12",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
"vite": "^5.0.3",
"vitest": "^2.0.0",
"postcss": "8.4.47",
"autoprefixer": "10.4.20",
"tailwindcss": "3.4.12",
"@skeletonlabs/skeleton": "2.10.2",
"@skeletonlabs/tw-plugin": "0.4.0",
"vite-plugin-tailwind-purgecss": "0.3.3",
"@types/node": "22.5.5"
"vitest": "^2.0.0"
},
"type": "module"
"type": "module",
"dependencies": {
"firebase": "^10.13.2"
}
}
Loading