Skip to content

Release to dev

Release to dev #26

Workflow file for this run

name: Release to dev
on:
push:
branches:
- 'dev'
workflow_dispatch:
env:
PROFILE: release
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: /home/runner/.cache/sccache
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out
jobs:
build:
runs-on: ubuntu-latest
concurrency: dev
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-10-09
profile: minimal
override: true
components: rustfmt, clippy
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Save sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sccache-
- name: Lint
run: cargo fmt --all -- --check
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.15.8"
- name: Start sccache server
run: sccache --start-server
- name: Build
run: cargo build --release
- name: Stop sccache server
run: sccache --stop-server || true
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}:role/github
role-session-name: ${{ github.event.repository.name }}
aws-region: us-west-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Get short SHA
run: |
echo GITHUB_SHA=${GITHUB_SHA:0:7} >> $GITHUB_ENV
- name: Build and push docker image to ECR
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile-new
push: true
no-cache: true
tags: |
${{ steps.login-ecr.outputs.registry }}/pos-network-node:${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/pos-network-node:dev-latest
- name: Upload cere-runtime wasm artifact
uses: actions/upload-artifact@v3
with:
name: cere_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm
path: target/${{ vars.PROFILE }}/wbuild/cere-runtime/cere_runtime.compact.compressed.wasm
- name: Upload cere-dev-runtime wasm artifact
uses: actions/upload-artifact@v3
with:
name: cere_dev_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm
path: target/${{ vars.PROFILE }}/wbuild/cere-dev-runtime/cere_dev_runtime.compact.compressed.wasm