Skip to content

Commit

Permalink
init(main): first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FabrizioCafolla committed Jun 1, 2024
0 parents commit 04ab7ce
Show file tree
Hide file tree
Showing 437 changed files with 46,279 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .activate
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo "You must source this script: \$ source $0" >&2
exit 33
fi

if [[ -f .venv/bin/activate ]]; then
source .venv/bin/activate
else
echo "WARN No virtualenv found. Run 'make setup' to create one."
fi

if [[ -f .env ]]; then
source .env
fi
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: italia-open-source
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
62 changes: 62 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "🐛 Bug Report"
description: Create a new ticket for a bug.
title: "🐛 [BUG] - <title>"
labels: [
"bug"
]
body:
- type: textarea
id: description
attributes:
label: "Description"
description: Please enter an explicit description of your issue
placeholder: Short and explicit description of your incident...
validations:
required: true
- type: textarea
id: reprod
attributes:
label: "Reproduction steps"
description: Please enter an explicit description of your issue
value: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
render: bash
validations:
required: true
- type: textarea
id: logs
attributes:
label: "Logs"
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: bash
validations:
required: false
- type: dropdown
id: browsers
attributes:
label: "Browsers"
description: What browsers are you seeing the problem on ?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Opera
validations:
required: false
- type: dropdown
id: os
attributes:
label: "OS"
description: What is the impacted environment ?
multiple: true
options:
- Windows
- Linux
- Mac
validations:
required: false
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "💡 Feature Request"
description: Create a new ticket for a new feature request
title: "💡 [REQUEST] - <title>"
labels: [
"feature: request"
]
body:
- type: textarea
id: summary
attributes:
label: "Summary"
description: Provide a brief explanation of the feature
placeholder: Describe in a few lines your feature request
validations:
required: true
- type: textarea
id: implementation_pr
attributes:
label: "Implementation PR"
description: Pull request used
placeholder: "#Pull Request ID"
validations:
required: false
- type: textarea
id: reference_issues
attributes:
label: "Reference Issues"
description: Common issues
placeholder: "#Issues IDs"
validations:
required: false
- type: textarea
id: basic_example
attributes:
label: "Basic Example"
description: Indicate here some basic examples of your feature.
placeholder: A few specific words about your feature request.
validations:
required: false
- type: textarea
id: drawbacks
attributes:
label: "Drawbacks"
description: What are the drawbacks/impacts of your feature request ?
placeholder: Identify the drawbacks and impacts while being neutral on your feature request
validations:
required: false
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/QUESTION.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "❓ Question"
description: Create a new ticket for a question
title: "❓ [QUESTION] - <title>"
labels: [
"question"
]
body:
- type: textarea
id: summary
attributes:
label: "Summary"
description: Provide a brief explanation of the qustion
placeholder: Describe in a few lines your question
validations:
required: true
- type: textarea
id: reference_issues
attributes:
label: "Reference Issues"
description: Common issues
placeholder: "#Issues IDs"
validations:
required: false
- type: textarea
id: basic_example
attributes:
label: "Basic Example"
description: Indicate here some basic examples of your question.
placeholder: Describe specific case or example
validations:
required: false
31 changes: 31 additions & 0 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
labelPRBasedOnFilePath:
ci:
- .github/*
- .github/**/*
- scripts/*
- scripts/**/*

dependencies:
- website/package.json
- website/yarn.lock
- requirements.txt
- requirements-dev.txt

website:
- website/*
- website/**/*

infrastructure:
- infrastructure/*
- infrastructure/**/*

firstPRWelcomeComment: >
Thanks for opening this pull request! Please check out our contributing guidelines.
verifyTitles:
titleRegexp: ^(feat|feat!|fix|fix!|docs|refactor|refactor!|test|chore|build)\((ci|main|docs|deps|deps-dev|website|infrastructure)\):.*
alwaysUsePrTitle: true
validateEitherPrOrSingleCommitTitle: true
statusTitle: "Title Validator"
successMessage: "Validation successful!"
failureMessage: "Wrong ${type} title: ${title}"
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 3
labels:
- "dependencies"
- "dependencies-python"
reviewers:
- "FabrizioCafolla"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "dependencies-actions"
reviewers:
- "FabrizioCafolla"
- package-ecosystem: "terraform"
directory: "/infrastructure"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "dependencies-terraform"
reviewers:
- "FabrizioCafolla"
47 changes: 47 additions & 0 deletions .github/workflows/actions/terraform-init/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Terraform plan"
description: "Runs a composite step action"

inputs:
WORKSPACE:
description: "The workspace to deploy the infrastructure"
required: true
AWS_DEFAULT_REGION:
description: "The AWS region to deploy the infrastructure"
required: true
AWS_ACCOUNT_ID:
description: "The AWS account ID to deploy the infrastructure"
required: true
AWS_ROLE_NAME:
description: "OIDC Role name"
required: true
AWS_TERRAFORM_STATE_BUCKET:
description: "Terraform state bucket name"
required: false

runs:
using: "composite"
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ inputs.AWS_ACCOUNT_ID }}:role/${{ inputs.AWS_ROLE_NAME }}
aws-region: ${{ inputs.AWS_DEFAULT_REGION }}
role-session-name: github-actions

- name: Set Terraform 1.7
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.7"

- name: Terraform Plan
shell: bash
env:
WORKSPACE: ${{ inputs.WORKSPACE }}
AWS_DEFAULT_REGION: ${{ inputs.AWS_DEFAULT_REGION }}
AWS_ACCOUNT_ID: ${{ inputs.AWS_ACCOUNT_ID }}
AWS_TERRAFORM_STATE_BUCKET: ${{ inputs.AWS_TERRAFORM_STATE_BUCKET }}
run: |
make setup-infrastructure
95 changes: 95 additions & 0 deletions .github/workflows/build-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build Website

on:
repository_dispatch:
types:
- build-website
- build-website-command
workflow_dispatch:

# Permissions for terramform-init action
permissions:
id-token: write
contents: read

env:
WORKSPACE: "production"

jobs:
build-website:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Load ENV
run: |
if [ "${{ github.event.client_payload.slash_command.args.named.pr_sha }}" == "" ]; then
echo "COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
else
echo "COMMIT_SHA=${{ github.event.client_payload.slash_command.args.named.pr_sha }}" >> $GITHUB_ENV
fi
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ env.COMMIT_SHA }}
fetch-depth: 0

- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: "website/.nvmrc"
cache-dependency-path: website/yarn.lock
cache: "yarn"

- name: Terraform Init
id: terraform
uses: ./.github/workflows/actions/terraform-init
timeout-minutes: 5
with:
WORKSPACE: ${{ env.WORKSPACE }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }}
AWS_TERRAFORM_STATE_BUCKET: ${{ secrets.AWS_TERRAFORM_STATE_BUCKET }}

- name: Build
timeout-minutes: 5
run: |
make setup-website VIRTUAL_ENV=false
make download
make build
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.ACTION_WORKFLOWS }}
title: "fix(website): update awesome data"
body: "Update awesome data from: ${{ github.event_name }}"
commit-message: "Update awesome data from: ${{ github.event_name }}"
author: "FabrizioCafolla <${{ secrets.ACTION_EMAIL }}>"
add-paths: |
website/src/*
website/database/*
- name: Update comment
if: ${{ success() && github.event.client_payload.slash_command.args.named.comment_id }}
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.ACTION_WORKFLOWS }}
comment-id: ${{ github.event.client_payload.slash_command.args.named.comment_id }}
reactions: hooray

- name: Failure
if: ${{ failure() && github.event.client_payload.slash_command.args.named.comment_id }}
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.ACTION_WORKFLOWS }}
comment-id: ${{ github.event.client_payload.slash_command.args.named.comment_id }}
body: |
:warning: Deployment failed. See #[${{ github.run_number }}](https://github.com/italia-opensource/italiaopensource.com/actions/runs/${{ github.run_id }}) for more details.
Loading

0 comments on commit 04ab7ce

Please sign in to comment.