-
Notifications
You must be signed in to change notification settings - Fork 18
Release workflow #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Release workflow #201
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
3c03c72
llvm+resolc
AndWeHaveAPlan 7cbda6f
make install-llvm
AndWeHaveAPlan 41e7d48
make install-llvm-builder
AndWeHaveAPlan f102039
solc fix
AndWeHaveAPlan 688570a
export
AndWeHaveAPlan b1c2bbf
npm
AndWeHaveAPlan bbcec97
source
AndWeHaveAPlan c1e67ad
source
AndWeHaveAPlan e46278c
install gh
AndWeHaveAPlan bcd57b5
token
AndWeHaveAPlan 4a2d343
upload-release-asset@v1
AndWeHaveAPlan 94a25c3
permissions
AndWeHaveAPlan 571f96c
artifact path
AndWeHaveAPlan 0d30047
small cleanup
AndWeHaveAPlan b4b5ad5
branch name
AndWeHaveAPlan 9f3fbaa
rollback version
AndWeHaveAPlan 5ef47e2
branch
AndWeHaveAPlan ab5fcce
version
AndWeHaveAPlan 970c9f8
rollback
AndWeHaveAPlan 007e534
musl build
AndWeHaveAPlan e95ceae
remove llvm-linux-gnu upload
AndWeHaveAPlan 66b6c00
remove gnu
AndWeHaveAPlan 068da35
Merge branch 'main' into es/release-revive
AndWeHaveAPlan e6db639
RUST_MUSL_CROSS_IMAGE
AndWeHaveAPlan b417e2a
release notes test
AndWeHaveAPlan 102130e
rollback version
AndWeHaveAPlan 34f4a63
resolc checks
AndWeHaveAPlan 44ba9fe
release.md update
AndWeHaveAPlan e32e58b
RELEASE.md suggestions
AndWeHaveAPlan cbf9810
ubuntu-24.04
AndWeHaveAPlan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,347 @@ | ||
name: Release | ||
run-name: Release ${{ github.ref_name }} | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
#rust-musl-cross:x86_64-musl | ||
RUST_MUSL_CROSS_IMAGE: messense/rust-musl-cross@sha256:68b86bc7cb2867259e6b233415a665ff4469c28b57763e78c3bfea1c68091561 | ||
|
||
jobs: | ||
|
||
# | ||
# | ||
# | ||
tag: | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: write | ||
outputs: | ||
TAG: ${{ steps.versions.outputs.TAG }} | ||
PKG_VER: ${{ steps.versions.outputs.PKG_VER }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: 'true' | ||
fetch-depth: 0 | ||
|
||
- name: Versions | ||
id: versions | ||
run: | | ||
export CURRENT_TAG=$(git describe --tags --abbrev=0 --exclude "llvm-*") | ||
export PKG_VER=v$(cat Cargo.toml | grep -A 5 package] | grep version | cut -d '=' -f 2 | tr -d '"' | tr -d " ") | ||
echo "Current tag $CURRENT_TAG" | ||
echo "Package version $PKG_VER" | ||
# | ||
echo "PKG_VER=$PKG_VER" >> $GITHUB_OUTPUT | ||
if [ $CURRENT_TAG == $PKG_VER ]; | ||
then | ||
echo "Tag is up to date. Nothing to do."; | ||
export TAG=old; | ||
else | ||
echo "Tag was updated."; | ||
export TAG=new; | ||
fi | ||
echo "TAG=$TAG" >> $GITHUB_OUTPUT | ||
|
||
# | ||
# | ||
# | ||
build-linux-all: | ||
if: ${{ needs.tag.outputs.TAG == 'new' }} | ||
runs-on: parity-large | ||
needs: [tag] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: install linux deps | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y cmake ninja-build \ | ||
curl git libssl-dev pkg-config clang lld musl | ||
|
||
- name: Install Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
components: rust-src | ||
target: wasm32-unknown-emscripten | ||
|
||
- name: versions | ||
run: | | ||
rustup show | ||
cargo --version | ||
cmake --version | ||
echo "bash:" && bash --version | ||
echo "ninja:" && ninja --version | ||
echo "clang:" && clang --version | ||
|
||
- name: build revive-llvm | ||
run: make install-llvm-builder | ||
|
||
# musl LLVM | ||
|
||
- name: llvm-musl-cache restore | ||
id: llvm-musl-cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: target-llvm/musl/target-final | ||
key: llvm-linux-musl-${{ hashFiles('crates/solidity/**') }} | ||
|
||
- name: Build musl LLVM | ||
if: steps.llvm-musl-cache.outputs.cache-hit != 'true' | ||
run: | | ||
revive-llvm --target-env musl clone | ||
revive-llvm --target-env musl build --llvm-projects lld --llvm-projects clang | ||
|
||
- name: llvm-musl-cache save | ||
if: steps.llvm-musl-cache.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: target-llvm/musl/target-final | ||
key: llvm-linux-musl-${{ hashFiles('crates/solidity/**') }} | ||
|
||
# emscripten LLVM | ||
|
||
- name: llvm-emscripten-cache restore | ||
id: llvm-emscripten-cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
target-llvm/emscripten/target-final | ||
emsdk | ||
key: llvm-linux-emscripten-${{ hashFiles('crates/solidity/**') }} | ||
|
||
- name: Build emscripten LLVM | ||
if: steps.llvm-emscripten-cache.outputs.cache-hit != 'true' | ||
run: | | ||
revive-llvm --target-env emscripten clone | ||
source emsdk/emsdk_env.sh | ||
revive-llvm --target-env emscripten build --llvm-projects lld | ||
|
||
- name: llvm-emscripten-cache save | ||
if: steps.llvm-emscripten-cache.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: | | ||
target-llvm/emscripten/target-final | ||
emsdk | ||
key: llvm-linux-emscripten-${{ hashFiles('crates/solidity/**') }} | ||
|
||
# Build revive | ||
|
||
- name: build musl | ||
run: | | ||
mkdir resolc-out | ||
docker run -v $PWD:/opt/revive $RUST_MUSL_CROSS_IMAGE /bin/bash -c " | ||
cd /opt/revive | ||
apt update && apt upgrade -y && apt install -y pkg-config | ||
export LLVM_SYS_181_PREFIX=/opt/revive/target-llvm/musl/target-final | ||
make install-bin | ||
cp /root/.cargo/bin/resolc /opt/revive/resolc-out/resolc | ||
" | ||
|
||
- name: check musl | ||
run: | | ||
mkdir solc | ||
curl -sSLo solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux | ||
chmod +x solc/solc | ||
PATH=$PWD/solc:$PATH | ||
result=$(./resolc-out/resolc --bin crates/integration/contracts/flipper.sol) | ||
echo $result | ||
if [[ $result == *'0x50564d'* ]]; then exit 0; else exit 1; fi | ||
|
||
- name: Set Up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
|
||
- name: build wasm | ||
run: | | ||
export LLVM_SYS_181_PREFIX=$PWD/target-llvm/musl/target-final | ||
export REVIVE_LLVM_TARGET_PREFIX=$PWD/target-llvm/emscripten/target-final | ||
source emsdk/emsdk_env.sh | ||
rustup target add wasm32-unknown-emscripten | ||
make install-wasm | ||
|
||
- name: check wasm | ||
run: | | ||
curl -sSLo solc/soljson.js https://github.com/ethereum/solidity/releases/download/v0.8.28/soljson.js | ||
node -e " | ||
const soljson = require('solc/soljson'); | ||
const createRevive = require('./target/wasm32-unknown-emscripten/release/resolc.js'); | ||
|
||
const compiler = createRevive(); | ||
compiler.soljson = soljson; | ||
|
||
const standardJsonInput = | ||
{ | ||
language: 'Solidity', | ||
sources: { | ||
'MyContract.sol': { | ||
content: 'pragma solidity ^0.8.0; contract MyContract { function greet() public pure returns (string memory) { return \'Hello\'; } }', | ||
}, | ||
}, | ||
settings: { optimizer: { enabled: false } } | ||
}; | ||
|
||
compiler.writeToStdin(JSON.stringify(standardJsonInput)); | ||
compiler.callMain(['--standard-json']); | ||
|
||
// Collect output | ||
const stdout = compiler.readFromStdout(); | ||
const stderr = compiler.readFromStderr(); | ||
|
||
if (stderr) { console.error(stderr); process.exit(1); } | ||
|
||
let out = JSON.parse(stdout); | ||
let bytecode = out.contracts['MyContract.sol']['MyContract'].evm.bytecode.object | ||
console.log(bytecode); | ||
|
||
if(!bytecode.startsWith('50564d')) { process.exit(1); } | ||
" | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: revive-wasm | ||
path: | | ||
./target/wasm32-unknown-emscripten/release/resolc.js | ||
./target/wasm32-unknown-emscripten/release/resolc.wasm | ||
./target/wasm32-unknown-emscripten/release/resolc_web.js | ||
retention-days: 1 | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: revive-linux | ||
path: | | ||
./resolc-out/resolc | ||
retention-days: 1 | ||
|
||
# | ||
# | ||
# | ||
create-release: | ||
needs: [tag, build-linux-all] | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: write | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.result }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Create/update tag | ||
id: tag | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
script: | | ||
await github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/${{ needs.tag.outputs.PKG_VER }}', | ||
sha: context.sha | ||
}) | ||
|
||
- name: get relese notes | ||
id: get-notes | ||
run: | | ||
{ | ||
echo 'releaseNotes<<EOF' | ||
sed '/^## ${{ needs.tag.outputs.PKG_VER }}/,/^## v/!d' CHANGELOG.md | sed -e '1d' -e '$d' | ||
echo EOF | ||
} >> "$GITHUB_OUTPUT" | ||
|
||
|
||
- name: Create release | ||
id: create_release | ||
env: | ||
releaseNotes: ${{ steps.get-notes.outputs.releaseNotes }} | ||
version: ${{ needs.tag.outputs.PKG_VER }} | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
script: | | ||
let response = await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: process.env.version, | ||
name: process.env.version, | ||
body: process.env.releaseNotes, | ||
draft: true, | ||
prerelease: true | ||
}); | ||
console.log(response); | ||
return response.data.upload_url; | ||
|
||
- name: Log | ||
run: | | ||
echo "tag result: ${{ needs.tag.outputs.TAG }}" | ||
echo "pkg version: ${{ needs.tag.outputs.PKG_VER }}" | ||
|
||
# | ||
# | ||
# | ||
upload-assets: | ||
runs-on: ubuntu-24.04 | ||
needs: [create-release] | ||
steps: | ||
|
||
- name: Download Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: revive-wasm | ||
path: resolc/ | ||
|
||
- name: Download Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: revive-linux | ||
path: resolc/ | ||
|
||
- name: upload resolc | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ./resolc/resolc | ||
asset_name: resolc-static-linux | ||
asset_content_type: application/octet-stream | ||
|
||
- name: upload resolc.js | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ./resolc/resolc.js | ||
asset_name: resolc.js | ||
asset_content_type: application/octet-stream | ||
|
||
- name: upload resolc.wasm | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ./resolc/resolc.wasm | ||
asset_name: resolc.wasm | ||
asset_content_type: application/octet-stream | ||
|
||
- name: upload resolc_web.js | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ./resolc/resolc_web.js | ||
asset_name: resolc_web.js | ||
asset_content_type: application/octet-stream |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.