Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arein authored Jan 22, 2023
0 parents commit 8bda76a
Show file tree
Hide file tree
Showing 47 changed files with 7,743 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PORT=3000
LOG_LEVEL=ERROR
DATABASE_URL=postgres://user:pass@host:port/database

# Telemetry
TELEMETRY_ENABLED=false
TELEMETRY_GRPC_URL=http://localhost:4317
75 changes: 75 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Bug Report
description: File a bug report
title: "bug: "
labels:
- bug
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! 🐛
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
examples:
- **OS**: MacOS Monterey 12.5
- **rustc**: rustc 1.62.1 (e092d0b6b 2022-07-16)
- **cargo**: cargo 1.62.1 (a748cf5a3 2022-06-08)
> **Note**
> If using docker image please provide docker version and the image's tag
value: |
- OS:
- rustc:
- cargo:
render: markdown
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Feature Request
description: Request a new feature be added
title: "feat: "
labels:
- enhancement
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to suggest a new feature for Rust HTTP Starter! ✨
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the feature you would like.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true
- type: textarea
attributes:
label: Requested Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Description

<!--
Please include:
* summary of the changes and the related issue
* relevant motivation and context
-->

Resolves # (issue)

## How Has This Been Tested?

<!--
Please:
* describe the tests that you ran to verify your changes.
* provide instructions so we can reproduce.
-->

<!-- If valid for smoke test on feature add screenshots -->

## Due Diligence

* [ ] Breaking change
* [ ] Requires a documentation update
* [ ] Requires a e2e/integration test update
98 changes: 98 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: cd
on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- "terraform/**"
release:
types: ["published"]

concurrency:
# Only allow for one action to run at once, queue any others
group: cd
# Don't cancel existing
cancel-in-progress: false

jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.clean_version.outputs.version }}
steps:
- id: latest_release
uses: pozetroninc/github-action-get-latest-release@master
if: github.event_name != 'release'
with:
repository: ${{ github.repository }}
excludes: draft

- id: get
uses: actions/github-script@v6
env:
LATEST_TAG: ${{ steps.latest_release.outputs.release }}
with:
result-encoding: string
script: |
if (context.eventName == "release") {
return context.payload.release.tag_name
} else {
return process.env.LATEST_TAG
}
- id: clean_version
run: |
version=$(echo "${{ steps.get.outputs.result }}" | sed 's/v//g')
echo "version=$version" >> $GITHUB_OUTPUT
deploy-infra-staging:
runs-on: ubuntu-latest
environment:
name: staging
url: https://http-starter.walletconnect.com/health
needs:
- get-version
steps:
- name: Checkout
uses: actions/checkout@v3

- id: deploy-staging
uses: WalletConnect/actions/actions/deploy-terraform/@master
env:
TF_VAR_image_version: ${{ needs.get-version.outputs.version }}
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
environment: staging
app-name: ${{ github.event.repository.name }}

validate-staging:
needs: [deploy-infra-staging]
uses: ./.github/workflows/validate.yml
with:
environment: 'staging'

deploy-infra-prod:
runs-on: ubuntu-latest
environment:
name: prod
url: https://http-starter.walletconnect.com/health
needs:
- get-version
- validate-staging
steps:
- name: Checkout
uses: actions/checkout@v3

- id: deploy-staging
uses: WalletConnect/actions/actions/deploy-terraform/@master
env:
TF_VAR_image_version: ${{ needs.get-version.outputs.version }}
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
environment: prod
app-name: ${{ github.event.repository.name }}
130 changes: 130 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: ci

on:
pull_request:
paths-ignore:
- "spec/**"
- "terraform/**"
- "*.md"
- "LICENSE"

push:
branches:
- "main"
paths:
- "spec/**"
- "terraform/**"
- "*.md"
- "LICENSE"

concurrency:
# Support push/pr as event types with different behaviors each:
# 1. push: queue up builds
# 2. pr: only allow one run per PR
group: ${{ github.workflow }}-${{ github.event.type }}${{ github.event.pull_request.number }}
# If there is already a workflow running for the same pull request, cancel it
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
tasks:
name: "[${{ matrix.os }}/rust-${{matrix.rust}}] ${{ matrix.cargo.name }}"
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
rust:
- stable
- nightly
cargo:
- name: "Clippy"
cmd: clippy
args: -- -D clippy::all
cache: {}
- name: "Formatting"
cmd: fmt
args: -- --check
cache: {}
- name: "Unit Tests"
cmd: test
args: --all-features
cache: { sharedKey: "tests" }
include:
- os: ubuntu-latest
sccache-path: /home/runner/.cache/sccache
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 1G
SCCACHE_DIR: ${{ matrix.sccache-path }}
steps:
# Checkout code
- name: "Git checkout"
uses: actions/checkout@v2

# Install sccache
- name: "Install sccache"
if: matrix.os == 'ubuntu-latest'
env:
SCCACHE_URL: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.2.15
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
curl -sSL "$SCCACHE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
install -vDm 755 "$SCCACHE_FILE/sccache" "$HOME/.local/bin/sccache"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
# Install Rust toolchain
- name: "Install Rust ${{ matrix.rust }}"
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt, clippy

# Rebuild cache
- name: Cache cargo registry
uses: Swatinem/rust-cache@3bb3a9a087029c7bc392586cdc88cb6f66b9c6ef
with: ${{ matrix.cargo.cache }}
continue-on-error: false

- name: Cache sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ${{ matrix.sccache-path }}
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sccache-
# Run job
- name: "Start sccache server"
run: |
sccache --stop-server || true
sccache --start-server
- name: "Task ${{ matrix.cargo.name }}"
uses: actions-rs/cargo@v1
with:
command: ${{ matrix.cargo.cmd }}
args: ${{ matrix.cargo.args }}

- name: "Print sccache stats"
run: sccache --show-stats

- name: "Stop sccache server"
run: sccache --stop-server || true
Loading

0 comments on commit 8bda76a

Please sign in to comment.