Skip to content
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
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "fluffevent-votes",
"dockerComposeFile": ["docker-compose.yml"],
"service": "devcontainer",
"workspaceFolder": "/workdir",
"shutdownAction": "stopCompose",
"forwardPorts": [4321],
"portsAttributes": {
"4321": { "label": "app" }
},
"customizations": {
"vscode": {
"extensions": [
"astro-build.astro-vscode",
"mhutchie.git-graph"
]
}
}
}
19 changes: 19 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Services definition for devcontainer

name: fluffevent-votes

services:

devcontainer:
# Build
image: ghcr.io/matiboux/devbox-node-docker:24-pnpm
# Deploy
extra_hosts:
- host.docker.internal:host-gateway
environment:
COMPOSE_IGNORE_ORPHANS: 'true'
working_dir: /workdir
command: sleep infinity
volumes:
- ..:/workdir:cached
- /var/run/docker.sock:/var/run/docker.sock
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ indent_style = tab
indent_size = 4

# Markdown
[*.{md,markdown}]
[*.{md,markdown,mdoc}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2
Expand Down
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ IMAGES_PREFIX='fluffevent-votes'

# Docker ports
# (host ports: "*_PORT"; container ports: "*_DOCKER_PORT")
HTTP_PORT=''
HTTP_DOCKER_PORT=''
APP_PORT=''
APP_DOCKER_PORT=''

# Deployment
GITHUB_REPOSITORY_URL=''
Expand Down
41 changes: 32 additions & 9 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20

# Only run if:
# - Checks are not disabled
if: |
vars.CI_DISABLE_CHECKS != 'true'

steps:

# Dependency steps
# Initialization steps

- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

# Execution steps

Expand All @@ -81,7 +86,7 @@ jobs:
ASTRO_SITE_URL: ${{ vars.ASTRO_SITE_URL }}
ASTRO_BASE_PATH: ${{ vars.ASTRO_BASE_PATH }}
ASTRO_ASSETS_PREFIX: ${{ vars.ASTRO_ASSETS_PREFIX }}
# Application
# Application (app env vars)
# (Add env vars for your application here.)
run: |
# docker compose build
Expand Down Expand Up @@ -117,12 +122,21 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20

# Only run if:
# - Checks are not disabled
# - Tests are not disabled
# - Unit tests are not disabled
if: |
vars.CI_DISABLE_CHECKS != 'true' &&
vars.CI_DISABLE_TESTS != 'true' &&
vars.CI_DISABLE_TESTS_UNIT != 'true'

steps:

# Dependency steps
# Initialization steps

- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

# Execution steps

Expand All @@ -146,7 +160,7 @@ jobs:
ASTRO_SITE_URL: ${{ vars.ASTRO_SITE_URL }}
ASTRO_BASE_PATH: ${{ vars.ASTRO_BASE_PATH }}
ASTRO_ASSETS_PREFIX: ${{ vars.ASTRO_ASSETS_PREFIX }}
# Application
# Application (app env vars)
# (Add env vars for your application here.)
run: |
# docker compose build
Expand Down Expand Up @@ -234,12 +248,21 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20

# Only run if:
# - Checks are not disabled
# - Tests are not disabled
# - E2E tests are not disabled
if: |
vars.CI_DISABLE_CHECKS != 'true' &&
vars.CI_DISABLE_TESTS != 'true' &&
vars.CI_DISABLE_TESTS_E2E != 'true'

steps:

# Dependency steps
# Initialization steps

- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

# Execution steps

Expand All @@ -263,7 +286,7 @@ jobs:
ASTRO_SITE_URL: ${{ vars.ASTRO_SITE_URL }}
ASTRO_BASE_PATH: ${{ vars.ASTRO_BASE_PATH }}
ASTRO_ASSETS_PREFIX: ${{ vars.ASTRO_ASSETS_PREFIX }}
# Application
# Application (app env vars)
# (Add env vars for your application here.)
run: |
# docker compose build
Expand Down
57 changes: 51 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20

# Only run if:
# - Deploys are not disabled
if: |
vars.CI_DISABLE_DEPLOYS != 'true'

steps:

# Dependency steps
# Initialization steps

- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6

# Dependency steps

- name: Install jq
run: |
Expand Down Expand Up @@ -85,7 +92,7 @@ jobs:
load_var 'ASTRO_BASE_PATH' 'true'
load_var 'ASTRO_ASSETS_PREFIX' 'true'

# Application
# Application (app env vars)
# (Load env vars for your application here.)

echo '::endgroup::'
Expand Down Expand Up @@ -114,7 +121,7 @@ jobs:
ASTRO_SITE_URL: ${{ env.ASTRO_SITE_URL }}
ASTRO_BASE_PATH: ${{ env.ASTRO_BASE_PATH }}
ASTRO_ASSETS_PREFIX: ${{ env.ASTRO_ASSETS_PREFIX }}
# Application
# Application (app env vars)
# (Add env vars for your application here.)
run: |
# docker compose build
Expand All @@ -138,7 +145,7 @@ jobs:
echo '::endgroup::'

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
path: ./app/dist

Expand All @@ -154,6 +161,7 @@ jobs:

# Set GITHUB_TOKEN permissions for the job
permissions:
actions: write
id-token: write
pages: write

Expand All @@ -168,4 +176,41 @@ jobs:

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5

- name: Delete GitHub Pages artifact
uses: actions/github-script@v8
env:
GITHUB_RUN_ID: ${{ github.run_id }}
ARTIFACT_PATTERN: '^github-pages$'
with:
script: |
const runId = process.env.GITHUB_RUN_ID;
const artifactPattern = new RegExp(process.env.ARTIFACT_PATTERN);
const owner = context.repo.owner;
const repo = context.repo.repo;
core.info(`Listing artifacts for run '${runId}' in '${owner}/${repo}'...`);
const res = await github.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: runId,
});
const artifacts = res.data?.artifacts || [];
if (artifacts.length <= 0) {
core.info('No artifacts found.');
return;
}
const requiredArtifacts = artifacts.filter(a => artifactPattern.test(a.name));
if (requiredArtifacts.length <= 0) {
core.info('Required artifact(s) not found.');
return;
}
for (const artifact of requiredArtifacts) {
core.info(`Deleting artifact '${artifact.name}' (${artifact.id})...`);
await github.rest.actions.deleteArtifact({
owner,
repo,
artifact_id: artifact.id,
});
}
core.info('Done.');
10 changes: 7 additions & 3 deletions .github/workflows/scripts/load_app_config_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ load_var() {
if [ -n "${var_value}" ]; then
echo "${var_value}" | sed 's/^ */::add-mask::/'
fi

echo "Set ${var_name} (secret)"
echo "${var_name}<<GITHUB_ENV_EOF" >> "$GITHUB_ENV"
echo "${var_value}" >> "$GITHUB_ENV"
echo 'GITHUB_ENV_EOF' >> "$GITHUB_ENV"

{
echo "${var_name}<<GITHUB_ENV_EOF"
echo "${var_value}"
echo 'GITHUB_ENV_EOF'
} >> "${GITHUB_ENV}"
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ Thumbs.db
# -- Application rules:

# Node.js
.coverage/
.pnpm-store/
dist/
node_modules/
tsconfig*.tsbuildinfo

# Astro
.astro/
Expand All @@ -47,6 +49,9 @@ playwright-report/
playwright/.cache/
test-results/

# Generated source files
generated/

# -- Service rules:

# All services
Expand Down
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.PHONY: help install update check lint-docker test-unit test-e2e audit secrets ci

help:
@printf '%s\n' \
'install Install dependencies' \
'update Update dependencies' \
'check Run Astro and TypeScript checks' \
'lint-docker Lint Dockerfiles' \
'test-unit Run unit tests' \
'test-e2e Build app and run browser tests' \
'audit Audit Node dependencies' \
'secrets Scan git history for secrets' \
'ci Run lint, tests, audit, and secrets scan'

install:
@cd app && pnpm ci

update:
@cd app && pnpm update

check:
@cd app && pnpm run check

lint-docker:
@sh scripts/check_docker_lint.sh

test-unit:
@cd app && pnpm run test:vitest

test-e2e:
@cd app && pnpm run build-only && pnpm run test:playwright

audit:
@sh scripts/check_node_audit.sh

secrets:
@sh scripts/check_secrets_scan.sh

ci: check lint-docker test-unit test-e2e audit secrets
2 changes: 1 addition & 1 deletion app/.astro-template
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9b130416f4619c362e696c38e9b5123867c8a5b9
518a2e401c6033be85eea1abfc0843534f85c39c
5 changes: 5 additions & 0 deletions app/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
# -- Application rules:

# Node.js
**/.coverage/
**/.pnpm-store/
**/dist/
**/node_modules/
**/tsconfig*.tsbuildinfo

# Astro
**/.astro/
Expand All @@ -46,6 +48,9 @@
**/playwright/.cache/
**/test-results/

# Generated source files
**/generated/

# -- Service rules:

# All services
Expand Down
Loading
Loading