Skip to content

Commit

Permalink
Setup service (#9)
Browse files Browse the repository at this point in the history
* Setup service

* Apply PR suggestions
  • Loading branch information
falvaradorodriguez authored Aug 16, 2024
1 parent 65760ba commit 3975571
Show file tree
Hide file tree
Showing 33 changed files with 837 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.cache
.dockerignore
.gitignore
.git
.github
.env
.pylintrc
__pycache__
*.pyc
*.egg-info
.idea/
.vscode
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SECRET_KEY=kamehameha
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence.
* @safe-global/core-api
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Do POST on '...'
- Provide `json` you are submitting to the service (if it applies)
2. Then GET on '....'
3. Links to issues in other repos (if possible)

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**
- Staging or production?
- Which chain?
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement

---

# What is needed?
A clear and concise description of what you want to happen.

# Background
More information about the feature needed

# Related issues
Paste here the related links for the issues on the clients/safe project if applicable. Please provide at least one of the following:
- Links to epics in your repository
- Images taken from mocks
- Gitbook or any form of written documentation links, etc. Any of these alternatives will help us contextualise your request.

# Endpoint
If applicable, description on the endpoint and the result you expect:

## URL
`GET /api/v1/...`

## Response
```
{
...
}
```
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Make sure these boxes are checked! 📦✅

- [ ] You ran `./run_tests.sh`
- [ ] You ran `pre-commit run -a`

### What was wrong? 👾

Closes #

### How was it fixed? 🎯
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: monday
reviewers:
- "safe-global/core-api"

- package-ecosystem: docker
directory: "/docker/web"
schedule:
interval: weekly
day: monday
reviewers:
- "safe-global/core-api"

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: monday
reviewers:
- "safe-global/core-api"
15 changes: 15 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
changelog:
categories:
- title: 🏕 Features
labels:
- '*'
exclude:
labels:
- dependencies
- breaking_change
- title: 🛠 Breaking Changes
labels:
- breaking_change
- title: 👒 Dependencies
labels:
- dependencies
139 changes: 139 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Python CI
on:
push:
branches:
- main
- develop
pull_request:
release:
types: [ released ]

jobs:
linting:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files

test-app:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- name: Install dependencies
run: |
pip install wheel
pip install -r requirements/dev.txt coveralls
env:
PIP_USE_MIRRORS: true
- name: Run mypy
run: mypy .
- name: Run tests and coverage
run: |
coverage run --source=$SOURCE_FOLDER -m pytest -rxXs
env:
SOURCE_FOLDER: app
- name: Send results to coveralls
continue-on-error: true # Ignore coveralls problems
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required for coveralls

docker-deploy:
runs-on: ubuntu-latest
needs:
- linting
- test-app
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || (github.event_name == 'release' && github.event.action == 'released')
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- name: Dockerhub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy Master
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: .
file: docker/web/Dockerfile
push: true
tags: safeglobal/safe-queue-service:staging
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy Develop
if: github.ref == 'refs/heads/develop'
uses: docker/build-push-action@v6
with:
context: .
file: docker/web/Dockerfile
push: true
tags: safeglobal/safe-queue-service:develop
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy Tag
if: (github.event_name == 'release' && github.event.action == 'released')
uses: docker/build-push-action@v6
with:
context: .
file: docker/web/Dockerfile
push: true
tags: |
safeglobal/safe-queue-service:${{ github.event.release.tag_name }}
safeglobal/safe-queue-service:latest
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

autodeploy:
runs-on: ubuntu-latest
needs: [docker-deploy]
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v4
- name: Deploy Staging
if: github.ref == 'refs/heads/main'
run: bash scripts/autodeploy.sh
env:
AUTODEPLOY_URL: ${{ secrets.AUTODEPLOY_URL }}
AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }}
TARGET_ENV: "staging"
- name: Deploy Develop
if: github.ref == 'refs/heads/develop'
run: bash scripts/autodeploy.sh
env:
AUTODEPLOY_URL: ${{ secrets.AUTODEPLOY_URL }}
AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }}
TARGET_ENV: "develop"
36 changes: 36 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "CLA Assistant"
on:
issue_comment:
types: [ created ]
pull_request_target:
types: [ opened,closed,synchronize ]

jobs:
CLAssistant:
runs-on: ubuntu-latest
steps:
- name: "CLA Assistant"
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
# Beta Release
uses: cla-assistant/github-action@v2.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
path-to-signatures: 'signatures/version1/cla.json'
path-to-document: 'https://safe.global/cla/'
# branch should not be protected
branch: 'cla-signatures'
allowlist: hectorgomezv,moisses89,luarx,rmeissner,Uxio0,falvaradorodriguez,*bot # may need to update this expression if we add new bots

#below are the optional inputs - If the optional inputs are not given, then default values will be taken
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
#use-dco-flag: true - If you are using DCO instead of CLA
Loading

0 comments on commit 3975571

Please sign in to comment.