feat: ci releases (#36)
* add simple release ci for mac arm * install arm target * run mac build on macos-latest * archive file * fix file paths * use tag names * add amd darwin build * fix typo * add linux arm build * add linux amd build * fix linux arm * install libssl for linux arm * set linker * install pkg-config * fix openssl * use cross * fix cross * fix cross * . * . * add deps * . * . * use vendored openssl * remove cross * deps * push to tags * use commit as tag name * tag with correct name and use pre release * fix tag names * only maual dispatch
This commit is contained in:
parent
17301ec409
commit
7bb9800447
|
@ -1,186 +1,159 @@
|
||||||
# https://github.com/lightclient-rs/foundry/blob/master/.github/workflows/release.yml
|
name: release
|
||||||
name: Release version
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prepare:
|
build-mac-arm:
|
||||||
name: Prepare release
|
runs-on: macos-latest
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
tag_name: ${{ steps.release_info.outputs.tag_name }}
|
|
||||||
release_name: ${{ steps.release_info.outputs.release_name }}
|
|
||||||
changelog: ${{ steps.build_changelog.outputs.changelog }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v1
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Compute release name and tag
|
- name: install rust nightly
|
||||||
id: release_info
|
|
||||||
run: |
|
|
||||||
if [[ $IS_NIGHTLY ]]; then
|
|
||||||
echo "::set-output name=tag_name::nightly-${GITHUB_SHA}"
|
|
||||||
echo "::set-output name=release_name::Nightly ($(date '+%Y-%m-%d'))"
|
|
||||||
else
|
|
||||||
echo "::set-output name=tag_name::${GITHUB_REF_NAME}"
|
|
||||||
echo "::set-output name=release_name::${GITHUB_REF_NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
|
|
||||||
runs-on: ${{ matrix.job.os }}
|
|
||||||
needs: prepare
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
job:
|
|
||||||
# The OS is used for the runner
|
|
||||||
# The platform is a generic platform name
|
|
||||||
# The target is used by Cargo
|
|
||||||
# The arch is either 386, arm64 or amd64
|
|
||||||
# The svm target platform to use for the binary https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24
|
|
||||||
- os: ubuntu-latest
|
|
||||||
platform: linux
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
arch: amd64
|
|
||||||
svm_target_platform: linux-amd64
|
|
||||||
- os: ubuntu-latest
|
|
||||||
platform: linux
|
|
||||||
target: aarch64-unknown-linux-gnu
|
|
||||||
arch: arm64
|
|
||||||
svm_target_platform: linux-aarch64
|
|
||||||
- os: macos-latest
|
|
||||||
platform: darwin
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
arch: amd64
|
|
||||||
svm_target_platform: macosx-amd64
|
|
||||||
- os: macos-latest
|
|
||||||
platform: darwin
|
|
||||||
target: aarch64-apple-darwin
|
|
||||||
arch: arm64
|
|
||||||
svm_target_platform: macosx-aarch64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Install toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
target: ${{ matrix.job.target }}
|
default: true
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v1
|
- name: install target
|
||||||
with:
|
run: rustup target add aarch64-apple-darwin
|
||||||
cache-on-failure: true
|
|
||||||
|
|
||||||
- name: Apple M1 setup
|
- name: build
|
||||||
if: ${{ matrix.job.target == 'aarch64-apple-darwin' }}
|
run: cargo build --all --release --target aarch64-apple-darwin
|
||||||
|
|
||||||
|
- name: archive
|
||||||
|
run: gtar -czvf "lightclient_darwin_arm64.tar.gz" -C ./target/aarch64-apple-darwin/release lightclient
|
||||||
|
|
||||||
|
- name: generate tag name
|
||||||
|
id: tag
|
||||||
run: |
|
run: |
|
||||||
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
|
echo "::set-output name=release_tag::nightly-${GITHUB_SHA}"
|
||||||
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
|
|
||||||
- name: Linux ARM setup
|
- name: release
|
||||||
if: ${{ matrix.job.target == 'aarch64-unknown-linux-gnu' }}
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.tag.outputs.release_tag }}
|
||||||
|
prerelease: true
|
||||||
|
files: |
|
||||||
|
lightclient_darwin_arm64.tar.gz
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
build-mac-amd:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: install rust nightly
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
default: true
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: install target
|
||||||
|
run: rustup target add x86_64-apple-darwin
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: cargo build --all --release --target x86_64-apple-darwin
|
||||||
|
|
||||||
|
- name: archive
|
||||||
|
run: gtar -czvf "lightclient_darwin_amd64.tar.gz" -C ./target/x86_64-apple-darwin/release lightclient
|
||||||
|
|
||||||
|
- name: generate tag name
|
||||||
|
id: tag
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=release_tag::nightly-${GITHUB_SHA}"
|
||||||
|
|
||||||
|
- name: release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.tag.outputs.release_tag }}
|
||||||
|
prerelease: true
|
||||||
|
files: |
|
||||||
|
lightclient_darwin_amd64.tar.gz
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
build-linux-arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: install rust nightly
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
default: true
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: install target
|
||||||
|
run: rustup target add aarch64-unknown-linux-gnu
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||||
- name: Build binaries
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
env:
|
|
||||||
SVM_TARGET_PLATFORM: ${{ matrix.job.svm_target_platform }}
|
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
args: --release --bins --target ${{ matrix.job.target }}
|
|
||||||
|
|
||||||
- name: Archive binaries
|
- name: build
|
||||||
id: artifacts
|
run: cargo build --all --release --target aarch64-unknown-linux-gnu
|
||||||
env:
|
|
||||||
PLATFORM_NAME: ${{ matrix.job.platform }}
|
- name: archive
|
||||||
TARGET: ${{ matrix.job.target }}
|
run: tar -czvf "lightclient_linux_arm64.tar.gz" -C ./target/aarch64-unknown-linux-gnu/release lightclient
|
||||||
ARCH: ${{ matrix.job.arch }}
|
|
||||||
VERSION_NAME: ${{ (env.IS_NIGHTLY && 'nightly') || needs.prepare.outputs.tag_name }}
|
- name: generate tag name
|
||||||
|
id: tag
|
||||||
run: |
|
run: |
|
||||||
if [ "$PLATFORM_NAME" == "linux" ]; then
|
echo "::set-output name=release_tag::nightly-${GITHUB_SHA}"
|
||||||
tar -czvf "lightclient_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release lightclient
|
|
||||||
echo "::set-output name=file_name::lightclient_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz"
|
|
||||||
elif [ "$PLATFORM_NAME" == "darwin" ]; then
|
|
||||||
# We need to use gtar here otherwise the archive is corrupt.
|
|
||||||
# See: https://github.com/actions/virtual-environments/issues/2619
|
|
||||||
gtar -czvf "lightclient_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release lightclient
|
|
||||||
echo "::set-output name=file_name::lightclient_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz"
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Build man page
|
- name: release
|
||||||
id: man
|
|
||||||
if: ${{ matrix.job.target == 'x86_64-unknown-linux-gnu' }}
|
|
||||||
env:
|
|
||||||
PLATFORM_NAME: ${{ matrix.job.platform }}
|
|
||||||
TARGET: ${{ matrix.job.target }}
|
|
||||||
VERSION_NAME: ${{ (env.IS_NIGHTLY && 'nightly') || needs.prepare.outputs.tag_name }}
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y install help2man
|
|
||||||
help2man -N ./target/${TARGET}/release/lightclient > lightclient.1
|
|
||||||
gzip lightclient.1
|
|
||||||
tar -czvf "lightclient_man_${VERSION_NAME}.tar.gz" lightclient.1.gz
|
|
||||||
echo "::set-output name=lightclient_man::lightclient_man_${VERSION_NAME}.tar.gz"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
# Creates the release for this specific version
|
|
||||||
- name: Create release
|
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
name: ${{ needs.prepare.outputs.release_name }}
|
tag_name: ${{ steps.tag.outputs.release_tag }}
|
||||||
tag_name: ${{ needs.prepare.outputs.tag_name }}
|
|
||||||
prerelease: ${{ env.IS_NIGHTLY }}
|
|
||||||
body: ${{ needs.prepare.outputs.changelog }}
|
|
||||||
files: |
|
|
||||||
${{ steps.artifacts.outputs.file_name }}
|
|
||||||
${{ steps.man.outputs.lightclient_man }}
|
|
||||||
# If this is a nightly release, it also updates the release
|
|
||||||
# tagged `nightly` for compatability with `lightclientup`
|
|
||||||
- name: Update nightly release
|
|
||||||
if: ${{ env.IS_NIGHTLY }}
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
name: 'Nightly'
|
|
||||||
tag_name: 'nightly'
|
|
||||||
prerelease: true
|
prerelease: true
|
||||||
body: ${{ needs.prepare.outputs.changelog }}
|
|
||||||
files: |
|
files: |
|
||||||
${{ steps.artifacts.outputs.file_name }}
|
lightclient_linux_arm64.tar.gz
|
||||||
${{ steps.man.outputs.lightclient_man }}
|
env:
|
||||||
cleanup:
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
name: Release cleanup
|
|
||||||
|
build-linux-amd:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: release
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
# Moves the `nightly` tag to `HEAD`
|
- name: install rust nightly
|
||||||
- name: Move nightly tag
|
uses: actions-rs/toolchain@v1
|
||||||
if: ${{ env.IS_NIGHTLY }}
|
|
||||||
uses: actions/github-script@v5
|
|
||||||
with:
|
with:
|
||||||
script: |
|
toolchain: nightly
|
||||||
const moveTag = require('./.github/scripts/move-tag.js')
|
default: true
|
||||||
await moveTag({ github, context }, 'nightly')
|
override: true
|
||||||
- name: Delete old nightlies
|
|
||||||
uses: actions/github-script@v5
|
- name: install target
|
||||||
|
run: rustup target add x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
run: cargo build --all --release --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
- name: archive
|
||||||
|
run: tar -czvf "lightclient_linux_amd64.tar.gz" -C ./target/x86_64-unknown-linux-gnu/release lightclient
|
||||||
|
|
||||||
|
- name: generate tag name
|
||||||
|
id: tag
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=release_tag::nightly-${GITHUB_SHA}"
|
||||||
|
|
||||||
|
- name: release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
script: |
|
tag_name: ${{ steps.tag.outputs.release_tag }}
|
||||||
const prunePrereleases = require('./.github/scripts/prune-prereleases.js')
|
prerelease: true
|
||||||
await prunePrereleases({github, context})
|
files: |
|
||||||
|
lightclient_linux_amd64.tar.gz
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: Rust
|
name: test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -8,7 +8,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
name: Check
|
name: check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -22,7 +22,7 @@ jobs:
|
||||||
command: check
|
command: check
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test Suite
|
name: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -36,7 +36,7 @@ jobs:
|
||||||
command: test
|
command: test
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
name: Rustfmt
|
name: fmt
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
|
@ -437,6 +437,7 @@ dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"jsonrpsee",
|
"jsonrpsee",
|
||||||
"log",
|
"log",
|
||||||
|
"openssl",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"revm",
|
"revm",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -2169,6 +2170,15 @@ version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-src"
|
||||||
|
version = "111.22.0+1.1.1q"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.75"
|
version = "0.9.75"
|
||||||
|
@ -2178,6 +2188,7 @@ dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
"openssl-src",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
|
@ -20,6 +20,7 @@ bytes = "1.2.1"
|
||||||
futures = "0.3.23"
|
futures = "0.3.23"
|
||||||
toml = "0.5.9"
|
toml = "0.5.9"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
|
openssl = { version = "0.10", features = ["vendored"] }
|
||||||
|
|
||||||
common = { path = "../common" }
|
common = { path = "../common" }
|
||||||
consensus = { path = "../consensus" }
|
consensus = { path = "../consensus" }
|
||||||
|
|
|
@ -12,3 +12,4 @@ hex = "0.4.3"
|
||||||
ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs" }
|
ssz-rs = { git = "https://github.com/ralexstokes/ssz-rs" }
|
||||||
ethers = "0.17.0"
|
ethers = "0.17.0"
|
||||||
toml = "0.5.9"
|
toml = "0.5.9"
|
||||||
|
openssl = { version = "0.10", features = ["vendored"] }
|
||||||
|
|
|
@ -23,6 +23,7 @@ toml = "0.5.9"
|
||||||
async-trait = "0.1.57"
|
async-trait = "0.1.57"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
chrono = "0.4.22"
|
chrono = "0.4.22"
|
||||||
|
openssl = { version = "0.10", features = ["vendored"] }
|
||||||
|
|
||||||
common = { path = "../common" }
|
common = { path = "../common" }
|
||||||
config = { path = "../config" }
|
config = { path = "../config" }
|
||||||
|
|
|
@ -22,6 +22,7 @@ futures = "0.3.23"
|
||||||
toml = "0.5.9"
|
toml = "0.5.9"
|
||||||
triehash-ethereum = { git = "https://github.com/openethereum/parity-ethereum" }
|
triehash-ethereum = { git = "https://github.com/openethereum/parity-ethereum" }
|
||||||
async-trait = "0.1.57"
|
async-trait = "0.1.57"
|
||||||
|
openssl = { version = "0.10", features = ["vendored"] }
|
||||||
|
|
||||||
common = { path = "../common" }
|
common = { path = "../common" }
|
||||||
consensus = { path = "../consensus" }
|
consensus = { path = "../consensus" }
|
||||||
|
|
Loading…
Reference in New Issue