Skip to content

Wait 1 minute after stability window before leadership check is allowed #175

Wait 1 minute after stability window before leadership check is allowed

Wait 1 minute after stability window before leadership check is allowed #175

Workflow file for this run

on: [push, pull_request]
jobs:
build:
name: ${{ matrix.job.os }} (${{ matrix.job.target }})
runs-on: ${{ matrix.job.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-22.04, label: ubuntu22, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-22.04, label: ubuntu22, target: x86_64-unknown-linux-musl, use-cross: true }
- { os: macos-latest, label: macos, target: x86_64-apple-darwin }
# - { os: ubuntu-22.04, label: macos, target: aarch64-apple-darwin, use-cross: true }
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true # recurse submodules
- name: Configure Environment
run: |
case ${{ matrix.job.target }} in
*-pc-windows-gnu)
case ${{ matrix.job.target }} in
i686*)
MSYSTEM=MINGW32
MSYSTEM_PATH=c:/msys64/mingw32
;;
x86_64*)
MSYSTEM=MINGW64
MSYSTEM_PATH=c:/msys64/mingw64
;;
esac
echo "c:/msys64" >> $GITHUB_PATH # enable msys2 entrypoint commands (probably not needed)
echo "c:/msys64/usr/bin" >> $GITHUB_PATH # place msys2 environment on system path
echo "${MSYSTEM_PATH}/bin" >> $GITHUB_PATH # place MinGW environment on system path
echo "CHERE_INVOKING=yes" >> $GITHUB_ENV # maintain directory context
echo "MSYSTEM=${MSYSTEM}" >> $GITHUB_ENV # set msystem version for msys2 shell
;;
esac
- name: Install Prerequisites
run: |
case ${{ matrix.job.os }} in
windows64*)
pacman -S --noconfirm --needed mingw-w64-x86_64-gcc base-devel autoconf
;;
windows32*)
pacman -S --noconfirm --needed mingw-w64-i686-gcc base-devel autoconf
;;
ubuntu*)
sudo apt-get -y update
sudo apt-get -y install automake build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ tmux git jq wget libncursesw5 libtool autoconf musl-tools gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
;;
macos*)
brew install automake
;;
esac
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.job.toolchain || 'stable' }}
target: ${{ matrix.job.target }}
override: true
default: true
components: rustfmt, clippy
- name: Build Libsodium
if: contains(matrix.job.features, 'libsodium-sys')
run: autoreconf -vfi && ./configure && make && make install
working-directory: contrib/libsodium
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Lint (Clippy)
uses: actions-rs/cargo@v1
with:
command: clippy
args: --release --features "${{ join(matrix.job.features, ',') }}" --target ${{ matrix.job.target }} -- -D warnings
- name: Test
if: "${{ ! contains(matrix.job.target, 'aarch64') }}"
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: test
args: --release --features "${{ join(matrix.job.features, ',') }}" --target ${{ matrix.job.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --release --features "${{ join(matrix.job.features, ',') }}" --target ${{ matrix.job.target }} --locked
- name: Package
id: package
run: |
PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml)
PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
PKG_SUFFIX=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_SUFFIX=".zip" ;; esac;
PKG_NAME=${PROJECT_NAME}-${PROJECT_VERSION}-${{ matrix.job.label }}-${{ matrix.job.target }}${PKG_SUFFIX}
case ${{ matrix.job.target }} in
*-pc-windows-*) 7z -y a "${PKG_NAME}" ./target/${{matrix.job.target}}/release/cncli.exe | tail -2 ;;
*) tar -C target/${{matrix.job.target}}/release -czf "${PKG_NAME}" cncli ;;
esac;
echo ::set-output name=PKG_NAME::${PKG_NAME}
echo ::set-output name=PKG_PATH::${PKG_NAME}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.package.outputs.PKG_NAME }}
path: ${{ steps.package.outputs.PKG_PATH }}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
prerelease: "${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}"
files: ${{ steps.package.outputs.PKG_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}