Skip to content

Commit

Permalink
CI stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
alexroan committed Jun 4, 2024
1 parent 5dfcbd0 commit 76889a0
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 7 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/release2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
on:
push:
tags:
- 'ci-test*'

name: Release 2

jobs:
build:
name: Build
env:
PROJECT_NAME: aderyn
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: win-amd64
runner: windows-latest
target: x86_64-pc-windows-msvc
- name: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Extract Tag Name
id: extract_tag_name
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
shell: bash

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.target }}"

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.target }}

- name: Create Binary
shell: bash
run: |
BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
echo "BIN_RELEASE_VERSIONED: $BIN_RELEASE_VERSIONED"
mv "${BIN_OUTPUT}" "./${BIN_RELEASE_VERSIONED}"
echo "BIN_RELEASE_VERSIONED=${BIN_RELEASE_VERSIONED}" >> $GITHUB_ENV
- name: Compress Binary
run: |
mkdir -p compressed
tar -czvf compressed/${{ env.BIN_RELEASE_VERSIONED }}.tar.gz ${{ env.BIN_RELEASE_VERSIONED }}
echo "COMPRESSED_BINARY=compressed/${{ env.BIN_RELEASE_VERSIONED }}.tar.gz" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.BIN_RELEASE_VERSIONED }}.tar.gz
path: ${{ env.COMPRESSED_BINARY }}

outputs:
tag_name: ${{ env.TAG_NAME }}

create_release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts/

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.build.outputs.tag_name }}
release_name: "Release ${{ needs.build.outputs.tag_name }}"
draft: false
prerelease: false

- name: Upload Compressed Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/
asset_name: ${{ matrix.name }}.tar.gz
asset_content_type: application/gzip

2 changes: 1 addition & 1 deletion cyfrinup/cyfrinup
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ main() {

# Download the binaries tarball and unpack it into the .cyfrinup bin directory.
say "downloading latest aderyn"
ensure curl -# -L $BIN_TARBALL_URL -o "$CYFRIN_BIN_DIR/aderyn"
ensure curl -# -L $BIN_TARBALL_URL -o "$CYFRIN_BIN_DIR/aderyn.tar.gz"

# Download the man tarball and unpack it into the .cyfrinup man directory.
say "installed aderyn"
Expand Down
7 changes: 1 addition & 6 deletions cyfrinup/install
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo Installing cyfrinup...
CYFRIN_DIR="$HOME/.cyfrin"
CYFRIN_BIN_DIR="$CYFRIN_DIR/bin"

CYFRINUP_URL="https://<cyfrin url>/path/to/cyfrinup.sh"
CYFRINUP_URL="https://raw.githubusercontent.com/Cyfrin/aderyn/feature/cyfrinup/cyfrinup/cyfrinup"
BIN_PATH="$CYFRIN_BIN_DIR/cyfrinup"

# Create the .cyfrin bin directory and huffup binary if it doesn't exist.
Expand Down Expand Up @@ -44,10 +44,5 @@ if [[ ":$PATH:" != *":${CYFRIN_BIN_DIR}:"* ]]; then
echo >> $PROFILE && echo "export PATH=\"\$PATH:$CYFRIN_BIN_DIR\"" >> $PROFILE
fi

# Warn MacOS users that they may need to manually install libusb via Homebrew:
if [[ "$OSTYPE" =~ ^darwin && ! -f /usr/local/opt/libusb/lib/libusb-1.0.0.dylib ]]; then
echo && echo "warning: libusb not found. You may need to install it manually on MacOS via Homebrew (brew install libusb)."
fi

echo && echo "Detected your preferred shell is ${PREF_SHELL} and added cyfrinup to PATH. Run 'source ${PROFILE}' or start a new terminal session to use cyfrin."
echo "Then, simply run 'cyfrinup' to install Cyfrin tool suite"

0 comments on commit 76889a0

Please sign in to comment.