Skip to content

Commit

Permalink
Initialize release-10
Browse files Browse the repository at this point in the history
  • Loading branch information
Princeprince559 authored Dec 2, 2024
0 parents commit c7996b9
Show file tree
Hide file tree
Showing 373 changed files with 152,172 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/target
target
!target/release/aleph-node
!bin/cliain/target/release/cliain
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

## Type of change

Please delete options that are not relevant.

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)

# Checklist:

<!-- delete when not applicable to your PR -->

- I have added tests
- I have made neccessary updates to the Infrastructure
- I have made corresponding changes to the existing documentation
- I have created new documentation
- I have bumped `spec_version` and `transaction_version`
- I have bumped aleph-client version if relevant
60 changes: 60 additions & 0 deletions .github/actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
This directory gathers useful actions for Github pipelines.

## `restore-cache`
This action restores and saves cache dedicated for Rust builds
(in particular we keep Cargo files, target directories and make use of sccache).

### Usage
Sample usage:
```yaml
steps:
- uses: Cardinal-Cryptography/github-actions/restore-cache@cache-v1

- run: cargo build

- uses: Cardinal-Cryptography/github-actions/post-cache@v1
```
For building packages excluded from main workspace, you can add corresponding input parameter:
```yaml
steps:
- uses: Cardinal-Cryptography/github-actions/restore-cache@cache-v1
with:
cargo-targets: |
excluded_package_1/target/
aux_tool/excluded_package_2/target/
```
### Notes
**Note:** Currently we only support runners using `ubuntu:latest` image.

**Note:** Requires calling `post-cache` action to stop sccache server.

**Note:** There is a problem with using `cargo clippy` with `sccache` - check: https://github.com/mozilla/sccache/issues/966.
Effectively, you have to override environment variables like this:
```shell
export RUSTC_WRAPPER=""
export RUSTC_WORKSPACE_WRAPPER=sccache
cargo clippy
```

---

## `post-cache`
Stops sccache server. Use together with `restore-cache`.

---

## `run-e2e-test`
This action runs a single test from the e2e test suite. It requires a test case, which is the name of the test.
It optionally runs the finalization e2e testcase, which is helpful after some e2e tests to double-check nothing is broken.

### Usage
Sample usage:
```yaml
steps:
- uses: ./.github/actions/run-e2e-test
with:
test-case: finalization
```
89 changes: 89 additions & 0 deletions .github/actions/destroy-feature-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: 'Destroy Feature Environment'
description: 'Action used for feature environment deletion'

inputs:
gh-ci-token:
description: 'GH token to be used in the action'
required: true
aws-access-key:
description: 'AWS Access Key ID to be used in the action'
required: true
aws-secret-access-key:
description: 'AWS Secret Access Key to be used in the action'
required: true
argo-sync-user-token:
description: 'ArgoCD user token to be used in the action'
required: true

outputs:
deployment-name:
description: 'Output with a deployment name for working with deployments'
value: ${{ steps.get_branch.outputs.branch_name }}



runs:
using: "composite"
steps:
- name: Get branch name and commit SHA
id: get_branch
uses: ./.github/actions/get-branch

- name: Checkout aleph-apps repo
uses: actions/checkout@master
with:
repository: Cardinal-Cryptography/aleph-apps
token: ${{ inputs.gh-ci-token }}
path: "aleph-apps"
ref: main

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
env:
AWS_REGION: us-east-1
with:
aws-access-key-id: ${{ inputs.aws-access-key }}
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ env.AWS_REGION }}

- name: Destroy feature branch
shell: bash
env:
APP_NAME: fe-${{ steps.get_branch.outputs.branch_appname }}
run: |
ALEPH_PATH=$(pwd)
## Delete FE application for argo to delete it automatically
rm -rf $ALEPH_PATH/aleph-apps/argocd/overlays/devnet/fe-apps/${{ env.APP_NAME }}.yaml
- name: Commit deletion of the feature environment.
uses: EndBug/[email protected]
env:
APP_NAME: fe-${{ steps.get_branch.outputs.branch_appname }}
GITHUB_TOKEN: ${{ inputs.gh-ci-token }}
with:
author_name: AlephZero Automation
author_email: [email protected]
message: "Feature Environment: ${{ env.APP_NAME }} has been deleted"
add: "*.yaml"
cwd: "aleph-apps"
branch: main

- name: Refresh Argo and wait for the deletion to be finished
shell: bash
env:
ARGOCD_URL: argocd.dev.azero.dev
run: |
## Install argocd CLI tool
curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/download/v2.3.3/argocd-linux-amd64
chmod +x argocd && mv argocd /usr/local/bin/
/usr/local/bin/argocd app get fe-root-application --hard-refresh --auth-token ${{ inputs.argo-sync-user-token }} --server ${{ env.ARGOCD_URL }}
/usr/local/bin/argocd app wait fe-root-application --auth-token ${{ inputs.argo-sync-user-token }} --server ${{ env.ARGOCD_URL }}
- name: Clean S3 storage
shell: bash
env:
BRANCH_NAME: ${{ steps.get_branch.outputs.branch_name }}
run: |
aws s3 rm --recursive s3://fe-alephzero-devnet-eu-central-1-keys-bucket/fe-${{ env.BRANCH_NAME }}
29 changes: 29 additions & 0 deletions .github/actions/get-branch/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Get branch details
description: Gets branch name and commit SHA

outputs:
branch_name:
description: Branch name
value: ${{ steps.get_branch.outputs.branch_name }}
branch_appname:
description: Branch name that matches [a-z0-9-.]+ for ArgoCD app name
value: ${{ steps.get_branch.outputs.branch_appname }}
branch_imagetag_full:
description: Image tag from branch name and commit SHA
value: ${{ steps.get_branch.outputs.branch_appname }}_${{ steps.get_branch.outputs.sha_short }}
sha_short:
description: Short commit SHA
value: ${{ steps.get_branch.outputs.sha_short }}

runs:
using: composite
steps:
- name: Get branch name and commit SHA
id: get_branch
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref }}
run: |
echo "##[set-output name=branch_name;]$(echo ${HEAD_REF#refs/heads/} | tr / -)"
echo "##[set-output name=branch_appname;]$(printf ${HEAD_REF#refs/heads/} | tr / - | tr '[:upper:]' '[:lower:]' | tr -c '[a-z0-9-.]' '-')"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
22 changes: 22 additions & 0 deletions .github/actions/post-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Rust cache cleanup"
description: |
Run this at the end of your workflow if you're running `rust-cache`.
runs:
using: "composite"
steps:
- name: Prune unused packages from cargo cache
uses: actions-rs/cargo@v1
with:
command: cache
args: clean-unref

- name: Prune sources from cargo cache
uses: actions-rs/cargo@v1
with:
command: cache
args: --autoclean

- name: Stop sccache server
run: sccache --stop-server || true
shell: bash
105 changes: 105 additions & 0 deletions .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: "Restore rust cache"
description: |
Restore/save rust caches.
This action combines 3 caches:
1. The ~/.cargo cache
2. The ./target cache
3. The sccache cache along with starting the sccache server
All caches are keyed with cache-version along with a hash of all Cargo.lock files in the project. As a fallback they
take the newest cache with any hash of Cargo.lock files to rebuild from a partial cache in case of a Cargo.lock change.
inputs:
cache-version:
description: "String indicating the version of the caches, change it to clean caches."
required: false
default: "v1"
target-key:
description: >
If you have multiple workflows that generate different contents of the target directory, then you can set this key
differently for them, so that they don't interfere with each other.
required: false
default: ""
cargo-key:
description: >
If you have multiple workflows that generate different contents of the ~/.cargo directory, then you can set this key
differently for them, so that they don't interfere with each other.
required: false
default: ""
sccache-version:
description: "Version number of sccache to use."
required: false
default: v0.3.0
sccache-size:
description: "Size specifier for scache's cache"
required: false
default: "1G"
cargo-targets:
description: "Additional directories to include in the target cache"
required: false
default: ""

runs:
using: "composite"

steps:
- name: Restore cargo cache
uses: actions/cache@v3
env:
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "10"
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo-${{ inputs.cargo-key }}-${{ inputs.cache-version }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ inputs.cargo-key }}-${{ inputs.cache-version }}
- name: Restore target cache
uses: actions/cache@v3
with:
path: |
target
${{ inputs.cargo-targets }}
key: ${{ runner.os }}-target-${{ inputs.target-key }}-${{ inputs.cache-version }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-target-${{ inputs.target-key }}-${{ inputs.cache-version }}
- name: Install sccache for ubuntu-20.04
shell: bash
run: |
LINK=https://github.com/mozilla/sccache/releases/download
SCCACHE_FILE=sccache-${{ inputs.sccache-version }}-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/${{ inputs.sccache-version }}/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Restore sccache
uses: actions/cache@v3
with:
path: /home/runner/.cache/sccache
key: ${{ runner.os }}-sccache-${{ inputs.target-key }}-${{ inputs.cache-version }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sccache-${{ inputs.target-key }}-${{ inputs.cache-version }}
- name: Start sccache server
env:
SCCACHE_CACHE_SIZE: ${{ inputs.sccache-size }}
shell: bash
run: sccache --start-server

- name: Set RUSTC_WRAPPER
shell: bash
run: |
echo "RUSTC_WRAPPER=$HOME/.local/bin/sccache" >> $GITHUB_ENV
- name: Install cargo-cache
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-cache
Loading

0 comments on commit c7996b9

Please sign in to comment.