Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add build-test-release workflow for Rust #132

Merged
merged 8 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
82 changes: 66 additions & 16 deletions .github/workflows/release-rust-crates.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,82 @@
# We really only want to publish the eip7594 crate
# However, crates.io forces us to publish its dependencies too.
name: Publish rust crates
name: Rust Package

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
ref:
description: The reference (branch/tag/commit) to checkout
required: true
description: 'The reference (branch/tag/commit) to checkout'
required: false
release-type:
type: choice
required: false
default: 'none'
description: 'Indicates whether we want to make a release and if which one'
options:
- release
- none

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: linux-arm64
- target: x86_64-apple-darwin
os: macos-13
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-pc-windows-gnu
os: windows-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.target }}

- name: Build
run: cargo build --target ${{ matrix.target }} --verbose

# See issue 133 as to why windows is running on a single thread
- name: Run tests (Windows)
if: matrix.target == 'x86_64-pc-windows-gnu'
run: cargo test --target ${{ matrix.target }} -- --test-threads=1

- name: Run tests
if: matrix.target != 'x86_64-pc-windows-gnu'
run: cargo test --target ${{ matrix.target }}

# We really only want to publish the eip7594 crate
# However, crates.io forces us to publish its dependencies too.
publish:
name: Publish in order
needs: build-and-test
if: ${{ inputs.release-type != 'none' && github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
ref: ${{ inputs.ref || github.ref }}

- name: Setup toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -30,31 +85,26 @@ jobs:

# These steps are in a specific order so crate dependencies are updated first
- name: Publish bls12_381
run: |
cargo publish --package crate_crypto_internal_eth_kzg_bls12_381
run: cargo publish --package crate_crypto_internal_eth_kzg_bls12_381
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_RELEASE_TOKEN }}

- name: Publish polynomial
run: |
cargo publish --package crate_crypto_internal_eth_kzg_polynomial
run: cargo publish --package crate_crypto_internal_eth_kzg_polynomial
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_RELEASE_TOKEN }}

- name: Publish erasure_codes
run: |
cargo publish --package crate_crypto_internal_eth_kzg_erasure_codes
run: cargo publish --package crate_crypto_internal_eth_kzg_erasure_codes
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_RELEASE_TOKEN }}

- name: Publish kzg_multi_open
run: |
cargo publish --package crate_crypto_kzg_multi_open_fk20
run: cargo publish --package crate_crypto_kzg_multi_open_fk20
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_RELEASE_TOKEN }}

- name: Publish eip7594
run: |
cargo publish --package eip7594
run: cargo publish --package eip7594
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_RELEASE_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
with:
workflow: release-rust-crates.yml
ref: master
inputs: '{ "ref": "${{ needs.release-please.outputs.tag-name }}" }'
inputs: '{ "ref": "${{ needs.release-please.outputs.tag-name }}", "release-type": "release" }'
token: ${{ secrets.RELEASE_TOKEN }}

publish-node-bindings:
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/test-rust.yml

This file was deleted.

Loading