feat: provide node-launchpad
command
#77
Workflow file for this run
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
# PR workflow. | |
# | |
# Runs full suite of checks, with warnings treated as errors. | |
# Gather code coverage stats and publish them on coveralls.io. | |
name: PR | |
on: pull_request | |
env: | |
RUST_BACKTRACE: 1 | |
RUSTFLAGS: "-D warnings" | |
CLIENT_VERSION: 0.77.27 | |
NODE_VERSION: 0.83.25 | |
NODE_MANAGER_VERSION: 0.1.8 | |
NODE_LAUNCHPAD_VERSION: 0.2.0 | |
jobs: | |
# The code in this crate uses lots of conditional compilation for cross-platform capabilities. | |
# Therefore, it's important we make sure it can build on both the Windows and Unix OS families. | |
build: | |
name: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
id: toolchain | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- shell: bash | |
run: cargo build --all-targets --all-features | |
checks: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
name: Clippy & fmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Cargo cache registry, index and build | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/Cargo.toml') }} | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Clippy checks | |
run: cargo clippy --all-targets | |
cargo-udeps: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
name: Unused dependency check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: Run cargo-udeps | |
uses: aig787/cargo-udeps-action@v1 | |
with: | |
version: 'latest' | |
args: '--all-targets' | |
cargo-deny: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- shell: bash | |
run: wget https://raw.githubusercontent.com/maidsafe/QA/master/misc-scripts/deny.toml | |
- uses: EmbarkStudios/cargo-deny-action@v1 | |
unit-test: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Cargo cache registry, index and build | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --release | |
test-install-windows: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
name: Install test (Windows) | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install binaries | |
shell: pwsh | |
run: | | |
cargo run -- client --version $env:CLIENT_VERSION | |
cargo run -- node --version $env:NODE_VERSION | |
cargo run -- node-manager --version $env:NODE_MANAGER_VERSION | |
cargo run -- node-launchpad --version $env:NODE_LAUNCHPAD_VERSION | |
- name: Check if binaries are available in new shell session | |
shell: pwsh | |
run: | | |
if (!(Test-Path "$env:USERPROFILE\safe\safe.exe")) { | |
Write-Host "safe.exe does not exist" | |
exit 1 | |
} | |
if (!(Test-Path "$env:USERPROFILE\safe\safenode.exe")) { | |
Write-Host "safenode.exe does not exist" | |
exit 1 | |
} | |
if (!(Test-Path "$env:USERPROFILE\safe\safenode-manager.exe")) { | |
Write-Host "safenode-manager.exe does not exist" | |
exit 1 | |
} | |
if (!(Test-Path "$env:USERPROFILE\safe\node-launchpad.exe")) { | |
Write-Host "node-launchpad.exe does not exist" | |
exit 1 | |
} | |
# For security reasons, the GHA infrastructure prevents environment variables | |
# being modified easily, so we need to refer to the binaries with their full paths. | |
# Other manual testing has proven that the changes to the Path environment variable do | |
# take effect. | |
$output = & "${env:USERPROFILE}\safe\safe.exe" --version | |
$version = $output | Select-String -Pattern "sn_cli (\d+\.\d+\.\d+)" | |
$versionNumber = $version.Matches.Groups[1].Value | |
if ($versionNumber -eq "$env:CLIENT_VERSION") { | |
Write-Host "The correct version of safe has been installed" | |
} else { | |
Write-Host "The correct version of safe has not been installed" | |
Write-Host "We expected version $env:CLIENT_VERSION" | |
Write-Host "The downloaded binary has $versionNumber" | |
exit 1 | |
} | |
$output = & "${env:USERPROFILE}\safe\safenode.exe" --version | |
$version = $output | Select-String -Pattern "safenode cli (\d+\.\d+\.\d+)" | |
$versionNumber = $version.Matches.Groups[1].Value | |
if ($versionNumber -eq "$env:NODE_VERSION") { | |
Write-Host "The correct version of safenode has been installed" | |
} else { | |
Write-Host "The correct version of safenode has not been installed" | |
Write-Host "We expected version $env:NODE_VERSION" | |
Write-Host "The downloaded binary has $versionNumber" | |
exit 1 | |
} | |
$output = & "${env:USERPROFILE}\safe\safenode-manager.exe" --version | |
$version = $output | Select-String -Pattern "sn-node-manager (\d+\.\d+\.\d+)" | |
$versionNumber = $version.Matches.Groups[1].Value | |
if ($versionNumber -eq "$env:NODE_MANAGER_VERSION") { | |
Write-Host "The correct version of safenode-manager has been installed" | |
} else { | |
Write-Host "The correct version of safenode-manager has not been installed" | |
Write-Host "We expected version $env:NODE_MANAGER_VERSION" | |
Write-Host "The downloaded binary has $versionNumber" | |
exit 1 | |
} | |
$output = & "${env:USERPROFILE}\safe\node-launchpad.exe" --version | |
$version = $output | Select-String -Pattern "node-launchpad (\d+\.\d+\.\d+)" | |
$versionNumber = $version.Matches.Groups[1].Value | |
if ($versionNumber -eq "$env:NODE_LAUNCHPAD_VERSION") { | |
Write-Host "The correct version of safenode-manager has been installed" | |
} else { | |
Write-Host "The correct version of safenode-manager has not been installed" | |
Write-Host "We expected version $env:NODE_LAUNCHPAD_VERSION" | |
Write-Host "The downloaded binary has $versionNumber" | |
exit 1 | |
} | |
test-install-linux: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
name: Install test (Linux) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install binaries | |
shell: bash | |
run: | | |
cargo run -- client --version $CLIENT_VERSION | |
cargo run -- node --version $NODE_VERSION | |
cargo run -- node-manager --version $NODE_MANAGER_VERSION | |
cargo run -- node-launchpad --version $NODE_LAUNCHPAD_VERSION | |
- name: Check if binaries are available in new shell session | |
shell: bash | |
run: | | |
# The installer adds this to the .bashrc file, but even though | |
# there's a new shell session for each step, the new bashrc isn't | |
# being sourced. Perhaps it's not a login shell or something. So | |
# unfortunately we need to explicitly source the env file. However, | |
# the test does prove that the env file modifies PATH correctly and | |
# that the installs of the binaries are available from their local | |
# locations. | |
source ~/.config/safe/env | |
[[ -f "$HOME/.local/bin/safe" ]] || { echo "safe not in expected location"; exit 1; } | |
[[ -f "$HOME/.local/bin/safenode" ]] || { echo "safenode not in expected location"; exit 1; } | |
[[ -f "$HOME/.local/bin/safenode-manager" ]] || { echo "safenode-manager not in expected location"; exit 1; } | |
[[ -f "$HOME/.local/bin/node-launchpad" ]] || { echo "node-launchpad not in expected location"; exit 1; } | |
version=$(safe --version | awk '{ print $2 }') | |
if [[ "$version" == "$CLIENT_VERSION" ]]; then | |
echo "The correct version of safe has been installed" | |
else | |
echo "The correct version of safe has not been installed" | |
echo "We expected $CLIENT_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
version=$(safenode --version | awk '{ print $3 }') | |
if [[ "$version" == "$NODE_VERSION" ]]; then | |
echo "The correct version of safenode has been installed" | |
else | |
echo "The correct version of safenode has not been installed" | |
echo "We expected $NODE_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
version=$(safenode-manager --version | awk '{ print $2 }') | |
if [[ "$version" == "$NODE_MANAGER_VERSION" ]]; then | |
echo "The correct version of safenode-manager has been installed" | |
else | |
echo "The correct version of safenode-manager has not been installed" | |
echo "We expected $NODE_MANAGER_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
version=$(node-launchpad --version | awk '{ print $2 }') | |
if [[ "$version" == "$NODE_LAUNCHPAD_VERSION" ]]; then | |
echo "The correct version of node-launchpad has been installed" | |
else | |
echo "The correct version of node-launchpad has not been installed" | |
echo "We expected $NODE_LAUNCHPAD_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
test-install-macos: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
name: Install test (macOS) | |
runs-on: macOS-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Install binaries | |
run: | | |
cargo run -- client --version $CLIENT_VERSION | |
cargo run -- node --version $NODE_VERSION | |
cargo run -- node-manager --version $NODE_MANAGER_VERSION | |
cargo run -- node-launchpad --version $NODE_LAUNCHPAD_VERSION | |
- name: Check if binaries are available in new shell session | |
run: | | |
# As with the Ubuntu test, we need to source the env file to get the binaries on PATH. | |
source "/Users/runner/Library/Application Support/safe/env" | |
[[ -f "$HOME/.local/bin/safe" ]] || { echo "safe not in expected location"; exit 1; } | |
[[ -f "$HOME/.local/bin/safenode" ]] || { echo "safenode not in expected location"; exit 1; } | |
[[ -f "$HOME/.local/bin/safenode-manager" ]] || { echo "safenode-manager not in expected location"; exit 1; } | |
[[ -f "$HOME/.local/bin/node-launchpad" ]] || { echo "node-launchpad not in expected location"; exit 1; } | |
version=$(safe --version | awk '{ print $2 }') | |
if [[ "$version" == "$CLIENT_VERSION" ]]; then | |
echo "The correct version of safe has been installed" | |
else | |
echo "The correct version of safe has not been installed" | |
echo "We expected $CLIENT_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
version=$(safenode --version | awk '{ print $3 }') | |
if [[ "$version" == "$NODE_VERSION" ]]; then | |
echo "The correct version of safenode has been installed" | |
else | |
echo "The correct version of safenode has not been installed" | |
echo "We expected $NODE_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
version=$(safenode-manager --version | awk '{ print $2 }') | |
if [[ "$version" == "$NODE_MANAGER_VERSION" ]]; then | |
echo "The correct version of safenode-manager has been installed" | |
else | |
echo "The correct version of safenode-manager has not been installed" | |
echo "We expected $NODE_MANAGER_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
version=$(node-launchpad --version | awk '{ print $2 }') | |
if [[ "$version" == "$NODE_LAUNCHPAD_VERSION" ]]; then | |
echo "The correct version of node-launchpad has been installed" | |
else | |
echo "The correct version of node-launchpad has not been installed" | |
echo "We expected $NODE_LAUNCHPAD_VERSION" | |
echo "The downloaded binary has $version" | |
exit 1 | |
fi | |
test-publish: | |
if: "!startsWith(github.event.pull_request.title, 'Automated version bump')" | |
name: Test Publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: dry run publish | |
run: cargo publish --dry-run |