Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
default_install_hook_types:
- pre-commit
- pre-push
- commit-msg
default_stages:
- pre-commit
- pre-push
repos:
- hooks:
- id: check-hooks-apply
- id: check-useless-excludes
repo: meta
- hooks:
- args:
- --allow-multiple-documents
id: check-yaml
types: ["yaml"]
- id: check-merge-conflict
- id: check-added-large-files
- id: trailing-whitespace
- id: end-of-file-fixer
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
- hooks:
- id: yamllint
args: [--strict, -c=.yamllint]
exclude: "(.github|tests|.woodpecker|pnpm-lock.yaml)/.*"
repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
- hooks:
- id: validate-eslint
repo: https://github.com/jordanopensource/pre-commit-hooks
rev: v0.4.5
- hooks:
- id: gitleaks
name: detect hardcoded secrets
repo: https://github.com/zricethezav/gitleaks
rev: v8.26.0
- hooks:
- id: commitizen
stages:
- commit-msg
repo: https://github.com/commitizen-tools/commitizen
rev: v4.7.1
50 changes: 20 additions & 30 deletions .woodpecker/build-latest-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,10 @@ when:
- event: [pull_request]
# Only run when PR targets development or other branches (not main)
evaluate: 'CI_COMMIT_TARGET_BRANCH != "main"'
# Build the source branch
branch:
exclude: [main]
- event: [pull_request]
# Also build latest image when development branch creates PR to main
evaluate: 'CI_COMMIT_TARGET_BRANCH == "main" && CI_COMMIT_BRANCH == "development"'
branch: [development]

variables:
- &docker_repo "josaorg/contributions-web"
- &slack_channel "builds"
# Docker build arguments template
- &build_args_template
CI_COMMIT_SHA: ${CI_COMMIT_SHA}
CI_BUILD_NUMBER: ${CI_BUILD_NUMBER}
CI_BUILD_LINK: ${CI_BUILD_LINK}
CI_COMMIT_LINK: ${CI_COMMIT_LINK}
CI_REPO_LINK: ${CI_REPO_LINK}
CI_BUILD_FINISHED: ${CI_BUILD_FINISHED}
CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80
MATOMO_SITE_ID: "11"
TARGET_ENV: production
# Success message template
- &success_message >
✅ *SUCCESS* - Latest Build #{{ build.number }}
Expand All @@ -52,10 +34,11 @@ variables:

steps:
# Security check - scan for secrets/credentials
- name: check-for-leaks
image: zricethezav/gitleaks:v8.18.4
commands:
- gitleaks detect --source . --verbose
- name: run-pre-commit-hooks
image: josaorg/pre-commit-runner
settings:
args: "--all-files"
skip: "end-of-file-fixer, yamllint"

# Build latest image (development and other branches)
- name: build-latest-image
Expand All @@ -71,13 +54,20 @@ steps:
password:
from_secret: DOCKER_HUB_PASSWORD
build_args:
{
CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80,
MATOMO_SITE_ID: "11",
TARGET_ENV: production,
}
CI_REPO: "${CI_REPO}"
CI_REPO_NAME: "${CI_REPO_NAME}"
CI_REPO_URL: "${CI_REPO_URL}"
CI_COMMIT_SHA: "${CI_COMMIT_SHA}"
CI_COMMIT_REF: "${CI_COMMIT_REF}"
CI_PIPELINE_URL: "${CI_PIPELINE_URL}"
CI_PIPELINE_CREATED: "${CI_PIPELINE_CREATED}"
CI_PREV_PIPELINE_URL: "${CI_PREV_PIPELINE_URL}"
CI_PIPELINE_NUMBER: "${CI_PIPELINE_NUMBER}"
CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80
MATOMO_SITE_ID: "11"
TARGET_ENV: production
depends_on:
- check-for-leaks
- run-pre-commit-hooks

# Slack notification for latest build success
- name: notify-slack-latest-success
Expand All @@ -90,7 +80,7 @@ steps:
when:
- status: success
depends_on:
- check-for-leaks
- run-pre-commit-hooks
- build-latest-image

# Slack notification for latest build failure
Expand All @@ -104,5 +94,5 @@ steps:
when:
- status: failure
depends_on:
- check-for-leaks
- run-pre-commit-hooks
- build-latest-image
41 changes: 20 additions & 21 deletions .woodpecker/build-stable-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ when:
variables:
- &docker_repo "josaorg/contributions-web"
- &slack_channel "builds"
# Docker build arguments template
- &build_args_template
CI_COMMIT_SHA: ${CI_COMMIT_SHA}
CI_BUILD_NUMBER: ${CI_BUILD_NUMBER}
CI_BUILD_LINK: ${CI_BUILD_LINK}
CI_COMMIT_LINK: ${CI_COMMIT_LINK}
CI_REPO_LINK: ${CI_REPO_LINK}
CI_BUILD_FINISHED: ${CI_BUILD_FINISHED}
# Success message template
- &success_message >
✅ *SUCCESS* - Stable Build #{{ build.number }}
Expand All @@ -43,11 +35,11 @@ variables:
• <{{ build.link }}|View Build>

steps:
# Security check - scan for secrets/credentials
- name: check-for-leaks
image: zricethezav/gitleaks:v8.18.4
commands:
- gitleaks detect --source . --verbose
- name: run-pre-commit-hooks
image: josaorg/pre-commit-runner
settings:
args: "--all-files"
skip: "end-of-file-fixer, yamllint"

# Build stable image (main branch only)
- name: build-stable-image
Expand All @@ -63,13 +55,20 @@ steps:
password:
from_secret: DOCKER_HUB_PASSWORD
build_args:
{
CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80,
MATOMO_SITE_ID: "11",
TARGET_ENV: production,
}
CI_REPO: "${CI_REPO}"
CI_REPO_NAME: "${CI_REPO_NAME}"
CI_REPO_URL: "${CI_REPO_URL}"
CI_COMMIT_SHA: "${CI_COMMIT_SHA}"
CI_COMMIT_REF: "${CI_COMMIT_REF}"
CI_PIPELINE_URL: "${CI_PIPELINE_URL}"
CI_PIPELINE_CREATED: "${CI_PIPELINE_CREATED}"
CI_PREV_PIPELINE_URL: "${CI_PREV_PIPELINE_URL}"
CI_PIPELINE_NUMBER: "${CI_PIPELINE_NUMBER}"
CONTRIBUTIONS_API_URL: http://contributions.api.svc.cluster.local:80
MATOMO_SITE_ID: "11"
TARGET_ENV: production
depends_on:
- check-for-leaks
- run-pre-commit-hooks

# Slack notification for stable build success
- name: notify-slack-stable-success
Expand All @@ -82,7 +81,7 @@ steps:
when:
- status: success
depends_on:
- check-for-leaks
- run-pre-commit-hooks
- build-stable-image

# Slack notification for stable build failure
Expand All @@ -96,5 +95,5 @@ steps:
when:
- status: failure
depends_on:
- check-for-leaks
- run-pre-commit-hooks
- build-stable-image
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ To ensure a smooth and collaborative process, please take a moment to review thi
## Code or Documentation Contributions

1. [Fork this repository](https://github.com/jordanopensource/contributions-web/fork).
2. Clone the forked repository to your local machine with this command:
2. Clone the forked repository to your local machine with this command:
`git clone https://github.com/<your github username>/contributions-web.git`
3. Switch to `development` branch with this command: `git checkout development`.
3. Switch to `development` branch with this command: `git checkout development`.
**If your contribution is a documentation, jump to step 7 below**.
4. (**_You can ignore this step if you're using docker compose_**) Create a `.env` file and copy the content of [`.env.sample`](https://github.com/jordanopensource/contributions-web/blob/development/.env.sample) file into it,
then add the value(s) of environment variable(s).
You can use the current running API URL as the value to `CONTRIBUTIONS_API_URL` variable as the following:
`CONTRIBUTIONS_API_URL=https://contributions.api.prod.josa.ngo/`

5. [Run the project locally](https://github.com/jordanopensource/contributions-web/blob/main/CONTRIBUTING.md#running-the-project-locally).
6. Check current [issues](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest),
and if you're a beginner, you can [filter issues with `good first issues` label](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest+label%3A%22good+first+issue%22).
If you decide to work on one of the issue, write a comment on the issue asking to be assigned to it.
6. Check current [issues](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest),
and if you're a beginner, you can [filter issues with `good first issues` label](https://github.com/jordanopensource/contributions-web/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest+label%3A%22good+first+issue%22).
If you decide to work on one of the issue, write a comment on the issue asking to be assigned to it.
_Do not work on issues that you're not assigned to in order to avoid duplicate work_.
7. Create a new branch from `development` branch for the task that you want to work on:
`git checkout -b <prefix>/branch-title`
7. Create a new branch from `development` branch for the task that you want to work on:
`git checkout -b <prefix>/branch-title`
- `<prefix>`: The prefix should be one of the following:
- `feat` for new features
- `fix` for bug fixes
- `task` for other general tasks
- `docs` for documentation
- `branch-title` should be short and concise and written in kebab-case (separate each word with '-')
- `branch-title` should be short and concise and written in kebab-case (separate each word with '-')
**Example**:
```sh
git checkout development && git pull # pull the latest changes from development branch

git checkout -b fix/type # create new branch
```

8. Write descriptive and concise commit messages
8. Write descriptive and concise commit messages
Follow these guidelines when writing commit messages:
- Limit the first line of the commit message to 72 characters or less.
- Use the imperative mood and present tense in the subject line, e.g. "Fix typo in the homepage" instead of "Fixed typo...".
Expand All @@ -48,7 +48,7 @@ _Do not work on issues that you're not assigned to in order to avoid duplicate w

#### Using Docker
Make sure that [docker](https://docs.docker.com/engine/install/) is installed on your system
and then run the project locally using [docker compose](https://github.com/jordanopensource/contributions-web/blob/development/docker-compose.yaml) with this command:
and then run the project locally using [docker compose](https://github.com/jordanopensource/contributions-web/blob/development/docker-compose.yaml) with this command:
`docker compose up`.

#### Using Node:
Expand Down
34 changes: 19 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CONTRIBUTIONS_API_URL=https://contributions.api.dev.josa.ngo HOST=0.0.0.0 PORT=3000 USER=node MATOMO_SITE_ID=11 TARGET_ENV DRONE_COMMIT_SHA=${DRONE_COMMIT_SHA} DRONE_BUILD_NUMBER=${DRONE_BUILD_NUMBER} DRONE_BUILD_LINK=${DRONE_BUILD_LINK} DRONE_COMMIT_LINK=${DRONE_COMMIT_LINK} DRONE_REPO_LINK=${DRONE_REPO_LINK} DRONE_BUILD_FINISHED=${DRONE_BUILD_FINISHED} DEBUG='false'
ARG CONTRIBUTIONS_API_URL=https://contributions.api.dev.josa.ngo HOST=0.0.0.0 PORT=3000 USER=node MATOMO_SITE_ID=11 TARGET_ENV CI_REPO CI_REPO_NAME CI_REPO_URL CI_COMMIT_SHA CI_COMMIT_REF CI_PIPELINE_URL CI_PIPELINE_CREATED CI_PREV_PIPELINE_URL CI_PIPELINE_NUMBER DEBUG='false'

###########
# BUILDER #
Expand All @@ -10,12 +10,14 @@ ARG HOST
ARG PORT
ARG MATOMO_SITE_ID
ARG TARGET_ENV
ARG DRONE_COMMIT_SHA
ARG DRONE_BUILD_NUMBER
ARG DRONE_BUILD_LINK
ARG DRONE_COMMIT_LINK
ARG DRONE_REPO_LINK
ARG DRONE_BUILD_FINISHED
ARG CI_REPO
ARG CI_REPO_NAME
ARG CI_REPO_URL
ARG CI_COMMIT_SHA
ARG CI_COMMIT_REF
ARG CI_PIPELINE_URL
ARG CI_PIPELINE_CREATED
ARG CI_PIPELINE_NUMBER
ARG DEBUG

# copy build context and install dependencies
Expand All @@ -24,7 +26,7 @@ COPY . .
RUN npm install

# Inject the enviromental variables
ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} DRONE_COMMIT_SHA=$DRONE_COMMIT_SHA DRONE_BUILD_NUMBER=${DRONE_BUILD_NUMBER} DRONE_BUILD_LINK=${DRONE_BUILD_LINK} DRONE_COMMIT_LINK=${DRONE_COMMIT_LINK} DRONE_REPO_LINK=${DRONE_REPO_LINK} DRONE_BUILD_FINISHED=${DRONE_BUILD_FINISHED} DEBUG=${DEBUG}
ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} NUXT_PUBLIC_CI_BUILD_NUMBER=${CI_PIPELINE_NUMBER} NUXT_PUBLIC_CI_BUILD_LINK=${CI_PIPELINE_URL} NUXT_PUBLIC_BUILD_REPO_LINK=${CI_REPO_URL} NUXT_PUBLIC_CI_COMMIT_SHA=${CI_COMMIT_SHA} NUXT_PUBLIC_CI_COMMIT_LINK=${CI_COMMIT_REF} NUXT_PUBLIC_BUILD_TIMESTAMP=${CI_PIPELINE_CREATED} DEBUG=${DEBUG}

# build NuxtJS project
RUN npm run build:modern
Expand All @@ -40,12 +42,14 @@ ARG PORT
ARG USER
ARG MATOMO_SITE_ID
ARG TARGET_ENV
ARG DRONE_COMMIT_SHA
ARG DRONE_BUILD_NUMBER
ARG DRONE_BUILD_LINK
ARG DRONE_COMMIT_LINK
ARG DRONE_REPO_LINK
ARG DRONE_BUILD_FINISHED
ARG CI_REPO
ARG CI_REPO_NAME
ARG CI_REPO_URL
ARG CI_COMMIT_SHA
ARG CI_COMMIT_REF
ARG CI_PIPELINE_URL
ARG CI_PIPELINE_CREATED
ARG CI_PIPELINE_NUMBER
ARG DEBUG

# copy builder output to project workdir
Expand All @@ -56,7 +60,7 @@ COPY --from=builder --chown=${USER}:${USER} /workspace/node_modules /app/node_mo
COPY --from=builder --chown=${USER}:${USER} /workspace/package.json /app/

# Inject the enviromental variables
ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} DRONE_COMMIT_SHA=$DRONE_COMMIT_SHA DRONE_BUILD_NUMBER=${DRONE_BUILD_NUMBER} DRONE_BUILD_LINK=${DRONE_BUILD_LINK} DRONE_COMMIT_LINK=${DRONE_COMMIT_LINK} DRONE_REPO_LINK=${DRONE_REPO_LINK} DRONE_BUILD_FINISHED=${DRONE_BUILD_FINISHED} DEBUG=${DEBUG}
ENV CONTRIBUTIONS_API_URL=$CONTRIBUTIONS_API_URL HOST=$HOST PORT=$PORT MATOMO_SITE_ID=$MATOMO_SITE_ID TARGET_ENV=${TARGET_ENV} NUXT_PUBLIC_CI_BUILD_NUMBER=${CI_PIPELINE_NUMBER} NUXT_PUBLIC_CI_BUILD_LINK=${CI_PIPELINE_URL} NUXT_PUBLIC_BUILD_REPO_LINK=${CI_REPO_URL} NUXT_PUBLIC_CI_COMMIT_SHA=${CI_COMMIT_SHA} NUXT_PUBLIC_CI_COMMIT_LINK=${CI_COMMIT_REF} NUXT_PUBLIC_BUILD_TIMESTAMP=${CI_PIPELINE_CREATED} DEBUG=${DEBUG}

# set user context
USER ${USER}
Expand Down
2 changes: 1 addition & 1 deletion assets/images/hero/jordan-commits.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/navbar/bars-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/navbar/x-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ services:
networks:
contributions-network:
driver: bridge