Skip to content

Create Covector release (wallet) #24

Create Covector release (wallet)

Create Covector release (wallet) #24

name: Create Covector release (wallet)
on: workflow_dispatch
env:
CARGO_INCREMENTAL: 0
jobs:
version-or-publish:
runs-on: ubuntu-20.04
outputs:
change: ${{ steps.covector.outputs.change }}
commandRan: ${{ steps.covector.outputs.commandRan }}
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install Dasel
run: |
brew update --preinstall
brew install dasel
- name: covector version or publish (publish when no change files present)
uses: jbolda/covector/packages/action@covector-v0
id: covector
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: "version-or-publish"
- name: Create Pull Request With Versions Bumped
if: steps.covector.outputs.commandRan == 'version'
uses: tauri-apps/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/version-updates
title: Apply Version Updates From Current Changes
commit-message: "apply version updates"
labels: "i-release"
body: ${{ steps.covector.outputs.change }}
nodejs-binding-prebuild:
runs-on: ${{ matrix.os }}
needs: version-or-publish
if: needs.version-or-publish.outputs.successfulPublish == 'true'
strategy:
fail-fast: false
matrix:
# The GitHub hosted Windows 2022 image comes with Visual Studio 2022, but node-gyp
# (which is used by neon-sys) sadly fails to recognize it. As a mitigation, we still run the
# tests on Windows 2019, until we can figure out a way to fix the problem.
os: [ubuntu-20.04, macos-13, windows-2019]
node-version: ["18.x"]
steps:
- uses: actions/checkout@v3
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
if: matrix.os == 'macos-13'
with:
xcode-version: '14.3'
# Temporary fix for "ValueError: invalid mode: 'rU' while trying to load binding.gyp"
# See <PR link>
# This can be removed when "prebuild" updates "node-gyp"
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# This step can be removed as soon as official Windows arm64 builds are published:
# https://github.com/nodejs/build/issues/2450#issuecomment-705853342
- name: Install Windows arm64 node.lib
if: ${{ matrix.os == 'windows-2019' }}
run: |
$NodeVersion = (node --version) -replace '^.'
$NodeFallbackVersion = "16.19.0"
& .\scripts\download-node-lib-win-arm64.ps1 $NodeVersion $NodeFallbackVersion
working-directory: bindings/nodejs-old
- name: Install LLVM and Clang (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@32c4866ebb71e0949e8833eb49beeebed48532bd
if: matrix.os == 'windows-2019'
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm
- name: Set LIBCLANG_PATH (Windows)
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: matrix.os == 'windows-2019'
- name: Set deployment target (macOS)
run: echo "MACOSX_DEPLOYMENT_TARGET=10.13" >> $GITHUB_ENV
if: matrix.os == 'macos-13'
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.os == 'macos-13' || ${{ startsWith(matrix.os, 'ubuntu') }}
- name: Get current date
if: matrix.os == 'windows-2019'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install required packages (Ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get install libudev-dev libusb-1.0-0-dev
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
${{ matrix.os }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }}
${{ matrix.os }}-stable-cargo-index-
# This step is required to support macOS 10.13
- name: Patch librocksdb-sys (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
cargo install cargo-patch
cp ${{ github.workspace }}/.patches/rocksdb_faligned_allocation.patch .
git apply --ignore-space-change --ignore-whitespace ${{ github.workspace }}/.patches/macos_cargo_toml.patch
cat Cargo.toml
cargo patch
- name: Install dependencies
run: npm install typescript && npm ci
working-directory: bindings/nodejs-old
- name: Build Node.js prebuild (x64)
run: npm run prebuild-x64
working-directory: bindings/nodejs-old
# Temporarily disabled because it does not work like this https://github.com/iotaledger/iota-sdk/issues/97
# - name: Build Node.js prebuild (arm64)
# run: npm run prebuild-arm64
# working-directory: bindings/nodejs-old
- name: Upload prebuild to GitHub release
run: npx prebuild --upload-all ${{ secrets.GITHUB_TOKEN }} --tag-prefix wallet-nodejs-binding-v
working-directory: bindings/nodejs-old