Skip to content

Commit

Permalink
chore: forge init
Browse files Browse the repository at this point in the history
  • Loading branch information
roderik committed Mar 6, 2024
0 parents commit 5081255
Show file tree
Hide file tree
Showing 19 changed files with 687 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Add your Etherscan (or altrnative network variant) to verify your smart contract on Etherscam
ETHERSCAN_API_KEY=

## Override the default --from address when deploying on BTP
# ETH_FROM=0x0000000000000000000000000000000000000000
15 changes: 15 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: v1

labels:
- label: 'feat'
matcher:
title: '^feat:.*'
- label: 'fix'
matcher:
title: '^fix:.*'
- label: 'chore'
matcher:
title: '^chore:.*'
- label: 'docs'
matcher:
title: '^docs:.*'
23 changes: 23 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
changelog:
exclude:
authors:
- renovate
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: Exciting New Features 🎉
labels:
- feat
- title: Important Bug Fixes 🐛
labels:
- fix
- title: Documentation 📚
labels:
- docs
- title: Other changes 🏗️
labels:
- chore
- title: Dependencies 📦
labels:
- dependencies
27 changes: 27 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":automergeMinor",
":automergePr",
":automergeRequireAllStatusChecks",
":gitSignOff",
":pinVersions",
":semanticCommits",
":semanticCommitTypeAll(chore)",
":enableVulnerabilityAlerts",
":combinePatchMinorReleases",
":prConcurrentLimitNone",
":prHourlyLimitNone",
"security:openssf-scorecard",
"schedule:nonOfficeHours"
],
"labels": ["dependencies"],
"rebaseWhen": "conflicted",
"packageRules": [],
"hostRules": [
{
"timeout": 3000000
}
]
}
109 changes: 109 additions & 0 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Branch

on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- "v*"

env:
FOUNDRY_PROFILE: ci

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write
issues: write
discussions: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: namespace-profile-foundry
steps:
- name: Checkout
uses: namespacelabs/nscloud-checkout-action@v2
with:
submodules: recursive

- name: Setup caches
uses: namespacelabs/nscloud-cache-action@v1
with:
path: |
cache
out
~/.foundry
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/settlemint/solidity-empty
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
no-cache: true
28 changes: 28 additions & 0 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Labels

on:
pull_request:
types: [opened, closed]
branches:
- main

permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write
issues: write
discussions: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write

jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: fuxingloh/multi-labeler@v4
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env

# Subgraphs
deployment.txt
deployment-anvil.txt
subgraph/subgraph.config.json
subgraph/node_modules
subgraph/generated
subgraph/build

.pnpm
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
11 changes: 11 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recommendations": [
"nomicfoundation.hardhat-solidity",
"miguelsolorio.fluent-icons",
"vscode-icons-team.vscode-icons",
"genieai.chatgpt-vscode",
"esbenp.prettier-vscode",
"dracula-theme.theme-dracula",
"cnshenj.vscode-task-manager"
]
}
114 changes: 114 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "make build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "test",
"type": "shell",
"command": "make test",
"group": "test",
"problemMatcher": []
},
{
"label": "format",
"type": "shell",
"command": "make format",
"problemMatcher": []
},
{
"label": "snapshot",
"type": "shell",
"command": "make snapshot",
"problemMatcher": []
},
{
"label": "anvil",
"type": "shell",
"command": "make anvil",
"problemMatcher": []
},
{
"label": "deploy-anvil",
"type": "shell",
"command": "make deploy-anvil",
"problemMatcher": []
},
{
"label": "deploy",
"type": "shell",
"command": "EXTRA_ARGS=\"${input:extra-deployment-verify} ${input:extra-deployment-other}\" make deploy",
"problemMatcher": []
},
{
"label": "script-anvil",
"type": "shell",
"command": "EXTRA_ARGS=\"${input:extra-script-broadcast} ${input:extra-script-other}\" make script-anvil",
"problemMatcher": []
},
{
"label": "script",
"type": "shell",
"command": "EXTRA_ARGS=\"${input:extra-script-broadcast} ${input:extra-script-other}\" make script",
"problemMatcher": []
},
{
"label": "cast",
"type": "shell",
"command": "make cast",
"problemMatcher": []
},
{
"label": "subgraph",
"type": "shell",
"command": "make subgraph",
"problemMatcher": []
},
{
"label": "help",
"type": "shell",
"command": "make help",
"problemMatcher": []
}
],
"inputs": [
{
"id": "extra-deployment-verify",
"description": "Extra deployment options?",
"default": "",
"type": "pickString",
"options": [
"",
"--verify --verifier sourcify",
"--verify --verifier etherscan --etherscan-api-key ${ETHERSCAN_API_KEY}"
]
},
{
"id": "extra-deployment-other",
"description": "Other extra deployment options?",
"default": "",
"type": "promptString"
},
{
"id": "extra-script-broadcast",
"description": "Broadcast?",
"default": "",
"type": "pickString",
"options": ["", "--broadcast"]
},
{
"id": "extra-script-other",
"description": "Other extra script options?",
"default": "",
"type": "promptString"
}
]
}
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:21.6.2-bookworm as build

ENV FOUNDRY_DIR /usr/local
RUN curl -L https://foundry.paradigm.xyz | bash && \
/usr/local/bin/foundryup

WORKDIR /

RUN git config --global user.email "hello@settlemint.com" && \
git config --global user.name "SettleMint" && \
forge init usecase --template settlemint/solidity-empty && \
cd usecase && \
forge build

USER root

FROM busybox

COPY --from=build /usecase /usecase
COPY --from=build /root/.svm /usecase-svm
Loading

0 comments on commit 5081255

Please sign in to comment.