Skip to content

Commit

Permalink
ci: move to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman authored and juped committed Jul 27, 2022
1 parent a62200d commit c8994d2
Show file tree
Hide file tree
Showing 40 changed files with 1,669 additions and 465 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/ci/222-new-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- New CI using Github Actions
([#222](https://github.com/anoma/namada/pull/222))
3 changes: 3 additions & 0 deletions .changelog/unreleased/improvements/1202-expectrl-logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Better logging for end-to-end tests, and logs are
stored to disk in the test's temporary working directory
([#1202](https://github.com/anoma/anoma/pull/1202))
3 changes: 3 additions & 0 deletions .changelog/unreleased/improvements/1239-hide-tm-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Hidden the stdout of Tendermint process by default. To include
it in the node's output, run with `ANOMA_TM_STDOUT=true`
([#1239](https://github.com/anoma/anoma/pull/1239))
45 changes: 45 additions & 0 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Automation Tasks

on:
issue_comment:
types: [created]

permissions:
id-token: write
contents: write

env:
GIT_LFS_SKIP_SMUDGE: 1

jobs:
tasks:
if: ${{ github.event.issue.pull_request }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
command: [publish-wasm.py, update-wasm.py]

steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- uses: xt0rted/pull-request-comment-branch@v1
id: comment-branch
- uses: actions/checkout@v3
if: success()
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- name: Run task
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_READ_ORG_TOKEN: ${{ secrets.GT_READ_ORG }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
pip3 install ghapi >/dev/null 2>&1
python3 .github/workflows/scripts/${{ matrix.command }}
295 changes: 295 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
name: Build and Test

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
id-token: write
contents: read

env:
GIT_LFS_SKIP_SMUDGE: 1


jobs:
build-wasm:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
container:
image: ghcr.io/fraccaman/namada:wasm-0.6.1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
wasm_cache_version: ["v1"]

steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Show rust toolchain info
run: rustup show
- name: Build WASM
run: cp wasm/checksums.json wasm/original-checksums.json && make build-wasm-scripts
- name: Upload wasm artifacts
uses: actions/upload-artifact@v3
with:
name: wasm-${{ github.sha }}
path: |
wasm/tx_*.wasm
wasm/vp_*.wasm
wasm/checksums.json
- name: Test Wasm
run: make test-wasm
- name: Check wasm up-to-date
run: cmp -- wasm/checksums.json wasm/original-checksums.json
- name: Print diff
if: failure()
run: diff -y -W 150 wasm/checksums.json wasm/original-checksums.json --suppress-common-lines

update-wasm:
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.build-wasm.result == 'success' }}
timeout-minutes: 30
needs: [build-wasm]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]

steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Download wasm artifacts
uses: actions/download-artifact@v3
with:
name: wasm-${{ github.sha }}
path: ./wasm
- name: Update WASM
run: aws s3 sync wasm s3://$BUCKET_NAME --acl public-read --exclude "*" --include "*.wasm" --exclude "*/*" --region $AWS_REGION
env:
BUCKET_NAME: namada-wasm-master
AWS_REGION: eu-west-1

anoma:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
nightly_version: [nightly-2022-05-20]
make:
- name: ABCI
suffix: ''
cache_key: anoma
cache_version: v1
wait_for: anoma-release (ubuntu-latest, ABCI Release build, anoma-e2e-release, v1)
tendermint_artifact: tendermint-unreleased-29e5fbcc648510e4763bd0af0b461aed92c21f30

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 100G
SCCACHE_BUCKET: namada-sccache-master

steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Install sccache (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.0
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$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: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install sccache
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
profile: default
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-
- name: Start sccache server
run: sccache --start-server
- name: Build
run: make build${{ matrix.make.suffix }}
- name: Build test
run: make build-test${{ matrix.make.suffix }}
- name: Download wasm artifacts
uses: actions/download-artifact@v3
with:
name: wasm-${{ github.sha }}
path: ./wasm
- name: Run unit test
run: make test-unit${{ matrix.make.suffix }}
- name: Wait for release binaries
uses: lewagon/wait-on-check-action@master
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
check-name: ${{ matrix.make.wait_for }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30
allowed-conclusions: success
- name: Download tendermint binaries
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: build-tendermint.yml
workflow_conclusion: success
name: ${{ matrix.make.tendermint_artifact }}
path: /usr/local/bin
- name: Download anoma binaries
uses: actions/download-artifact@v3
with:
name: binaries${{ matrix.make.suffix }}-${{ github.sha }}
path: ./target/release/
- name: Change permissions
run: |
chmod +x target/release/namada
chmod +x target/release/namadaw
chmod +x target/release/namadan
chmod +x target/release/namadac
chmod +x /usr/local/bin/tendermint
- name: Set tendermint ENV for abci++ tests
run: echo "TENDERMINT=/usr/local/bin/tendermint" >> $GITHUB_ENV
- name: Run e2e test
run: make test-e2e${{ matrix.make.suffix }}
env:
ANOMA_TENDERMINT_WEBSOCKET_TIMEOUT: 20
ANOMA_E2E_USE_PREBUILT_BINARIES: "true"
ANOMA_E2E_KEEP_TEMP: "true"
ENV_VAR_TM_STDOUT: "false"
ANOMA_LOG_COLOR: "false"
TM_LOG_LEVEL: "info"
ANOMA_LOG: "info"
- name: Upload e2e logs
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: logs-e2e${{ matrix.make.suffix }}-${{ github.sha }}
path: /tmp/.*/logs/
retention-days: 5
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true

anoma-release:
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
make:
- name: ABCI Release build
suffix: ''
cache_key: anoma-e2e-release
cache_version: "v1"

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 100G
SCCACHE_BUCKET: namada-sccache-master

steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::375643557360:role/anoma-github-action-ci-master
aws-region: eu-west-1
- name: Install sccache (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.3.0
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$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: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install sccache
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
profile: default
override: true
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.make.cache_key }}-${{ matrix.make.cache_version }}-cargo-
- name: Start sccache server
run: sccache --start-server
- name: Build
run: make build-release${{ matrix.make.suffix }}
- name: Upload target binaries
uses: actions/upload-artifact@v3
with:
name: binaries${{ matrix.make.suffix }}-${{ github.sha }}
path: |
target/release/namada
target/release/namadac
target/release/namadaw
target/release/namadan
- name: Print sccache stats
if: always()
run: sccache --show-stats
- name: Stop sccache server
if: always()
run: sccache --stop-server || true
40 changes: 40 additions & 0 deletions .github/workflows/build-tendermint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build tendermint binaries

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

permissions:
id-token: write
contents: read

env:
GIT_LFS_SKIP_SMUDGE: 1


jobs:
tendermint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
make:
- name: tendermint-0.34.19
tendermint_version: 2f231ceb952a2426cf3c0abaf0b455aadd11e5b2
- name: tendermint-unreleased
tendermint_version: 29e5fbcc648510e4763bd0af0b461aed92c21f30
- name: tendermint-0.34.11
tendermint_version: c2908ef785bb5ca6e015910368e4b7a32821b9ff

steps:
- name: Build ${{ matrix.make.name }}
run: |
git clone https://github.com/tendermint/tendermint.git && cd tendermint
git checkout ${{ matrix.make.tendermint_version }} && make build
- name: Upload ${{ matrix.make.name }} binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.make.name }}-${{ matrix.make.tendermint_version }}
path: tendermint/build/tendermint
Loading

0 comments on commit c8994d2

Please sign in to comment.