Skip to content

Commit

Permalink
Merge pull request #55 from Uniswap/ci-fix
Browse files Browse the repository at this point in the history
Ci fix
  • Loading branch information
gretzke authored Feb 7, 2025
2 parents 84c704d + a084cb4 commit b1a1e92
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 120 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/push-briefcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- "!src/briefcase/deployers/**"

jobs:
update-briefcase:
push-briefcase:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -23,11 +23,6 @@ jobs:
with:
fetch-depth: 0

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

- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/update-briefcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
permissions:
contents: write
steps:
- name: Python version
run: |
python3 --version
- name: Checkout Repository
uses: actions/checkout@v4
with:
Expand All @@ -31,6 +35,8 @@ jobs:
- name: Compile Briefcase
run: |
forge --version
forge install
./script/util/create_briefcase.sh
- name: Setup SSH
Expand Down
22 changes: 4 additions & 18 deletions script/util/create_briefcase.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/bin/bash -e

dir=${1:-src/briefcase/protocols}
rm -rf $dir
target_dir=${1:-src/briefcase/protocols}
rm -rf $target_dir
tmp_dir="$(mktemp -q -d -t "$(basename "$0").XXXXXX")"

replace_pragma_solidity() {
local file=$1
local version=$2
local temp_file=$(mktemp)
awk -v version="$version" '/pragma solidity/{if($3 != ">=0.5.0;") {print "pragma solidity " version ";"; next}}1' "$file" > "$temp_file"
mv "$temp_file" "$file"
}

compile_and_flatten() {
local source_path=$1
local project=$2
Expand All @@ -32,10 +24,6 @@ compile_and_flatten() {

echo "Flattening $sol_file"
$flatten_command "$sol_file" -o "$output_file"

if [[ "$input_dir" == *"interface"* || "$input_dir" == *"types"* ]]; then
replace_pragma_solidity "$output_file" ">=0.6.2"
fi
done

echo ""
Expand All @@ -58,11 +46,9 @@ done
echo "Inserting current initcode into deployers"
python3 script/util/insert_initcode.py "src/briefcase/deployers" "out"

echo "Processing source files for briefcase"
python3 script/util/process_briefcase_files.py "$tmp_dir" "$(pwd)"
echo "Processing source files and writing to briefcase"
python3 script/util/process_briefcase_files.py "$tmp_dir" "$(pwd)" "$target_dir"

echo "Copying files from temporary directory to briefcase"
cp -r "$tmp_dir/" "$dir/"
rm -rf "$tmp_dir"
forge fmt "src/briefcase"
# build the generated files
Expand Down
Loading

0 comments on commit b1a1e92

Please sign in to comment.