Skip to content

Commit

Permalink
docs: update setup and build instructions
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
antonbaliasnikov committed May 10, 2024
1 parent 757fdc9 commit 5f3e60d
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 321 deletions.
132 changes: 66 additions & 66 deletions .github/actions/build-llvm/action.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
name: 'Build LLVM'
description: 'Builds backend LLVM framework'
inputs:
build-type:
description: 'LLVM build type: debug | release'
required: true
default: 'release'
target-env:
description: 'Target environment (gnu or musl).'
required: false
default: 'gnu'
llvm-builder-version:
description: 'Version of the LLVM builder to use.'
required: false
default: '1.0.24'
runs:
using: "composite"
steps:
- name: Prepare environment
if: runner.os == 'macOS'
run: brew install cmake ninja
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}

- name: Clone LLVM framework
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
run: |
cargo install compiler-llvm-builder@${{ inputs.llvm-builder-version }}
zkevm-llvm clone --target-env ${{ inputs.target-env }}
- name: Define ccache key
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
id: ccache-key
run: |
LLVM_BRANCH="$(git -C ./llvm rev-parse --abbrev-ref HEAD)"
LLVM_SHORT_SHA="$(git -C ./llvm rev-parse --short HEAD)"
echo "key=llvm-${LLVM_BRANCH}-${LLVM_SHORT_SHA}-${{ runner.os }}-${{ runner.arch }}" | tee -a "${GITHUB_OUTPUT}"
- name: Prepare ccache installation
if: runner.os == 'Linux'
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
run: apt update

- name: Set up compiler cache
uses: hendrikmuhs/[email protected]
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_NOHASHDIR: "true"
CCACHE_COMPILERCHECK: "content"
with:
key: ${{ steps.ccache-key.outputs.key }}
restore-keys: ${{ steps.ccache-key.outputs.key }}
append-timestamp: false
max-size: "2G"
verbose: 2
save: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') }}

- name: Build LLVM
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_NOHASHDIR: "true"
CCACHE_COMPILERCHECK: "content"
LIBSTDCPP_SOURCE_PATH: "C:/a/_temp/msys64/mingw64/lib/libstdc++.a"
run: |
[ "${{ inputs.build-type }}" = "debug" ] && DEBUG_ARG="--debug"
zkevm-llvm build --use-ccache --target-env ${{ inputs.target-env }} ${DEBUG_ARG}
name: 'Build LLVM'
description: 'Builds backend LLVM framework'
inputs:
build-type:
description: 'LLVM build type: debug | release'
required: true
default: 'release'
target-env:
description: 'Target environment (gnu or musl).'
required: false
default: 'gnu'
llvm-builder-version:
description: 'Version of the LLVM builder to use.'
required: false
default: '1.0.24'
runs:
using: "composite"
steps:
- name: Prepare environment
if: runner.os == 'macOS'
run: brew install cmake ninja
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}

- name: Clone LLVM framework
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
run: |
cargo install compiler-llvm-builder@${{ inputs.llvm-builder-version }}
zksync-llvm clone --target-env ${{ inputs.target-env }}
- name: Define ccache key
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
id: ccache-key
run: |
LLVM_BRANCH="$(git -C ./llvm rev-parse --abbrev-ref HEAD)"
LLVM_SHORT_SHA="$(git -C ./llvm rev-parse --short HEAD)"
echo "key=llvm-${LLVM_BRANCH}-${LLVM_SHORT_SHA}-${{ runner.os }}-${{ runner.arch }}" | tee -a "${GITHUB_OUTPUT}"
- name: Prepare ccache installation
if: runner.os == 'Linux'
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
run: apt update

- name: Set up compiler cache
uses: hendrikmuhs/[email protected]
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_NOHASHDIR: "true"
CCACHE_COMPILERCHECK: "content"
with:
key: ${{ steps.ccache-key.outputs.key }}
restore-keys: ${{ steps.ccache-key.outputs.key }}
append-timestamp: false
max-size: "2G"
verbose: 2
save: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') }}

- name: Build LLVM
shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }}
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_NOHASHDIR: "true"
CCACHE_COMPILERCHECK: "content"
LIBSTDCPP_SOURCE_PATH: "C:/a/_temp/msys64/mingw64/lib/libstdc++.a"
run: |
[ "${{ inputs.build-type }}" = "debug" ] && DEBUG_ARG="--debug"
zksync-llvm build --use-ccache --target-env ${{ inputs.target-env }} ${DEBUG_ARG}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ license.
We aim to make it as easy as possible to contribute to the mission. This is still WIP, and we're happy for contributions
and suggestions here too. Some resources to help:

1. [zkSync Era docs!](https://era.zksync.io/docs/)
1. [ZKsync Era docs!](https://era.zksync.io/docs/)
2. Company links can be found in the [repo's readme](README.md)

## Code of Conduct
Expand Down
Loading

0 comments on commit 5f3e60d

Please sign in to comment.