Skip to content

Commit

Permalink
nostril:nostr utility in C
Browse files Browse the repository at this point in the history
  • Loading branch information
RandyMcMillan committed May 15, 2024
0 parents commit dc9ba72
Show file tree
Hide file tree
Showing 180 changed files with 68,814 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use nix

source .privenv || :

export PATH=$PWD:$PWD/scripts:$PATH
140 changes: 140 additions & 0 deletions .github/workflows/build-install-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: build-install-matrix

# Controls when the action will run.
on:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
pull_request:
branches:
- '*'
- '*/*'
- '**'
- 'master'
- 'main'
push:
branches:
- '*'
- '*/*'
- '**'
- 'master'
- 'main'

workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
env:
GNOSTR: "gnostr"
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: echo test
#if: ${{ !env.ACT }}
run: |
echo GNOSTR=${{ env.GNOSTR }}
echo GNOSTR1=${{ env.GNOSTR1 }}
env:
GNOSTR1: "GNOSTR1"
- uses: styfle/[email protected]
if: ${{ !env.ACT }}
with:
access_token: ${{ github.token }}

- name: Restore rustup
id: cache-rustup-restore
uses: actions/cache/restore@v3
if: ${{ !env.ACT }}
with:
path: |
~/.rustup
key: ${{ runner.os }}-rustup

- name: Restore cargo
id: cache-cargo-restore
uses: actions/cache/restore@v3
if: ${{ !env.ACT }}
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo

- name: Restore target
id: cache-target-restore
uses: actions/cache/restore@v3
if: ${{ !env.ACT }}
with:
path: |
target
key: ${{ runner.os }}-target

- uses: actions/checkout@v3
with:
submodules: 'true'
set-safe-directory: 'true'
fetch-depth: '0'
fetch-tags: false

## objective: streamline gnostr installation on macos/brewlinux
- run: brew tap gnostr-org/homebrew-gnostr-org || true
if: github.event_name == 'pull_request' && matrix.os == 'macos-latest'

## objective: streamline gnostr installation on macos/brewlinux
- run: brew tap nostorg/nostr || true
if: github.event_name == 'pull_request' && matrix.os == 'macos-latest'

- run: rustup default stable
- run: cargo search gnostr --limit 100
- run: cargo install cargo-binstall
- run: cargo-binstall --no-confirm --force gnostr-bins
- run: mkdir -p ~/bin

#- run: for t in */Cargo.toml;do echo $t;cargo b -r -vv --manifest-path $t ;done
## objective: ensure make detect installs all needed depends/libs/etc
## make detect is first for brew install sequence OR sudo make detect for apt install
- run: brew install help2man || sudo apt-get install help2man
- run: make detect || sudo make detect
- run: pipx install virtualenv || true

## objective: test non-cmake build gnostr-am
- run: make all || sudo make all
- run: make install || sudo make install
- run: ./nostril --sec $(gnostr-sha256 $(gnostr-weeble)) --content $(gnostr-weeble)/$(gnostr-blockheight)/$(gnostr-wobble) -t gnostr --tag weeble $(gnostr-weeble) --tag blockheight $(gnostr-blockheight) --tag wobble $(gnostr-wobble)

## objective: test cmake build gnostr
## objective: test cargo build/install gnostr-bins
- run: cmake .
- run: V=1 make all || sudo make all
- run: V=1 make nostril || sudo make nostril
- run: V=1 make install || sudo make install

- run: V=1 sudo make docs || true
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true && matrix.os == 'ubuntu-matrix'

- name: Save rustup
id: cache-rustup-save
uses: actions/cache/save@v3
if: ${{ !env.ACT }}
with:
path: |
~/.rustup
key: ${{ steps.cache-rustup-restore.outputs.cache-primary-key }}
- name: Save cargo
id: cache-cargo-save
uses: actions/cache/save@v3
if: ${{ !env.ACT }}
with:
path: |
~/.cargo
key: ${{ steps.cache-cargo-restore.outputs.cache-primary-key }}
- name: Save target
id: cache-target-save
uses: actions/cache/save@v3
if: ${{ !env.ACT }}
with:
path: |
target
key: ${{ steps.cache-target-restore.outputs.cache-primary-key }}

117 changes: 117 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: gnostr-docker

on:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
pull_request:
branches:
- '*'
- '*/*'
- '**'
- 'master'
- 'main'
push:
branches:
- '*'
- '*/*'
- '**'
- 'master'
- 'main'

env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1

jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
tag: ["latest", "slim-bullseye"]
runs-on: ${{ matrix.os }}
container: rust:${{ matrix.tag }}

steps:
- run: apt-get update && apt-get install autoconf build-essential curl cmake jq libexpat1-dev libcurl4-openssl-dev libssl-dev libtool lsb-release git make nodejs npm pkg-config python3 python-is-python3 sudo tcl zlib1g-dev help2man -y
## notice: this is a pre checkout step
## notice: additional operations can be done prior to checkout
## - run: apk update && apk add bash cmake git python3 && python3 -m ensurepip
- run: printenv
- run: cargo search gnostr --limit 100
- run: cargo install cargo-binstall && cargo-binstall --no-confirm --force gnostr-bins
- name: checkout@v3 fetch-depth submodules set-safe-dir true
uses: actions/checkout@v3
with:
fetch-depth: '0'
submodules: 'true'
set-safe-directory: 'true'
## notice: these are post checkout steps
## - run: apk update && apk add autoconf automake build-base openssl-dev libtool make

- name: Restore rustup
id: cache-rustup-restore
uses: actions/cache/restore@v3
if: ${{ !env.ACT }}
with:
path: |
~/.rustup
key: ${{ runner.os }}-rustup

- name: Restore cargo
id: cache-cargo-restore
uses: actions/cache/restore@v3
if: ${{ !env.ACT }}
with:
path: |
~/.cargo
key: ${{ runner.os }}-cargo

- name: Restore target
id: cache-target-restore
uses: actions/cache/restore@v3
if: ${{ !env.ACT }}
with:
path: |
target
key: ${{ runner.os }}-target

- run: touch ~/GITHUB_TOKEN.txt
- run: git config --global --add safe.directory /__w/gnostr/gnostr || true
- run: make detect | sudo make detect
## objective: non-cmake build/install
- run: make nostril install || sudo make nostril install
## objective: test gnostr-am with crate gnostr-sha256
- run: ./nostril --sec $(gnostr-sha256)
- run: cmake .
- run: make
## objective: cmake build/install
- run: V=1 make nostril install || sudo make nostril install
## objective: test gnostr with crate gnostr-bins gnostr-sha256
- run: ./nostril --sec $(gnostr-sha256)
- run: ./nostril --sec $(gnostr-sha256 $(gnostr-weeble))
- run: ./nostril --sec $(gnostr-sha256 $(gnostr-weeble)$(gnostr-blockheight))

- name: Save rustup
id: cache-rustup-save
uses: actions/cache/save@v3
if: ${{ !env.ACT }}
with:
path: |
~/.rustup
key: ${{ steps.cache-rustup-restore.outputs.cache-primary-key }}
- name: Save cargo
id: cache-cargo-save
uses: actions/cache/save@v3
if: ${{ !env.ACT }}
with:
path: |
~/.cargo
key: ${{ steps.cache-cargo-restore.outputs.cache-primary-key }}
- name: Save target
id: cache-target-save
uses: actions/cache/save@v3
if: ${{ !env.ACT }}
with:
path: |
target
key: ${{ steps.cache-target-restore.outputs.cache-primary-key }}
59 changes: 59 additions & 0 deletions .github/workflows/macos-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: ubuntu-matrix

# Controls when the action will run.
on:
pull_request:
branches:
- '*'
- '*/*'
- '**'
- 'master'
- 'main'
push:
branches:
- '*'
- '*/*'
- '**'
- 'master'
- 'main'

workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
ubuntu-build_and_test:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: styfle/[email protected]
if: ${{ !env.ACT }}
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
with:
fetch-depth: '0'
submodules: 'recursive'
set-safe-directory: 'true'
- name: printenv && sudo apt update && sudo apt install scdoc -y
run: |
printenv && sudo apt update && sudo apt install scdoc -y
- name: rm -rf deps
run: |
rm -rf deps
- name: make
run: |
sudo mkdir -p /usr/local/share/man/man1 || true
make
- name: sudo make install
run: |
sudo make install
- name: man nostril
run: |
sudo man nostril
- name: sudo ./nostril
run: |
#pipe handles non-zero return from nostril default help
file nostril
sudo ./nostril >/dev/null | echo "${PIPESTATUS[0]}"
47 changes: 47 additions & 0 deletions .github/workflows/macos-pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: macos-pre-release

# Controls when the action will run.
on:
push:
branches:
- 'master'
- '**pre-release**'

workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
pre-release:
strategy:
matrix:
os: [macos-11, macos-12, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- name: "printenv"
run: |
brew install libtool autoconf automake help2man
printenv
- name: "Build pre-release"
run: |
make all || sudo make all
mv nostril nostril-$RUNNER_OS-$RUNNER_ARCH
shasum -a 256 nostril-$RUNNER_OS-$RUNNER_ARCH > nostril-$RUNNER_OS-$RUNNER_ARCH.sha256.txt
mv nostril-query nostril-query-$RUNNER_OS-$RUNNER_ARCH
shasum -a 256 nostril-query-$RUNNER_OS-$RUNNER_ARCH > nostril-query-$RUNNER_OS-$RUNNER_ARCH.sha256.txt
ls -a
- name: Save state
run: echo "{name}={value}" >> $GITHUB_STATE
- name: Set output
run: echo "{name}={value}" >> $GITHUB_OUTPUT
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ matrix.os }}
prerelease: true
title: "Development Build"
files: |
nostril-*
Loading

0 comments on commit dc9ba72

Please sign in to comment.