-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
351dab4
commit 817617e
Showing
12 changed files
with
471 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
### Description | ||
PR to merge from [{{ .fromBranch }}](/axieinfinity/foundry-contract-template/tree/{{ .fromBranch }}) to [{{ .toBranch }}](/axieinfinity/foundry-contract-template/tree/{{ .toBranch }}). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Create PR Deploy to Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- deploy/* | ||
pull_request: | ||
types: | ||
- opened | ||
branches: | ||
- 'deploy/**' | ||
|
||
env: | ||
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }} | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Env | ||
run: | | ||
echo "PR_BRANCH=merge/${HEAD_BRANCH}" >> $GITHUB_ENV | ||
echo "VERSION=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\///' | cut -d'-' -f1)" >> $GITHUB_ENV | ||
echo "NETWORK=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\/v[0-9\.]*-\(.*\)/\1/')" >> $GITHUB_ENV | ||
- name: Checkout code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: 'release/${{ env.VERSION }}' | ||
fetch-depth: 0 | ||
fetch-tags: 'true' | ||
|
||
- name: Get Testnet Latest Tag | ||
if: ${{ env.NETWORK == 'testnet' }} | ||
run: | | ||
echo "LATESTTAG=$(git describe --tags --match "*testnet*" --abbrev=0)" >> $GITHUB_ENV | ||
- name: Get Mainnet Latest Tag | ||
if: ${{ env.NETWORK == 'mainnet' }} | ||
run: | | ||
echo "LATESTTAG=$(git describe --tags --match "*mainnet*" --abbrev=0)" >> $GITHUB_ENV | ||
- name: Reset promotion branch | ||
run: | | ||
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH} | ||
git reset --hard ${HEAD_BRANCH} | ||
- name: Generate Release note | ||
id: template | ||
run: | | ||
echo "VERSION=${{ env.VERSION }} - SHA: ${{ github.sha }}" > CHANGELOG.md | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/[email protected] | ||
with: | ||
labels: automated PR | ||
delete-branch: true | ||
title: 'chore(`release/${{ env.VERSION }}`): merge from `${{ env.HEAD_BRANCH}}`' | ||
body: ${{ steps.template.outputs.result }} | ||
branch: ${{ env.PR_BRANCH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Create Pull Request From Implement To Feature | ||
on: | ||
push: | ||
branches: | ||
- 'implement-feature/**' | ||
- 'implement-feature/**/**' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }} | ||
|
||
jobs: | ||
createPullRequest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set env | ||
run: | | ||
echo "FEATURE_NAME=$(echo ${HEAD_BRANCH} | cut -d'/' -f2)" >> $GITHUB_ENV | ||
echo "FEATURE_BRANCH=feature/$(echo ${HEAD_BRANCH} | cut -d'/' -f2)" >> $GITHUB_ENV | ||
echo "IMPLEMENT_NAME=$(echo ${HEAD_BRANCH} | cut -d'/' -f3)" >> $GITHUB_ENV | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{env.FEATURE_BRANCH}} | ||
|
||
- name: Reset promotion branch | ||
run: | | ||
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH} | ||
git reset --hard ${HEAD_BRANCH} | ||
- name: Render template | ||
id: template | ||
uses: chuhlomin/[email protected] | ||
with: | ||
template: .github/template/create-pull-request.md | ||
vars: | | ||
fromBranch: ${{env.HEAD_BRANCH}} | ||
toBranch: ${{ env.FEATURE_BRANCH }} | ||
- name: Create Pull Request | ||
uses: peter-evans/[email protected] | ||
with: | ||
branch: ${{ env.HEAD_BRANCH }} | ||
base: ${{env.FEATURE_BRANCH}} | ||
labels: automated PR | ||
title: 'feat(${{env.FEATURE_NAME}}): implement `${{env.IMPLEMENT_NAME}}`' | ||
body: ${{ steps.template.outputs.result }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Create Pull Request From Release to Feature | ||
on: | ||
push: | ||
branches: | ||
- 'release/*' | ||
- 'release*/*' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }} | ||
|
||
jobs: | ||
fetchAllFeatureBranches: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- id: step1 | ||
name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- id: step2 | ||
name: List all the remote feature branches | ||
run: | | ||
branches=$(git branch -r | grep -E '.*origin\/feature\/.*' | sed -e "s/.*origin\///" | tr "\n" " ") | ||
JSON="[" | ||
for branch in ${branches[@]}; do | ||
echo $branch | ||
JSONline="\"$branch\"," | ||
# we don't need to iterate on the same branch over and over, so | ||
# onnly include it when it wasn't included | ||
if [[ "$JSON" != *"$JSONline"* ]]; then | ||
JSON="$JSON$JSONline" | ||
fi | ||
done | ||
# Remove last "," and add the closing bracket | ||
if [[ $JSON == *, ]]; then | ||
JSON="${JSON%?}" | ||
fi | ||
JSON="$JSON]" | ||
echo $JSON | ||
echo "BRANCHES={\"branch_name\": $( echo "$JSON" )}" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
BRANCHES: ${{ steps.step2.outputs.BRANCHES }} | ||
|
||
mergeRelease2FeatureRepo: | ||
runs-on: ubuntu-latest | ||
needs: fetchAllFeatureBranches | ||
strategy: | ||
matrix: ${{ fromJSON(needs.fetchAllFeatureBranches.outputs.BRANCHES) }} | ||
steps: | ||
- name: Set env | ||
run: | | ||
echo "PR_BRANCH=merge/${HEAD_BRANCH}-${{matrix.branch_name}}" >> $GITHUB_ENV | ||
echo "FEATURE_NAME=$(echo ${{matrix.branch_name}} | cut -d'/' -f2)" >> $GITHUB_ENV | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{matrix.branch_name}} | ||
- name: Reset promotion branch | ||
run: | | ||
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH} | ||
git reset --hard ${HEAD_BRANCH} | ||
- name: Render template | ||
id: template | ||
uses: chuhlomin/[email protected] | ||
with: | ||
template: .github/template/create-pull-request.md | ||
vars: | | ||
fromBranch: ${{env.HEAD_BRANCH}} | ||
toBranch: ${{matrix.branch_name}} | ||
- name: Create Pull Request | ||
uses: peter-evans/[email protected] | ||
with: | ||
labels: automated PR | ||
delete-branch: true | ||
title: 'chore(`${{env.FEATURE_NAME}}`): merge from `${{env.HEAD_BRANCH}}`' | ||
body: ${{ steps.template.outputs.result }} | ||
branch: ${{env.PR_BRANCH}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Create PR from release to network | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- release/* | ||
types: | ||
- closed | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
env: | ||
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }} | ||
RELEASE_BRANCH: ${{ github.event.pull_request.base.ref}} | ||
|
||
jobs: | ||
merge-release-to-network: | ||
runs-on: ubuntu-latest | ||
if: ${{ (github.event.pull_request.merged == true) && (contains(github.head_ref, 'deploy') || contains(github.ref_name, 'deploy')) }} | ||
steps: | ||
- name: Set Env | ||
run: | | ||
echo "PR_BRANCH=merge/${HEAD_BRANCH}" >> $GITHUB_ENV | ||
echo "VERSION=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\///' | cut -d'-' -f1)" >> $GITHUB_ENV | ||
echo "NETWORK=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\/v[0-9\.]*-\(.*\)/\1/')" >> $GITHUB_ENV | ||
- name: Checkout code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ env.NETWORK }} | ||
|
||
- name: Reset promotion branch | ||
run: | | ||
git fetch origin ${RELEASE_BRANCH}:${RELEASE_BRANCH} | ||
git reset --hard ${RELEASE_BRANCH} | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/[email protected] | ||
with: | ||
labels: automated PR | ||
delete-branch: true | ||
title: 'chore(`${{ env.NETWORK }}`): merge from `${{ env.HEAD_BRANCH}}`' | ||
body: ${{ steps.template.outputs.result }} | ||
branch: ${{env.PR_BRANCH}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Create Release Tag | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- mainnet | ||
- testnet | ||
|
||
env: | ||
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }} | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
create-release-tag: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true | ||
steps: | ||
- name: Set Env | ||
run: | | ||
echo "VERSION=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\///' | cut -d'-' -f1)" >> $GITHUB_ENV | ||
echo "NETWORK=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\/v[0-9\.]*-\(.*\)/\1/')" >> $GITHUB_ENV | ||
- name: Checkout code | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ env.NETWORK }} | ||
fetch-depth: 0 | ||
fetch-tags: 'true' | ||
|
||
- name: Set Mainnet Tag | ||
if: ${{ env.NETWORK == 'mainnet' }} | ||
run: | | ||
echo "TAG=${{ env.VERSION }}" >> $GITHUB_ENV | ||
- name: Set Testnet Tag | ||
if: ${{ env.NETWORK == 'testnet' }} | ||
run: | | ||
echo "TAG=${{ env.VERSION }}-testnet" >> $GITHUB_ENV | ||
- name: Get Testnet Latest Tag | ||
if: ${{ env.NETWORK == 'testnet' }} | ||
run: | | ||
echo "LATESTTAG=$(git describe --tags --match "*testnet*" --abbrev=0)" >> $GITHUB_ENV | ||
- name: Get Mainnet Latest Tag | ||
if: ${{ env.NETWORK == 'mainnet' }} | ||
run: | | ||
echo "LATESTTAG=$(git describe --tags --match "*mainnet*" --abbrev=0)" >> $GITHUB_ENV | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ env.TAG }} | ||
run: | | ||
gh release create "$tag" \ | ||
--repo "$GITHUB_REPOSITORY" \ | ||
--title "${{ env.NETWORK }} release ${{ env.VERSION }}" \ | ||
--target "${{ env.NETWORK }}" \ | ||
--notes-start-tag "${{ env.LATESTTAG }}" \ | ||
--generate-notes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- mainnet | ||
- testnet | ||
- 'feature/*' | ||
- 'features/*' | ||
pull_request: | ||
branches: | ||
- mainnet | ||
- testnet | ||
- 'feature/*' | ||
- 'features/*' | ||
|
||
env: | ||
FOUNDRY_PROFILE: ci | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
fail-fast: true | ||
|
||
name: Foundry project | ||
runs-on: [self-hosted, dockerize] | ||
steps: | ||
- id: 'gh-app' | ||
name: 'Get Token' | ||
uses: 'tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a' #v1.7.0 | ||
with: | ||
app_id: ${{ secrets.GH_APP_ID }} | ||
private_key: ${{ secrets.GH_PRIVATE_KEY }} | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
submodules: recursive | ||
token: ${{ steps.gh-app.outputs.token }} | ||
|
||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
rm -rf logs/storage/* | ||
dirOutputs=$(ls out | grep '^[^.]*\.sol$') # assuming the out dir is at 'out' | ||
while IFS= read -r contractDir; do | ||
innerdirOutputs=$(ls out/"$contractDir") | ||
|
||
while IFS= read -r jsonFile; do | ||
fileIn=out/"$contractDir"/$jsonFile | ||
fileOut=logs/storage/"$contractDir":${jsonFile%.json}.log | ||
node .husky/storage-logger.js "$fileIn" "$fileOut" & | ||
done <<< "$innerdirOutputs" | ||
done <<< "$dirOutputs" | ||
|
||
# Wait for all background jobs to finish | ||
wait |
Oops, something went wrong.