Skip to content

chore: autonomi rebranding #96

chore: autonomi rebranding

chore: autonomi rebranding #96

Workflow file for this run

# 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.3.0-rc.1
NODE_VERSION: 0.3.0-rc.1
ANTCTL_VERSION: 0.11.4-rc.1
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: macos-latest
target: aarch64-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 -- antctl --version $env:ANTCTL_VERSION
- name: Check if binaries are available in new shell session
shell: pwsh
run: |
if (!(Test-Path "$env:USERPROFILE\autonomi\ant.exe")) {
Write-Host "ant.exe does not exist"
exit 1
}
if (!(Test-Path "$env:USERPROFILE\autonomi\antnode.exe")) {
Write-Host "antnode.exe does not exist"
exit 1
}
if (!(Test-Path "$env:USERPROFILE\autonomi\antctl.exe")) {
Write-Host "antctl.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}\autonomi\ant.exe" --version
$version = $output | Select-String -Pattern "ant-cli (\d+\.\d+\.\d+(?:-[a-zA-Z0-9]+(?:\.[0-9]+)?)?)"
$versionNumber = $version.Matches.Groups[1].Value
if ($versionNumber -eq "$env:CLIENT_VERSION") {
Write-Host "The correct version of autonomi has been installed"
} else {
Write-Host "The correct version of autonomi has not been installed"
Write-Host "We expected version $env:CLIENT_VERSION"
Write-Host "The downloaded binary has $versionNumber"
exit 1
}
$output = & "${env:USERPROFILE}\autonomi\antnode.exe" --version
$version = $output -split "`n" | Select-Object -First 1
$versionNumber = ($version -split "v")[1].Trim()
if ($versionNumber -eq "$env:NODE_VERSION") {
Write-Host "The correct version of antnode has been installed"
} else {
Write-Host "The correct version of antnode has not been installed"
Write-Host "We expected version $env:NODE_VERSION"
Write-Host "The downloaded binary has $versionNumber"
exit 1
}
$output = & "${env:USERPROFILE}\autonomi\antctl.exe" --version
$version = $output -split "`n" | Select-Object -First 1
$versionNumber = ($version -split "v")[1].Trim()
if ($versionNumber -eq "$env:ANTCTL_VERSION") {
Write-Host "The correct version of antctl has been installed"
} else {
Write-Host "The correct version of antctl has not been installed"
Write-Host "We expected version $env:ANTCTL_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 -- antctl --version $ANTCTL_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/autonomi/env
[[ -f "$HOME/.local/bin/ant" ]] || { echo "ant not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antnode" ]] || { echo "antnode not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antctl" ]] || { echo "antctl not in expected location"; exit 1; }
version=$(ant --version | awk '{ print $2 }')
if [[ "$version" == "$CLIENT_VERSION" ]]; then
echo "The correct version of ant has been installed"
else
echo "The correct version of ant has not been installed"
echo "We expected $CLIENT_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(antnode --version | head -n 1 | awk '{print $3}' | sed 's/^v//')
if [[ "$version" == "$NODE_VERSION" ]]; then
echo "The correct version of antnode has been installed"
else
echo "The correct version of antnode has not been installed"
echo "We expected $NODE_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(antctl --version | head -n 1 | awk '{print $4}' | sed 's/^v//')
if [[ "$version" == "$ANTCTL_VERSION" ]]; then
echo "The correct version of antctl has been installed"
else
echo "The correct version of antctl has not been installed"
echo "We expected $ANTCTL_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 -- antctl --version $ANTCTL_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/autonomi/env"
[[ -f "$HOME/.local/bin/ant" ]] || { echo "ant not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antnode" ]] || { echo "antnode not in expected location"; exit 1; }
[[ -f "$HOME/.local/bin/antctl" ]] || { echo "antctl not in expected location"; exit 1; }
version=$(ant --version | awk '{ print $2 }')
if [[ "$version" == "$CLIENT_VERSION" ]]; then
echo "The correct version of ant has been installed"
else
echo "The correct version of ant has not been installed"
echo "We expected $CLIENT_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(antnode --version | head -n 1 | awk '{print $3}' | sed 's/^v//')
if [[ "$version" == "$NODE_VERSION" ]]; then
echo "The correct version of antnode has been installed"
else
echo "The correct version of antnode has not been installed"
echo "We expected $NODE_VERSION"
echo "The downloaded binary has $version"
exit 1
fi
version=$(antctl --version | head -n 1 | awk '{print $4}' | sed 's/^v//')
if [[ "$version" == "$ANTCTL_VERSION" ]]; then
echo "The correct version of antctl has been installed"
else
echo "The correct version of antctl has not been installed"
echo "We expected $ANTCTL_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