Skip to content

Commit

Permalink
Add initial site
Browse files Browse the repository at this point in the history
  • Loading branch information
reupen committed Sep 27, 2023
0 parents commit 6bab325
Show file tree
Hide file tree
Showing 144 changed files with 14,349 additions and 0 deletions.
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaults
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
env.d.ts
36 changes: 36 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
env: {
node: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic",
"plugin:astro/recommended",
"prettier",
],
overrides: [
{
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
{
files: ["*.astro"],
parser: "astro-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {},
}
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto
*.webp filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
33 changes: 33 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
actions:
patterns:
- "*"

- package-ecosystem: npm
directory: /
schedule:
interval: monthly
versioning-strategy: increase
open-pull-requests-limit: 5
groups:
astro:
patterns:
- "astro"
- "astro-*"
- "@astrojs/*"
eslint:
patterns:
- "eslint"
- "eslint-*"
- "@typescript-eslint/*"
postcss:
patterns:
- "postcss*"
- "cssnano"
171 changes: 171 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: Lint, test and deploy

on:
pull_request:
workflow_call:
workflow_dispatch:
push:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm

- name: Install Node.js dependencies
run: npm ci

- name: Check formatting
run: npm run format:check

- name: Run Astro check
run: npm run check

- name: Lint
run: npm run lint

build-site:
name: Build site
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm

- name: Install Node.js dependencies
run: npm ci

- name: Pull LFS source files
run: git lfs pull --include=src

- name: Restore Astro cache
uses: actions/cache@v3
with:
path: node_modules/.astro
key: ${{ runner.os }}-astro-${{ hashFiles('**/package-lock.json', 'src/content/images/*.webp', 'src/content/images/*.jpg') }}

- name: Build site
run: |
npm run build
tar -czvf /tmp/site.tar.gz dist/
- name: Upload artefact
uses: actions/upload-artifact@v3
with:
name: site
path: /tmp/site.tar.gz
retention-days: 1

get-playwright-version:
name: Get Playwright version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Git clone repository
uses: actions/checkout@v4

- id: get-version
name: Get Playwright version
run: |
echo "version=$(python scripts/get_playwright_version.py)" >> "$GITHUB_OUTPUT"
test-e2e:
name: Run e2e tests
runs-on: ubuntu-latest
needs:
- build-site
- get-playwright-version
container:
image: mcr.microsoft.com/playwright:v${{ needs.get-playwright-version.outputs.version }}
steps:
- name: Install Git LFS
run: |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install -y git-lfs
- name: Git clone repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm

- name: Install Node.js dependencies
run: npm ci

- name: Download built site
uses: actions/download-artifact@v3
with:
name: site
path: /tmp

- name: Unpack site
run: tar -xzf /tmp/site.tar.gz

- name: Pull LFS test snapshots
run: |
git config --global --add safe.directory "$(pwd)"
git lfs pull --include=test/e2e
- name: Run e2e tests
run: npm exec --no -- playwright test
env:
HOME: /root

- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e-test-results
path: test/e2e/output

deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
needs:
- build-site
- lint
- test-e2e
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download built site
uses: actions/download-artifact@v3
with:
name: site
path: /tmp

- name: Unpack site
run: tar -xzf /tmp/site.tar.gz

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: a15c47006c45966652a70d01bf3629a5
projectName: photos-reupen-uk
directory: dist/
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: "3"
137 changes: 137 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Based on https://github.com/github/gitignore/blob/main/Node.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.astro/
/test/e2e/output/
.ruff_cache/
__pycache__/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/hydrogen
Loading

0 comments on commit 6bab325

Please sign in to comment.