mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 22:43:06 +08:00
chore: update CI
This commit is contained in:
336
.github/workflows/ci.yaml
vendored
336
.github/workflows/ci.yaml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
env:
|
||||
LATEST_RELEASE: ${{ steps.release.outputs.release }}
|
||||
run: |
|
||||
CARGO_VERSION=v$(grep "version" components/clarinet-cli/Cargo.toml | head -n 1 | cut -d\" -f2)
|
||||
CARGO_VERSION=v$(grep "version" components/chainhook-cli/Cargo.toml | head -n 1 | cut -d\" -f2)
|
||||
if [[ "${CARGO_VERSION}" != "${LATEST_RELEASE}" ]]; then
|
||||
echo "::set-output name=TAG::${CARGO_VERSION}"
|
||||
echo "::warning::Will create release for version: ${CARGO_VERSION}"
|
||||
@@ -165,8 +165,8 @@ jobs:
|
||||
# name: ${{ matrix.name }}
|
||||
# verbose: true
|
||||
|
||||
dist_clarinet:
|
||||
name: Build Clarinet Distributions
|
||||
dist_chainhook:
|
||||
name: Build Chainhook Distributions
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: pre_run
|
||||
# Related upstream issue:
|
||||
@@ -270,10 +270,10 @@ jobs:
|
||||
[IO.File]::WriteAllBytes(${certificate_file_name}, ${bytes_cert})
|
||||
|
||||
$signtool_path = ((Resolve-Path -Path "${env:ProgramFiles(x86)}/Windows Kits/10/bin/10*/x86").Path[-1]) + "/signtool.exe"
|
||||
$bin_path = (Resolve-Path -Path "target/${{ matrix.target }}/release/clarinet.exe").Path
|
||||
$bin_path = (Resolve-Path -Path "target/${{ matrix.target }}/release/chainhook.exe").Path
|
||||
& ${signtool_path} sign `
|
||||
/d "Clarinet is a clarity runtime packaged as a command line tool, designed to facilitate smart contract understanding, development, testing and deployment." `
|
||||
/du "https://github.com/hirosystems/clarinet" `
|
||||
/du "https://github.com/hirosystems/chainhook" `
|
||||
/tr http://timestamp.digicert.com `
|
||||
/td sha256 `
|
||||
/fd sha256 `
|
||||
@@ -283,7 +283,7 @@ jobs:
|
||||
|
||||
- name: Build Installer (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: cargo wix -v --no-build --nocapture -p clarinet-cli
|
||||
run: cargo wix -v --no-build --nocapture -p chainhook-cli
|
||||
|
||||
- name: Code sign installer (Windows)
|
||||
if: startsWith(github.ref, 'refs/heads/main') && matrix.os == 'windows-latest'
|
||||
@@ -297,7 +297,7 @@ jobs:
|
||||
$msi_path = (Resolve-Path -Path "target/wix/*.msi").Path
|
||||
& ${signtool_path} sign `
|
||||
/d "Clarinet is a clarity runtime packaged as a command line tool, designed to facilitate smart contract understanding, development, testing and deployment." `
|
||||
/du "https://github.com/hirosystems/clarinet" `
|
||||
/du "https://github.com/hirosystems/chainhook" `
|
||||
/tr http://timestamp.digicert.com `
|
||||
/td sha256 `
|
||||
/fd sha256 `
|
||||
@@ -308,330 +308,53 @@ jobs:
|
||||
# Don't compress for Windows because winget can't yet unzip files
|
||||
- name: Compress cargo artifact (Linux)
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: tar -C target/${{ matrix.target }}/release -zcvf clarinet-${{ env.SHORT_TARGET_NAME }}.tar.gz clarinet
|
||||
run: tar -C target/${{ matrix.target }}/release -zcvf chainhook-${{ env.SHORT_TARGET_NAME }}.tar.gz chainhook
|
||||
|
||||
- name: Rename cargo artifact (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
shell: bash
|
||||
run: mv target/wix/*.msi clarinet-${{ env.SHORT_TARGET_NAME }}.msi
|
||||
run: mv target/wix/*.msi chainhook-${{ env.SHORT_TARGET_NAME }}.msi
|
||||
|
||||
# Separate uploads to prevent paths from being preserved
|
||||
- name: Upload cargo artifacts (Linux)
|
||||
if: matrix.os != 'windows-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: clarinet-${{ env.SHORT_TARGET_NAME }}
|
||||
path: clarinet-${{ env.SHORT_TARGET_NAME }}.tar.gz
|
||||
name: chainhook-${{ env.SHORT_TARGET_NAME }}
|
||||
path: chainhook-${{ env.SHORT_TARGET_NAME }}.tar.gz
|
||||
|
||||
- name: Upload cargo artifact (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: clarinet-${{ env.SHORT_TARGET_NAME }}
|
||||
path: clarinet-${{ env.SHORT_TARGET_NAME }}.msi
|
||||
name: chainhook-${{ env.SHORT_TARGET_NAME }}
|
||||
path: chainhook-${{ env.SHORT_TARGET_NAME }}.msi
|
||||
|
||||
- name: Unit Tests - Cargo
|
||||
# can't easily run mac-arm64 tests in GH without native runners for that arch
|
||||
if: matrix.target != 'aarch64-apple-darwin'
|
||||
run: cargo test --release --locked --target ${{ matrix.target }}
|
||||
|
||||
- name: Functional Tests (Linux)
|
||||
# can't easily run mac-arm64 tests in GH without native runners for that arch
|
||||
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin'
|
||||
run: |
|
||||
for testdir in $(ls components/clarinet-cli/examples); do
|
||||
./target/${{ matrix.target }}/release/clarinet test --manifest-path components/clarinet-cli/examples/${testdir}/Clarinet.toml
|
||||
done
|
||||
# - name: Functional Tests (Linux)
|
||||
# # can't easily run mac-arm64 tests in GH without native runners for that arch
|
||||
# if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin'
|
||||
# run: |
|
||||
# for testdir in $(ls components/chainhook-cli/examples); do
|
||||
# ./target/${{ matrix.target }}/release/clarinet test --manifest-path components/clarinet-cli/examples/${testdir}/Clarinet.toml
|
||||
# done
|
||||
|
||||
- name: Functional Tests (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
foreach($testdir in Get-ChildItem components/clarinet-cli/examples) {
|
||||
./target/${{ matrix.target }}/release/clarinet test --manifest-path ${testdir}/Clarinet.toml
|
||||
}
|
||||
|
||||
dist_stacks_devnet_js:
|
||||
name: Build Stacks Devnet JS Distributions
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs:
|
||||
- pre_run
|
||||
- get_release_info
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
platform: linux
|
||||
target: x86_64-unknown-linux-gnu
|
||||
architecture: x64
|
||||
libc: glibc
|
||||
- os: windows-latest
|
||||
platform: windows
|
||||
target: x86_64-pc-windows-msvc
|
||||
architecture: x64
|
||||
- os: macos-latest
|
||||
platform: darwin
|
||||
target: x86_64-apple-darwin
|
||||
architecture: x64
|
||||
- os: macos-latest
|
||||
platform: darwin
|
||||
target: aarch64-apple-darwin
|
||||
architecture: arm64
|
||||
- os: ubuntu-latest
|
||||
platform: linux
|
||||
target: x86_64-unknown-linux-musl
|
||||
architecture: x64
|
||||
libc: musl
|
||||
|
||||
steps:
|
||||
- name: Configure git to use LF (Windows)
|
||||
if: matrix.os == 'windows-latest' && github.event_name != 'pull_request'
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
|
||||
- name: Checkout repository
|
||||
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Rust toolchain
|
||||
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: ${{ matrix.target }}
|
||||
profile: minimal
|
||||
components: llvm-tools-preview
|
||||
override: true
|
||||
|
||||
- name: Install and cache Node
|
||||
if: github.event_name != 'pull_request' && matrix.target != 'x86_64-unknown-linux-musl'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
# Host nodejs arch does not matter in our usecase for compiling cross-platform npm packages,
|
||||
# if enabled, this will fail after installing an arm64 nodejs runtime for an x86_64 arch macos system
|
||||
# architecture: ${{ matrix.architecture }}
|
||||
cache: npm
|
||||
cache-dependency-path: components/stacks-devnet-js/package-lock.json
|
||||
|
||||
- name: Cache cargo
|
||||
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/${{ matrix.target }}/release/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
# Set environment variables required from cross compiling from macos-x86_64 to macos-arm64
|
||||
- name: Configure macos-arm64 cross compile config
|
||||
if: github.event_name != 'pull_request' && matrix.target == 'aarch64-apple-darwin'
|
||||
run: |
|
||||
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
|
||||
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure artifact names (libc)
|
||||
if: (github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu') && matrix.libc
|
||||
shell: bash
|
||||
run: |
|
||||
echo "SHORT_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-${{ matrix.libc }}" >> $GITHUB_ENV
|
||||
echo "PRE_GYP_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-${{ matrix.libc }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure artifact names (not libc)
|
||||
if: github.event_name != 'pull_request' && ! matrix.libc
|
||||
shell: bash
|
||||
run: |
|
||||
echo "SHORT_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}" >> $GITHUB_ENV
|
||||
echo "PRE_GYP_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-unknown" >> $GITHUB_ENV
|
||||
|
||||
- name: Build - Node
|
||||
if: (github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu') && matrix.target != 'x86_64-unknown-linux-musl'
|
||||
working-directory: components/stacks-devnet-js
|
||||
run: |
|
||||
npm install --ignore-scripts
|
||||
npm run build-${{ env.SHORT_TARGET_NAME }}
|
||||
|
||||
- name: Build - Node (linux-musl)
|
||||
if: github.event_name != 'pull_request' && matrix.target == 'x86_64-unknown-linux-musl'
|
||||
uses: docker://rust:alpine3.15
|
||||
env:
|
||||
RUSTFLAGS: -C target-feature=-crt-static
|
||||
with:
|
||||
entrypoint: /bin/sh
|
||||
args: -c "
|
||||
cd components/stacks-devnet-js &&
|
||||
apk add alpine-sdk nodejs npm git &&
|
||||
npm install --ignore-scripts &&
|
||||
npm run build-${{ env.SHORT_TARGET_NAME }}"
|
||||
|
||||
- name: Compress node artifact
|
||||
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
shell: bash
|
||||
run: tar -C components/stacks-devnet-js -zcvf stacks-devnet-js-${{ env.PRE_GYP_TARGET_NAME }}.tar.gz native/index.node
|
||||
|
||||
- name: Upload node artifact
|
||||
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: stacks-devnet-js-${{ env.PRE_GYP_TARGET_NAME }}
|
||||
path: stacks-devnet-js-${{ env.PRE_GYP_TARGET_NAME }}.tar.gz
|
||||
|
||||
# - name: Unit Tests - Node
|
||||
# working-directory: node-bindings
|
||||
# run: npm run spec
|
||||
|
||||
- name: NPM Publish
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.ref, 'refs/heads/main') && needs.get_release_info.outputs.tag != ''
|
||||
with:
|
||||
package: components/stacks-devnet-js/package.json
|
||||
access: public
|
||||
greater-version-only: true
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
dist_chainhook_node:
|
||||
name: Build Chainhook node Distribution
|
||||
runs-on: ubuntu-latest
|
||||
needs: pre_run
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
profile: minimal
|
||||
components: llvm-tools-preview
|
||||
override: true
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/x86_64-unknown-linux-gnu/release/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Configure artifact names
|
||||
shell: bash
|
||||
run: |
|
||||
echo "SHORT_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV
|
||||
echo "PRE_GYP_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV
|
||||
|
||||
- name: Build - Cargo
|
||||
working-directory: components/chainhook-cli
|
||||
run: cargo build --release --locked --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Compress cargo artifact
|
||||
run: tar -C target/x86_64-unknown-linux-gnu/release -zcvf chainhook-cli-${{ env.SHORT_TARGET_NAME }}.tar.gz chainhook-cli
|
||||
|
||||
- name: Upload cargo artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: chainhook-cli-${{ env.SHORT_TARGET_NAME }}
|
||||
path: chainhook-cli-${{ env.SHORT_TARGET_NAME }}.tar.gz
|
||||
|
||||
- name: Unit Tests - Cargo
|
||||
run: cargo test --release --locked --target x86_64-unknown-linux-gnu
|
||||
|
||||
dist_clarity_repl:
|
||||
name: Build Clarity REPL Distribution
|
||||
runs-on: ubuntu-latest
|
||||
needs: pre_run
|
||||
defaults:
|
||||
run:
|
||||
working-directory: components/clarity-repl
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
profile: minimal
|
||||
components: llvm-tools-preview
|
||||
override: true
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/x86_64-unknown-linux-gnu/release/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Configure artifact names
|
||||
run: |
|
||||
echo "SHORT_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV
|
||||
echo "PRE_GYP_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV
|
||||
|
||||
- name: Install dependencies
|
||||
run: cargo install --force wasm-pack
|
||||
|
||||
- name: Build - Cargo
|
||||
run: cargo build --release --locked --target x86_64-unknown-linux-gnu
|
||||
|
||||
# - name: Build - WASM
|
||||
# run: wasm-pack build --target web --release -- --no-default-features --features wasm
|
||||
|
||||
- name: Compress cargo artifact
|
||||
working-directory: "."
|
||||
run: tar -C target/x86_64-unknown-linux-gnu/release -zcvf clarity-repl-${{ env.SHORT_TARGET_NAME }}.tar.gz clarity-repl
|
||||
|
||||
# - name: Compress wasm artifact
|
||||
# working-directory: "."
|
||||
# run: tar -C target/wasm32-unknown-unknown/release -zcvf clarity-repl-wasm.tar.gz clarity_repl.wasm
|
||||
|
||||
- name: Upload cargo artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: clarity-repl-${{ env.SHORT_TARGET_NAME }}
|
||||
path: clarity-repl-${{ env.SHORT_TARGET_NAME }}.tar.gz
|
||||
|
||||
# - name: Upload wasm artifact
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: clarity-repl-wasm
|
||||
# path: clarity-repl-wasm.tar.gz
|
||||
|
||||
- name: Unit Tests - Cargo
|
||||
run: cargo test --release --locked --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Publish clarity-repl to crates.io
|
||||
if: startsWith(github.ref, 'refs/heads/main') && needs.get_release_info.outputs.tag != ''
|
||||
run: |
|
||||
cargo login ${{ secrets.CARGO_CRATES_IO_API_KEY }}
|
||||
cargo publish
|
||||
# - name: Functional Tests (Windows)
|
||||
# if: matrix.os == 'windows-latest'
|
||||
# run: |
|
||||
# foreach($testdir in Get-ChildItem components/clarinet-cli/examples) {
|
||||
# ./target/${{ matrix.target }}/release/clarinet test --manifest-path ${testdir}/Clarinet.toml
|
||||
# }
|
||||
|
||||
docker_images:
|
||||
name: Create ${{ matrix.name }} Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- get_release_info
|
||||
- dist_clarinet
|
||||
- dist_chainhook_node
|
||||
outputs:
|
||||
version: ${{ steps.docker_meta.outputs.version }}
|
||||
@@ -639,11 +362,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Clarinet
|
||||
description: Clarinet is a simple, modern and opinionated runtime for testing, integrating and deploying Clarity smart contracts.
|
||||
image: ${{ github.repository }}
|
||||
artifact: clarinet-linux-x64-glibc
|
||||
dockerfile: dockerfiles/components/clarinet.dockerfile
|
||||
- name: Chainhook Node
|
||||
description: A Stacks event observer.
|
||||
image: ${{ github.repository_owner }}/chainhook-cli
|
||||
@@ -701,8 +419,6 @@ jobs:
|
||||
- get_release_info
|
||||
- audit
|
||||
# - test_coverage_cargo
|
||||
- dist_stacks_devnet_js
|
||||
- dist_clarity_repl
|
||||
- docker_images
|
||||
permissions:
|
||||
actions: write
|
||||
|
||||
Reference in New Issue
Block a user