{"id":13651741,"url":"https://github.com/chevdor/srtool-actions","last_synced_at":"2025-03-22T18:34:07.805Z","repository":{"id":41815326,"uuid":"371758792","full_name":"chevdor/srtool-actions","owner":"chevdor","description":"A github action to easily build your Substrate WASM runtime using srtool with your CI","archived":false,"fork":false,"pushed_at":"2024-01-02T14:47:31.000Z","size":542,"stargazers_count":15,"open_issues_count":6,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T01:51:51.443Z","etag":null,"topics":["blockchain","chevdor","github-actions","polkadot","runtime","srtool","substrate","wasm"],"latest_commit_sha":null,"homepage":"","language":"Just","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chevdor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.adoc","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-05-28T16:25:25.000Z","updated_at":"2023-10-27T11:26:13.000Z","dependencies_parsed_at":"2024-01-02T15:42:28.163Z","dependency_job_id":"f2257a8f-c8d3-472d-a983-d8bfa8b11ce1","html_url":"https://github.com/chevdor/srtool-actions","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chevdor%2Fsrtool-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chevdor%2Fsrtool-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chevdor%2Fsrtool-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chevdor%2Fsrtool-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chevdor","download_url":"https://codeload.github.com/chevdor/srtool-actions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245003517,"owners_count":20545625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","chevdor","github-actions","polkadot","runtime","srtool","substrate","wasm"],"created_at":"2024-08-02T02:00:51.941Z","updated_at":"2025-03-22T18:34:07.425Z","avatar_url":"https://github.com/chevdor.png","language":"Just","funding_links":[],"categories":["Tools"],"sub_categories":[],"readme":"# SRTOOL Github Action\n\n\u003cfigure\u003e\n\u003cimg src=\"https://github.com/chevdor/srtool-actions/actions/workflows/polkadot-sdk.yml/badge.svg?branch=master\" alt=\"badge\" /\u003e\n\u003c/figure\u003e\n\n## Introduction\n\n[srtool](https://github.com/chevdor/srtool) is a docker image that allows building Substrate WASM Runtimes in a deterministic manner. It ensures that all `srtool` users (and tooling), using the same/latest tag, will produce 100% exactly the same runtime. It enables further trustless verifications.\n\n\u003cfigure\u003e\n\u003cimg src=\"resources/logo/srtool-gh-action_256px.png\" alt=\"srtool gh action 256px\" /\u003e\n\u003c/figure\u003e\n\nThis repository contains a custom [Github Action](https://docs.github.com/en/actions) that will help you integrate `srtool` in your Github CI.\n\nGitlab users are not left behind and can use the 2 first options mentioned below.\n\n## Srtool helpers\n\nThere are now several ways to use `srtool` in your project:\n\n-   using `srtool` [via alias](https://github.com/chevdor/srtool#user-content-using-an-alias): powerful but very verbose and prone to errors. This is for developers. This option is being deprecated and not recommended.\n\n-   using the [srtool-cli](https://github.com/chevdor/srtool-cli): much easier to use and removes a whole bunch of potential user’s mistakes. This is for developers.\n\n-   using the [srtool-app](https://github.com/chevdor/srtool-app): the easiest option of all thanks to its GUI. This is good for non-developers.\n\n-   using the Github actions from [this repo](https://github.com/chevdor/srtool-actions). This is for your automatic CI.\n\n## Requirements\n\nIn order to use this Github Action, you will need a Github repository with your Substrate based project. You can learn how to get started with a first Github workflow [here](https://docs.github.com/en/actions/quickstart).\n\nBefore you setup your new workflow, you should gather the following information:\n\n-   name of your chain: ie. polkadot\n\n-   runtime package: ie. runtime-polkadot\n\n-   location of your runtime: ie. runtime/polkadot\n\nIf your project uses standard values (such as your runtime package being named `xyz-runtime` if your chain is `xyz`), you will be able to skip many of the inputs. If you have a different setup, you can override the defaults to make it work for you.\n\n## Sample workflows\n\nMake sure you store the yml files shown below in your repository under `.github/workflows`.\n\n## basic\n\n**basic.yml**\n\n    name: Srtool build\n\n    on: push\n\n    jobs:\n      srtool:\n        runs-on: ubuntu-latest\n        strategy:\n          matrix:\n            chain: [\"asset-hub-kusama\", \"asset-hub-westend\"]\n        steps:\n          - uses: actions/checkout@v3\n          - name: Srtool build\n            id: srtool_build\n            uses: chevdor/srtool-actions@v0.8.0\n            with:\n              chain: ${{ matrix.chain }}\n              runtime_dir: polkadot-parachains/${{ matrix.chain }}-runtime\n          - name: Summary\n            run: |\n              echo '${{ steps.srtool_build.outputs.json }}' | jq . \u003e ${{ matrix.chain }}-srtool-digest.json\n              cat ${{ matrix.chain }}-srtool-digest.json\n              echo \"Runtime location: ${{ steps.srtool_build.outputs.wasm }}\"\n\n## Report\n\n    name: Srtool build\n\n    on: push\n\n    jobs:\n      srtool:\n        runs-on: ubuntu-latest\n        strategy:\n          matrix:\n            chain: [\"westend\"]\n        steps:\n          - uses: actions/checkout@v3\n          - name: Srtool build\n            id: srtool_build\n            uses: chevdor/srtool-actions@v0.8.0\n            with:\n              chain: ${{ matrix.chain }}\n          - name: Summary\n            run: |\n              echo Summary:\n              echo - version: ${{ steps.srtool_build.outputs.version }}\n              echo - info: ${{ steps.srtool_build.outputs.info }}\n              echo - prop: ${{ steps.srtool_build.outputs.proposal_hash }}\n              echo - json: ${{ steps.srtool_build.outputs.json }}\n\n## Artifacts\n\n    name: Srtool build\n\n    on: push\n\n    jobs:\n      srtool:\n        runs-on: ubuntu-latest\n        strategy:\n          matrix:\n            chain: [\"asset-hub-kusama\", \"asset-hub-westend\"]\n        steps:\n          - uses: actions/checkout@v3\n          - name: Srtool build\n            id: srtool_build\n            uses: chevdor/srtool-actions@v0.8.0\n            with:\n              chain: ${{ matrix.chain }}\n              runtime_dir: polkadot-parachains/${{ matrix.chain }}-runtime\n          - name: Summary\n            run: |\n              echo '${{ steps.srtool_build.outputs.json }}' | jq . \u003e ${{ matrix.chain }}-srtool-digest.json\n              cat ${{ matrix.chain }}-srtool-digest.json\n              echo \"Runtime location: ${{ steps.srtool_build.outputs.wasm }}\"\n          - name: Archive Runtime\n            uses: actions/upload-artifact@v2\n            with:\n              name: ${{ matrix.chain }}-runtime-${{ github.sha }}\n              path: |\n                ${{ steps.srtool_build.outputs.wasm }}\n                ${{ matrix.chain }}-srtool-digest.json\n\n## Environmental variables and BUILD\\_OPTS\n\n    name: Srtool build\n\n    on: push\n\n    jobs:\n      srtool:\n        runs-on: ubuntu-latest\n        strategy:\n          matrix:\n            chain: [\"asset-hub-kusama\", \"asset-hub-westend\"]\n        steps:\n          - uses: actions/checkout@v3\n          - name: Srtool build\n            id: srtool_build\n            uses: chevdor/srtool-actions@v0.8.0\n            env:\n              # optional: will be passed to docker srtool run cmd\n              BUILD_OPTS: \"--features on-chain-release-build\"\n            with:\n              chain: ${{ matrix.chain }}\n              runtime_dir: polkadot-parachains/${{ matrix.chain }}-runtime\n          - name: Summary\n            run: |\n              echo '${{ steps.srtool_build.outputs.json }}' | jq . \u003e ${{ matrix.chain }}-srtool-digest.json\n              cat ${{ matrix.chain }}-srtool-digest.json\n              echo \"Runtime location: ${{ steps.srtool_build.outputs.wasm }}\"\n\n## Environmental variables and parachain overrides\n\n    name: Srtool build\n\n    on: push\n\n    jobs:\n      srtool:\n        runs-on: ubuntu-latest\n        strategy:\n          matrix:\n            chain: [\"asset-hub-kusama\", \"asset-hub-westend\"]\n        steps:\n          - uses: actions/checkout@v3\n          - name: Srtool build\n            id: srtool_build\n            uses: chevdor/srtool-actions@v0.8.0\n            env:\n              # optional: will override the parachain pallet ID and authorize_upgrade call ID,\n              #           which will result in a different parachain_authorize_upgrade_hash\n              # the hex values must be quoted\n              PARACHAIN_PALLET_ID: \"0x1e\"\n              AUTHORIZE_UPGRADE_PREFIX: \"0x02\"\n            with:\n              chain: ${{ matrix.chain }}\n              runtime_dir: polkadot-parachains/${{ matrix.chain }}-runtime\n          - name: Summary\n            run: |\n              echo '${{ steps.srtool_build.outputs.json }}' | jq . \u003e ${{ matrix.chain }}-srtool-digest.json\n              cat ${{ matrix.chain }}-srtool-digest.json\n              echo \"Runtime location: ${{ steps.srtool_build.outputs.wasm }}\"\n\n## Parachain overrides\n\nSimilar to [subwasm](https://github.com/chevdor/subwasm), the parachain pallet ID and the `authorize_upgrade` call ID can be overriden by `PARACHAIN_PALLET_ID` and `AUTHORIZE_UPGRADE_PREFIX` environmental variables, respectively. It will affect the generated proposal hash `parachain_authorize_upgrade_hash`.\n\nIf unset, the two envs will have the following default values:\n\n-   `PARACHAIN_PALLET_ID`: `0x01`\n\n-   `AUTHORIZE_UPGRADE_PREFIX`: `0x02`\n\n## Contributing\n\nThis project is using `asciidoc` for its documentation. You should **not** edit any mardown file (`.md`) as your changes would be dismissed.\n\nInstead you should be editing the `.adoc` file and the markdown files will be generated. If you create a PR and do not have any of the required tooling, feel free to only edit the `.adoc.` files and I will generate the new `.md`.\n\n## Dev notes\n\n### Tooling: `act`\n\nDue to a [bug in act](https://github.com/nektos/act/issues/655), the defaults defined in the action are not applied. That means **must** pass all the inputs while testing with `act`.\n\nYou can test locally using [act](https://github.com/nektos/act):\n\n    act -W tests\n\nTo make it easier, you can also use `just`:\n\n    just test \u003ctest_name\u003e\n\nFor instance:\n\n    # Run the default dev workflow: tests/dev.yml\n    just test\n\n    # Run the ipfs test workflow\n    just test ipfs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchevdor%2Fsrtool-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchevdor%2Fsrtool-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchevdor%2Fsrtool-actions/lists"}