Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3de47f8
Revamp of actions part #2
Marcin-Radecki Mar 24, 2023
8d40546
Now using correct action input args syntax
Marcin-Radecki Mar 24, 2023
0812367
Try different action for installing rust tollchain
Marcin-Radecki Mar 24, 2023
91479ca
Fix for typo
Marcin-Radecki Mar 24, 2023
05d1319
Try to use custom action for rust toolchain
Marcin-Radecki Mar 24, 2023
c327395
Try to use custom action for rust toolchain
Marcin-Radecki Mar 24, 2023
15e461a
Try to use custom action for rust toolchain
Marcin-Radecki Mar 24, 2023
ab27a4b
Try to use custom action for rust toolchain
Marcin-Radecki Mar 24, 2023
f9d040a
Try to use custom action for rust toolchain
Marcin-Radecki Mar 27, 2023
e75d1b2
Try to use custom action for rust toolchain
Marcin-Radecki Mar 27, 2023
d15507e
Try to use custom action for rust toolchain
Marcin-Radecki Mar 27, 2023
1436b79
Replace all toolchain install with custom action
Marcin-Radecki Mar 27, 2023
630dbaf
New action has now components and toolchain inputs
Marcin-Radecki Mar 27, 2023
bdc5566
linter
Marcin-Radecki Mar 27, 2023
0f6ab9e
linter
Marcin-Radecki Mar 27, 2023
569fbb5
Missing "
Marcin-Radecki Mar 27, 2023
370737d
Typo
Marcin-Radecki Mar 27, 2023
7dfb8ab
Typo
Marcin-Radecki Mar 27, 2023
f96e2fc
Switch order of steps
Marcin-Radecki Mar 27, 2023
4acdc6e
No
Marcin-Radecki Mar 27, 2023
b30bacb
Check excluded packages cleanup
Marcin-Radecki Mar 27, 2023
b6ef023
Check excluded packages cleanup
Marcin-Radecki Mar 27, 2023
e71be56
Removed comment code
Marcin-Radecki Mar 27, 2023
fde2937
Merge branch 'main' into A0-1998-review-actions
Marcin-Radecki Mar 27, 2023
af3b021
Rust-toolchain file is now toml
Marcin-Radecki Mar 27, 2023
74c7ce8
Rust-toolchain file is now toml
Marcin-Radecki Mar 27, 2023
96eb338
Rust-toolchain file is now toml
Marcin-Radecki Mar 27, 2023
7b9bdc7
Rust-toolchain file is now toml
Marcin-Radecki Mar 27, 2023
6603a97
Rust-toolchain file is now toml
Marcin-Radecki Mar 27, 2023
5f18a34
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
b4cdc18
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
875e2a0
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
9036120
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
00a042a
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
1980053
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
d6e598e
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
680bdd3
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
f6893f8
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
8fa7c4b
Rust-toolchain file is now toml testing
Marcin-Radecki Mar 27, 2023
0121b38
Rust-toolchain file is now toml
Marcin-Radecki Mar 27, 2023
48830aa
Rust-toolchain file is now toml
Marcin-Radecki Mar 27, 2023
43dd6a7
Merge branch 'main' into A0-1998-review-actions
Marcin-Radecki Mar 27, 2023
f37241d
Merge branch 'main' into A0-1998-review-actions
Marcin-Radecki Mar 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ inputs:
outputs:
deployment-name:
description: 'Output with a deployment name for working with deployments'
value: ${{ steps.get_branch.outputs.branch_name }}
value: ${{ steps.get-ref-properties.outputs.branch-name-flattened }}
runs:
using: "composite"
steps:
- name: Get branch name and commit SHA
id: get_branch
uses: ./.github/actions/get-branch
id: get-ref-properties
uses: ./.github/actions/get-ref-properties

- name: Checkout aleph-apps repo
uses: actions/checkout@v3
Expand All @@ -47,7 +47,7 @@ runs:
- name: Destroy feature branch
shell: bash
env:
APP_NAME: fe-${{ steps.get_branch.outputs.branch_appname }}
APP_NAME: fe-${{ steps.get-ref-properties.outputs.branch-name-for-argo }}
run: |
ALEPH_PATH=$(pwd)

Expand All @@ -57,7 +57,7 @@ runs:
- name: Commit deletion of the feature environment.
uses: EndBug/add-and-commit@v9.1.1
env:
APP_NAME: fe-${{ steps.get_branch.outputs.branch_appname }}
APP_NAME: fe-${{ steps.get-ref-properties.outputs.branch-name-for-argo }}
with:
author_name: AlephZero Automation
author_email: alephzero@10clouds.com
Expand All @@ -83,7 +83,7 @@ runs:
- name: Clean S3 storage
shell: bash
env:
BRANCH_NAME: ${{ steps.get_branch.outputs.branch_name }}
BRANCH_NAME: ${{ steps.get-ref-properties.outputs.branch-name-flattened }}
run: |
aws s3 rm --recursive \
s3://fe-alephzero-devnet-eu-central-1-keys-bucket/fe-${{ env.BRANCH_NAME }}
5 changes: 5 additions & 0 deletions .github/actions/get-ref-properties/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ outputs:
branch-name-flattened:
description: Branch name with / (slash) replaced with - (hyphen)
value: ${{ steps.branch.outputs.name-flattened }}
branch-name-for-argo:
description: Branch name that matches [a-z0-9-.]+ for ArgoCD app name
value: ${{ steps.branch.outputs.name-for-argo }}
tag:
description: Tag name
value: ${{ steps.tag.outputs.name }}
Expand Down Expand Up @@ -42,6 +45,8 @@ runs:
run: |
echo name=$(echo ${HEAD_REF#refs/heads/}) >> $GITHUB_OUTPUT
echo name-flattened=$(echo ${HEAD_REF#refs/heads/} | tr / -) >> $GITHUB_OUTPUT
echo name-for-argo=$(echo ${HEAD_REF#refs/heads/} \
| tr / - | tr '[:upper:]' '[:lower:]' | tr -c '[a-z0-9-.]' '-') >> $GITHUB_OUTPUT

- name: Get commit properties
id: commit
Expand Down
91 changes: 91 additions & 0 deletions .github/actions/install-rust-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: Install rust toolchain
description: |
Parses rust-toolchain.toml file and installs rust toolchain based on its contents:
* channel, e.g nightly-2022-10-30
* list of targets, e.g. ["wasm32-unknown-unknown"]
* list of components, e.g. ["clippy", "rustfmt"]
Also, this action contains set of inputs that can override any of the above.
Existence of rust-toolchain.toml file is not mandatory, yet channel is then required to be
passed as an input.
inputs:
channel:
description: |
Toolchain channel. It's required only when rust-toolchain.toml file does not specify it.
required: false
targets:
description: Optional. List of targets to install with the given channel.
required: false
components:
description: Optional. List of cargo components to install.
required: false

runs:
using: composite
steps:
# This step needs to be extracted either to docker image or to setup of self-hosted runner
- name: Install rustup
shell: bash
run: |
if ! command -v rustup &>/dev/null; then
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL \
"https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
fi

- name: Read channel from rust-toolchain.toml
id: toolchain-channel
uses: SebRollen/toml-action@v1.0.2
with:
file: 'rust-toolchain.toml'
field: 'toolchain.channel'

- name: Read components from rust-toolchain.toml
id: toolchain-components
uses: SebRollen/toml-action@v1.0.2
with:
file: 'rust-toolchain.toml'
field: 'toolchain.components'

- name: Read targets from rust-toolchain.toml
id: toolchain-targets
uses: SebRollen/toml-action@v1.0.2
with:
file: 'rust-toolchain.toml'
field: 'toolchain.targets'

- name: Install rust toolchain
id: install-rust-toolchain
shell: bash
env:
CHANNEL: ${{ inputs.channel || steps.toolchain-channel.outputs.value }}
run: |
if [[ -z "${{ steps.toolchain-channel.outputs.value }}" ]]; then
echo "Could not find value for toolchain.channel in rust-toolchain.toml!"
exit 1
fi
rustup toolchain install ${{ env.CHANNEL }}
echo "channel=${{ env.CHANNEL }}" >> $GITHUB_OUTPUT

- name: Add components (optional)
if: inputs.components != '' || steps.toolchain-components.outputs.value != ''
shell: bash
env:
COMPONENTS: ${{ inputs.components || steps.toolchain-components.outputs.value }}
run: |
components=$(echo ${{ env.COMPONENTS }} | tr -d '[]' | sed 's/,/ /g')
for component in $components; do
rustup component add $component
done

- name: Add targets (optional)
if: inputs.targets != '' || steps.toolchain-targets.outputs.value != ''
shell: bash
env:
TARGETS: ${{ inputs.targets || steps.toolchain-targets.outputs.value }}
run: |
targets=$(echo ${{ env.TARGETS }} | tr -d '[]' | sed 's/,/ /g')
for target in $targets; do
rustup target add $target \
--toolchain ${{ steps.install-rust-toolchain.outputs.channel }}
done
7 changes: 3 additions & 4 deletions .github/workflows/_build-liminal-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

- name: Install WASM target
run: rustup target add wasm32-unknown-unknown
uses: ./.github/actions/install-rust-toolchain
with:
targets: wasm32-unknown-unknown

- name: Build test binary and runtime
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
if-no-files-found: error
retention-days: 7

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
- name: Install Rust toolchain
uses: ./.github/actions/install-rust-toolchain

- name: Build binary and docker image
run: |
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/_build-production-node-and-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ jobs:
uses: ./.github/actions/get-ref-properties

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

- name: Install WASM target
run: rustup target add wasm32-unknown-unknown
uses: ./.github/actions/install-rust-toolchain
with:
targets: wasm32-unknown-unknown

- name: Build production binary and runtime
run: cargo build --profile production -p aleph-node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
retention-days: 7

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
uses: ./.github/actions/install-rust-toolchain

- name: Build binary and docker image
run: |
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/_build-test-node-and-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ jobs:
uses: ./.github/actions/get-ref-properties

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

- name: Install WASM target
run: rustup target add wasm32-unknown-unknown
uses: ./.github/actions/install-rust-toolchain
with:
targets: wasm32-unknown-unknown

- name: Build test binary and runtime
run: |
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/_check-excluded-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
uses: actions/checkout@v3

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
uses: ./.github/actions/install-rust-toolchain
with:
targets: wasm32-unknown-unknown
components: clippy rustfmt

- name: Read excluded packages from Cargo.toml
id: read_excluded
Expand All @@ -39,9 +42,6 @@ jobs:
echo "targets=$targets" >> $GITHUB_OUTPUT

- name: Check excluded packages
env:
RUSTC_WRAPPER: ""
RUSTC_WORKSPACE_WRAPPER: sccache
run: |
packages="${{ steps.format_output.outputs.packages }}"
packages="${packages//'%0A'/$'\n'}"
Expand All @@ -54,8 +54,6 @@ jobs:
fi
echo "Checking package $p..."
pushd "$p"
rustup component add clippy rustfmt
rustup target add wasm32-unknown-unknown
cargo fmt --all --check
cargo clippy -- --no-deps -D warnings
popd
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/_check-runtime-determimism.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
main:
name: Verify runtime build determinism
name: Check runtime build determinism
runs-on: self-hosted
env:
RUST_BACKTRACE: full
Expand All @@ -17,10 +17,9 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

- name: Install WASM target
run: rustup target add wasm32-unknown-unknown
uses: ./.github/actions/install-rust-toolchain
with:
targets: wasm32-unknown-unknown

- name: Download production runtime from artifacts
uses: actions/download-artifact@v3
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/_unit-tests-and-static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1

- name: Install clippy and fmt
run: rustup component add clippy rustfmt

- name: Install WASM target
run: rustup target add wasm32-unknown-unknown
uses: ./.github/actions/install-rust-toolchain
with:
targets: wasm32-unknown-unknown
components: clippy rustfmt

- name: Run Format Checks
uses: actions-rs/cargo@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push-cliain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
uses: ./.github/actions/install-rust-toolchain

- name: Cargo | Build release binary
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
uses: ./.github/actions/install-rust-toolchain

- name: rustdoc | Build aleph-client docs
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-feature-envs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:

- name: Delete old FE when redeploying
if: contains( github.event.pull_request.labels.*.name, env.LABEL_DEPLOYED)
uses: ./.github/actions/destroy-feature-environment
uses: ./.github/actions/delete-feature-environment
with:
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
aws-access-key: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -497,7 +497,7 @@ jobs:
uses: actions/checkout@v3

- name: Delete FE
uses: ./.github/actions/destroy-feature-environment
uses: ./.github/actions/delete-feature-environment
id: delete_fe
with:
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
Expand Down Expand Up @@ -558,7 +558,7 @@ jobs:
uses: actions/checkout@v3

- name: Delete FE
uses: ./.github/actions/destroy-feature-environment
uses: ./.github/actions/delete-feature-environment
id: delete_fe
with:
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/on-pull-request-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,10 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

- name: Install rust-src
working-directory: ./contracts
run: rustup component add rust-src
uses: ./.github/actions/install-rust-toolchain
with:
targets: wasm32-unknown-unknown
components: rust-src

- name: Run e2e test
uses: ./.github/actions/run-e2e-test
Expand Down
2 changes: 1 addition & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ After a successful build the binary can be found in `target/release/aleph-node`.
[nix]: https://nixos.org/download.html
[rustup]: https://rustup.rs/
[docker]: https://docs.docker.com/engine/install/ubuntu/
[rust-toolchain]: ./rust-toolchain
[rust-toolchain]: ./rust-toolchain.toml
4 changes: 2 additions & 2 deletions nix/versions.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
rec {
rustToolchain =
let
# use Rust toolchain declared by the rust-toolchain file
# use Rust toolchain declared by the rust-toolchain.toml file
rustToolchain = with nixpkgs; overrideRustTarget ( rustChannelOf { date = "2022-10-30"; channel = "nightly"; } );

overrideRustTarget = rustChannel: rustChannel // {
Expand All @@ -15,7 +15,7 @@ rec {

nixpkgs =
let
# this overlay allows us to use a version of the rust toolchain specified by the rust-toolchain file
# this overlay allows us to use a version of the rust toolchain specified by the rust-toolchain.toml file
rustOverlay =
import (builtins.fetchTarball {
# link: https://github.com/mozilla/nixpkgs-mozilla/tree/f233fdc4ff6ba2ffeb1e3e3cd6d63bb1297d6996
Expand Down
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly-2022-10-30"