Skip to content

Commit

Permalink
Updated CI for cli tool deployment.
Browse files Browse the repository at this point in the history
Improved docs for graph_vector refactor
  • Loading branch information
mburridge96 committed Nov 21, 2024
1 parent e7f3c84 commit 5785c5d
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 26 deletions.
106 changes: 91 additions & 15 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,104 @@
# .github/workflows/release.yml
name: Release Rust CLI

on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]
workflow_run:
workflows:
- Rust
types:
- completed
workflow_run:
workflows:
- Rust
types:
- completed

jobs:
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
build-and-release:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
- platform: windows
rust_target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz tar.zst
- target: x86_64-apple-darwin
runs-on: ubuntu-latest
- platform: linux-tar-gz
rust_target: x86_64-unknown-linux-musl
archive: tar.gz
runs-on: ubuntu-latest
- platform: linux-tar-xz
rust_target: x86_64-unknown-linux-musl
archive: tar.xz
runs-on: ubuntu-latest
- platform: linux-tar-zst
rust_target: x86_64-unknown-linux-musl
archive: tar.zst
runs-on: ubuntu-latest
- platform: macos
rust_target: x86_64-apple-darwin
archive: zip
runs-on: macos-latest

runs-on: ${{ matrix.runs-on }}

steps:
- uses: actions/checkout@master
- name: Compile and release
uses: rust-build/[email protected]
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4

# Install Rust
- name: Install Rust
run: |
rustup install stable
rustup target add ${{ matrix.rust_target }}
# Build CLI tool
- name: Build CLI tool
run: |
if [[ "${{ matrix.runs-on }}" == "macos-latest" ]]; then
cd cli && cargo build --release --target=${{ matrix.rust_target }}
else
cargo install cross
cd cli && cross build --release --target=${{ matrix.rust_target }}
fi
cd ../ && mkdir -p dist/${{ matrix.platform }}
# Package the binary
- name: Package Binary
run: |
BINARY=target/${{ matrix.rust_target }}/release/rocraters
WIN_BINARY=target/${{ matrix.rust_target }}/release/rocraters.exe
ARCHIVE=dist/${{ matrix.platform }}/rocraters-${{ matrix.rust_target }}.${{ matrix.archive }}
if [[ "${{ matrix.archive }}" == "zip" ]]; then
if [[ "${{ matrix.platform }}" == "windows" ]]; then
zip -j $ARCHIVE $WIN_BINARY
else
zip -j $ARCHIVE $BINARY
fi
elif [[ "${{ matrix.archive }}" == "tar.gz" ]]; then
tar -czvf $ARCHIVE -C target/${{ matrix.rust_target }}/release rocraters
elif [[ "${{ matrix.archive }}" == "tar.xz" ]]; then
tar -cJvf $ARCHIVE -C target/${{ matrix.rust_target }}/release rocraters
elif [[ "${{ matrix.archive }}" == "tar.zst" ]]; then
tar --zstd -cvf $ARCHIVE -C target/${{ matrix.rust_target }}/release rocraters
fi
# Upload artifacts
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: rocraters-${{ matrix.platform }}-${{ matrix.archive }}
path: dist/${{ matrix.platform }}/*

- name: Create GitHub Release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: dist/${{ matrix.platform }}/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
5 changes: 5 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
- '*'
pull_request:
branches: [ "main" ]
workflow_run:
workflows:
- Rust
types:
- completed

env:
PACKAGE_NAME: rocraters
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ro-crate-rs"
version = "0.4.6"
version = "0.4.7"
edition = "2021"
repository = "https://github.com/intbio-ncl/ro-crate-rs"
authors = ["Matt Burridge <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ro-crate-rs-cli"
version = "0.4.5"
version = "0.4.6"
edition = "2021"
repository = "https://github.com/intbio-ncl/ro-crate-rs"
authors = ["Matt Burridge <[email protected]>"]
Expand All @@ -13,7 +13,7 @@ categories = ["command-line-utilities"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ro-crate-rs = {path = "../"}
ro-crate-rs = {path = "../", version = "0.4.7"}
clap = { version = "4.4.16", features = ["derive"] }
chrono = "0.4"
serde_json = "1.0"
Expand Down
9 changes: 9 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ The ro-crate-rs cli tool can be used to immediately interface with RO-Crates wit
# Basics

This cli allows basic interaction with an RO-Crate, such as reading, writing, updating, validating and so on.

# Installion

Via Cargo (need rust installed):
```
cargo install ro-crate-rs-cli
```

Or via github release page, choose your target platform and download the binary. Once download it can be used in whichever command line you choose.
5 changes: 0 additions & 5 deletions docs/ro-crate-schema.svg

This file was deleted.

10 changes: 10 additions & 0 deletions docs/ro-crate-schmea.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rocraters-python"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
authors = ["Matt Burridge <[email protected]>"]
description = "Lightweight Python library for RO-Crate manipulation implemented in Rust"
Expand Down

0 comments on commit 5785c5d

Please sign in to comment.