-
Notifications
You must be signed in to change notification settings - Fork 4
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
Contract actions #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
contracts: | ||
name: Contracts | ||
uses: ElrondNetwork/elrond-actions/.github/workflows/contracts.yml@v1 | ||
with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably wasm-opt
logic / version has an impact on deterministic builds, as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably erdpy version can be specified as well (optional field)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment the aim is not to make the build deterministic (anyway, this is done through docker images), but only to port the existing functionality and to integrate erdpy contract report
. The latest wasm-opt
should be fine.
The versions which are fixed at the moment (rust nightly, vmtools) are fixed because we've had broken builds in the past because of changes in those two.
The rust nightly is volatile and since our code depends on a lot of features. For vmtools the outputs of the mandos tests may differ - so upgrades have to be done manually.
I added the possibility to specify the erdpy
version and added information about the extra option to the README.md
erdpy deps install vmtools | ||
|
||
erdpy deps install nodejs | ||
erdpy deps install wasm-opt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--tag=...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasm-opt
should use the latest version
.github/workflows/contracts.yml
Outdated
pip3 install erdpy | ||
mkdir $HOME/elrondsdk | ||
erdpy config set dependencies.vmtools.tag ${{ inputs.vmtools-version }} | ||
erdpy deps install vmtools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, can use the flag --tag
instead of erdpy config set
(can also stay as it is).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
run: erdpy contract report --skip-build --output-format json --output-file report.json | ||
|
||
- name: Upload the report json | ||
uses: actions/upload-artifact@v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps also conditionally (what conditions?) upload the generated /output
, as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I focused on porting the existing functionality - I think uploading the contracts from the output
folder can be done in a follow-up PR.
path: report.json | ||
|
||
- name: Download the base report | ||
uses: dawidd6/action-download-artifact@v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use the official action, actions/download-artifact@v2
, instead?
https://github.com/ElrondNetwork/sc-dex-rs/blob/main/.github/workflows/release.yml#L58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The official action is fairly limited (only allows configuring the artifact name and destination path) and only supports downloading artifacts from the same workflow (from the current commit).
What I need is the artifact from the base branch (same workflow but a different build) - only dawidd6/action-download-artifact@v2
allows me to specify this.
|
||
- name: Render the report from the template | ||
id: template | ||
uses: chuhlomin/render-template@v1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another community action. Isn't there a simple find & replace command / Python (inline script) that we can use, instead?
path: report.md | ||
|
||
- name: Find the comment containing the report | ||
id: fc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step ID? Is this name fixed or can we change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think of this ID as a local variable - it's used below in one of the next steps. We can change it if you want - I'm fine with either this or another name.
|
||
- name: Find the comment containing the report | ||
id: fc | ||
uses: peter-evans/find-comment@v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether we should depend on community (not Github official) actions or use our own code. @camilbancioiu, @bogdan-rosianu?
with: | ||
rust-toolchain: nightly-2022-01-17 | ||
vmtools-version: v1.4.43 | ||
extra-build-args: --ignore-eei-checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps in a next PR, there could be a new action, more specific to deterministic builds, which would rely on the frozen docker images?
https://github.com/ElrondNetwork/sc-dex-rs/blob/main/.github/workflows/release.yml#L24
And also use a fixed location for the build:
https://github.com/ElrondNetwork/sc-dex-rs/blob/main/.github/workflows/release.yml#L31
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. In a future PR it is then 👍
contracts.yml
--ignore-eei-checks
)erdpy contract report
twiggy
env
file insidecontracts.yml
./build-wasm.sh
by using the recursive argument for erdpy:erdpy contract build -r
actions/checkout@v2
->v3
README.md
push
event)