Skip to content

Commit c412af7

Browse files
Setup project
1 parent f145049 commit c412af7

37 files changed

+932
-0
lines changed

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.cache
2+
.dockerignore
3+
.gitignore
4+
.git
5+
.github
6+
.env
7+
.pylintrc
8+
__pycache__
9+
*.pyc
10+
*.egg-info
11+
.idea/
12+
.vscode

.env.docker

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REDIS_URL=redis://redis:6379/0
2+
DATABASE_URL=psql://postgres:postgres@db:5432/postgres

.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REDIS_URL=redis://localhost:6379/0
2+
DATABASE_URL=psql://postgres:postgres@localhost:5432/postgres

.env.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REDIS_URL=redis://localhost:6379/0
2+
DATABASE_URL=psql://postgres:postgres@localhost:5432/postgres

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These owners will be the default owners for everything in
2+
# the repo. Unless a later match takes precedence.
3+
* @safe-global/core-api

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
1. Do POST on '...'
15+
- Provide `json` you are submitting to the service (if it applies)
16+
2. Then GET on '....'
17+
3. Links to issues in other repos (if possible)
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Environment (please complete the following information):**
23+
- Staging or production?
24+
- Which chain?
25+
- OS: [e.g. iOS]
26+
- Browser [e.g. chrome, safari]
27+
- Version [e.g. 22]
28+
29+
**Additional context**
30+
Add any other context about the problem here.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
7+
---
8+
9+
# What is needed?
10+
A clear and concise description of what you want to happen.
11+
12+
# Background
13+
More information about the feature needed
14+
15+
# Related issues
16+
Paste here the related links for the issues on the clients/safe project if applicable. Please provide at least one of the following:
17+
- Links to epics in your repository
18+
- Images taken from mocks
19+
- Gitbook or any form of written documentation links, etc. Any of these alternatives will help us contextualise your request.
20+
21+
# Endpoint
22+
If applicable, description on the endpoint and the result you expect:
23+
24+
## URL
25+
`GET /api/v1/...`
26+
27+
## Response
28+
```
29+
{
30+
...
31+
}
32+
```

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### Make sure these boxes are checked! 📦✅
2+
3+
- [ ] You ran `./run_tests.sh`
4+
- [ ] You ran `pre-commit run -a`
5+
6+
### What was wrong? 👾
7+
8+
Closes #
9+
10+
### How was it fixed? 🎯

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
reviewers:
9+
- "safe-global/core-api"
10+
11+
- package-ecosystem: docker
12+
directory: "/docker/web"
13+
schedule:
14+
interval: weekly
15+
day: monday
16+
reviewers:
17+
- "safe-global/core-api"
18+
19+
- package-ecosystem: github-actions
20+
directory: "/"
21+
schedule:
22+
interval: weekly
23+
day: monday
24+
reviewers:
25+
- "safe-global/core-api"

.github/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
changelog:
2+
categories:
3+
- title: 🏕 Features
4+
labels:
5+
- '*'
6+
exclude:
7+
labels:
8+
- dependencies
9+
- breaking_change
10+
- title: 🛠 Breaking Changes
11+
labels:
12+
- breaking_change
13+
- title: 👒 Dependencies
14+
labels:
15+
- dependencies

.github/workflows/ci.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Python CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- develop
7+
pull_request:
8+
release:
9+
types: [ released ]
10+
11+
jobs:
12+
linting:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.12"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: pip install -U pre-commit -r requirements/dev.txt
26+
- name: Run pre-commit
27+
run: pre-commit run --all-files
28+
29+
test-app:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
matrix:
33+
python-version: ["3.12"]
34+
services:
35+
redis:
36+
image: redis
37+
options: >-
38+
--health-cmd "redis-cli ping"
39+
--health-interval 10s
40+
--health-timeout 5s
41+
--health-retries 5
42+
ports:
43+
- 6379:6379
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
cache: 'pip'
51+
cache-dependency-path: 'requirements/*.txt'
52+
- name: Install dependencies
53+
run: |
54+
pip install wheel
55+
pip install -r requirements/dev.txt coveralls
56+
env:
57+
PIP_USE_MIRRORS: true
58+
- name: Run mypy
59+
run: mypy .
60+
- name: Run tests and coverage
61+
run: |
62+
coverage run --source=$SOURCE_FOLDER -m pytest -rxXs
63+
env:
64+
SOURCE_FOLDER: app
65+
- name: Send results to coveralls
66+
continue-on-error: true # Ignore coveralls problems
67+
run: coveralls --service=github
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required for coveralls
70+
71+
docker-deploy:
72+
runs-on: ubuntu-latest
73+
needs:
74+
- linting
75+
- test-app
76+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || (github.event_name == 'release' && github.event.action == 'released')
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: docker/setup-qemu-action@v3
80+
with:
81+
platforms: arm64
82+
- uses: docker/setup-buildx-action@v3
83+
- name: Dockerhub login
84+
uses: docker/login-action@v3
85+
with:
86+
username: ${{ secrets.DOCKER_USER }}
87+
password: ${{ secrets.DOCKER_PASSWORD }}
88+
- name: Deploy Master
89+
if: github.ref == 'refs/heads/main'
90+
uses: docker/build-push-action@v6
91+
with:
92+
context: .
93+
file: docker/web/Dockerfile
94+
push: true
95+
tags: safeglobal/safe-decoder-service:staging
96+
platforms: |
97+
linux/amd64
98+
linux/arm64
99+
cache-from: type=gha
100+
cache-to: type=gha,mode=max
101+
- name: Deploy Develop
102+
if: github.ref == 'refs/heads/develop'
103+
uses: docker/build-push-action@v6
104+
with:
105+
context: .
106+
file: docker/web/Dockerfile
107+
push: true
108+
tags: safeglobal/safe-decoder-service:develop
109+
platforms: |
110+
linux/amd64
111+
linux/arm64
112+
cache-from: type=gha
113+
cache-to: type=gha,mode=max
114+
- name: Deploy Tag
115+
if: (github.event_name == 'release' && github.event.action == 'released')
116+
uses: docker/build-push-action@v6
117+
with:
118+
context: .
119+
file: docker/web/Dockerfile
120+
push: true
121+
tags: |
122+
safeglobal/safe-decoder-service:${{ github.event.release.tag_name }}
123+
safeglobal/safe-decoder-service:latest
124+
platforms: |
125+
linux/amd64
126+
linux/arm64
127+
cache-from: type=gha
128+
cache-to: type=gha,mode=max
129+
130+
autodeploy:
131+
runs-on: ubuntu-latest
132+
needs: [docker-deploy]
133+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
134+
steps:
135+
- uses: actions/checkout@v4
136+
- name: Deploy Staging
137+
if: github.ref == 'refs/heads/main'
138+
run: bash scripts/autodeploy.sh
139+
env:
140+
AUTODEPLOY_URL: ${{ secrets.AUTODEPLOY_URL }}
141+
AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }}
142+
TARGET_ENV: "staging"
143+
- name: Deploy Develop
144+
if: github.ref == 'refs/heads/develop'
145+
run: bash scripts/autodeploy.sh
146+
env:
147+
AUTODEPLOY_URL: ${{ secrets.AUTODEPLOY_URL }}
148+
AUTODEPLOY_TOKEN: ${{ secrets.AUTODEPLOY_TOKEN }}
149+
TARGET_ENV: "develop"

.github/workflows/cla.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "CLA Assistant"
2+
on:
3+
issue_comment:
4+
types: [ created ]
5+
pull_request_target:
6+
types: [ opened,closed,synchronize ]
7+
8+
jobs:
9+
CLAssistant:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: "CLA Assistant"
13+
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'
14+
# Beta Release
15+
uses: cla-assistant/[email protected]
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
# the below token should have repo scope and must be manually added by you in the repository's secret
19+
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ACCESS_TOKEN }}
20+
with:
21+
path-to-signatures: 'signatures/version1/cla.json'
22+
path-to-document: 'https://safe.global/cla'
23+
# branch should not be protected
24+
branch: 'main'
25+
allowlist: hectorgomezv,moisses89,luarx,rmeissner,Uxio0,falvaradorodriguez,*bot # may need to update this expression if we add new bots
26+
27+
# the followings are the optional inputs - If the optional inputs are not given, then default values will be taken
28+
# enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
29+
remote-organization-name: 'safe-global'
30+
# enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
31+
remote-repository-name: 'cla-signatures'
32+
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
33+
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
34+
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
35+
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
36+
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
37+
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
38+
#use-dco-flag: true - If you are using DCO instead of CLA

0 commit comments

Comments
 (0)