Update example to the latest #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Static Build | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
tags: | |
# YYYYMMDD | |
- "20[0-9][0-9][0-1][0-9][0-3][0-9]*" | |
schedule: | |
- cron: "0 0 * * 1" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
static-build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- amd | |
- arm | |
steps: | |
- name: Prepare AMD | |
if: ${{ matrix.arch == 'amd' }} | |
run: | | |
echo "TARGET=x86_64-unknown-linux-musl" >> $GITHUB_ENV | |
echo "DEVSHELL=.#crossShell" >> $GITHUB_ENV | |
- name: Prepare ARM | |
if: ${{ matrix.arch == 'arm' }} | |
run: | | |
echo "TARGET=aarch64-unknown-linux-musl" >> $GITHUB_ENV | |
echo "DEVSHELL=.#armCrossShell" >> $GITHUB_ENV | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v23 | |
- uses: cachix/cachix-action@v12 | |
# If PR is from a non-collaborator (e. g. dependabot) the secrets are missing and the login to cachix fails. | |
continue-on-error: true | |
with: | |
name: espresso-systems-private | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
extraPullNames: nix-community | |
- name: Cache cargo | |
uses: actions/cache@v3.3.2 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git | |
target | |
key: espresso-sequencer-static-${{matrix.arch}}-v0-${{ hashFiles('Cargo.lock') }} | |
- name: Fix Git Security Issue | |
run: git config --global --add safe.directory "$PWD" | |
- name: Compile all executables | |
# timeout-minutes: 120 | |
run: | | |
nix develop $DEVSHELL --accept-flake-config --option sandbox relaxed -c cargo build --release | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.TARGET }}-services | |
path: | | |
target/${{ env.TARGET }}/release/example-l2 | |
target/${{ env.TARGET }}/release/cli | |
static-dockers: | |
runs-on: ubuntu-latest | |
needs: static-build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download executables AMD | |
uses: actions/download-artifact@v3 | |
with: | |
name: x86_64-unknown-linux-musl-services | |
path: target/amd64/release | |
- name: Download executables ARM | |
uses: actions/download-artifact@v3 | |
with: | |
name: aarch64-unknown-linux-musl-services | |
path: target/arm64/release | |
- name: Setup Docker BuildKit (buildx) | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Container Repo | |
uses: docker/login-action@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate example rollup metadata | |
uses: docker/metadata-action@v5 | |
id: example-rollup | |
with: | |
images: ghcr.io/espressosystems/espresso-sequencer/example-rollup | |
- name: Build and push example-rollup docker | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./docker/example-rollup.Dockerfile | |
platforms: linux/amd64,arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.example-rollup.outputs.tags }} | |
labels: ${{ steps.example-rollup.outputs.labels }} |