Skip to content

Commit

Permalink
Release v1.0.0
Browse files Browse the repository at this point in the history
This is a monumental release in the development of sterling, culminating
in the finalization of the command-line API and a stabilization of
sterling's features. Woo-hoo!!

Sterling's functionality is very basic: conversion of PHB currencies
into user-defined ones, basic arithmetic operations, and converting
custom currency amounts to the equivalent amount in PHB copper. It's
unlikely that I will be adding any additional features ontop of this
set, as it already provides functionality appropriate enough for most
usecases.

Congrats to me on finally finishing a side-project!
  • Loading branch information
Zachary Dziura committed Aug 6, 2018
1 parent f7a6ec5 commit 90a3f41
Show file tree
Hide file tree
Showing 15 changed files with 706 additions and 363 deletions.
14 changes: 1 addition & 13 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,4 @@ cargo:test:
- master
script:
- cargo test --verbose

cargo:build:
stage: deploy
only:
- master
script:
- cargo build --release
cache:
paths:
- target/
artifacts:
paths:
- target/release/sterling
- cargo bench
73 changes: 54 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,62 @@
# Based on the "trust" template v0.1.2
# https://github.com/japaric/trust/tree/v0.1.2

dist: trusty
language: rust
os:
- osx
branches:
only:
- master
rust:
- stable
services: docker
sudo: required

env:
global:
# TODO Update this to match the name of your project.
- CRATE_NAME=sterling

matrix:
include:
# Linux
- env: TARGET=x86_64-unknown-linux-gnu

# OSX
- env: TARGET=x86_64-apple-darwin
os: osx

before_install:
- set -e
- rustup self update

install:
- sh ci/install.sh
- source ~/.cargo/env || true

script:
- cargo test --verbose
- cargo build --release
- bash ci/script.sh

after_script: set +e

before_deploy:
- git config --local user.name "Zachary Dziura"
- git config --local user.email "zcdziura@gmail.com"
- git tag "$(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1)-osx"
- sh ci/before_deploy.sh

deploy:
provider: releases
api_key:
secure: "NVH5d3CH0QUyFSu0MbeB3WvSo52qwjxH98wIL7kieD/kbTrTzTCbTWiTCV+/OM41nWOdxTy9T5TLqDsrh4k4xCkb4VbKTcsfIpBaQqwMvT6Co/GgLr4xSiHBI/ENBVwbnyDavMxh/E5AAAPF/HgGci2tEqzNuu9V7jon6uhb8+WovbfZeEA4tSNLsWV5g3MwssMfdaWzDPTHsiWXFPn6AVhkmy4fKAIHoUtp37A7bqx1hGPpFD3OGYN1oDxtJK5jRBSXegyWh08RQkLQ74PJTWD6Xw+Hvp1ewP1vitP69VJgsBC496jPasqAEOVeD3KogtcmBEyaIG+I5LZWLTibs41qF83cxJDdWxw69H827IXSQobM+7Sc51chWJR0H3OA1yDPQvorI1C17zvXd4wPpDfSUeY5ZqAplnYMOxk3jDbbX099bEyRE/skWHRaqL99fV7i5bO3aHDFP/BDjp03hnzpvfKs9zm05e87LStriNYQ5NsCPkdX+W18Q15DLhS2D9cp37PPAUA5jLNUFiEY5x9fwl5XEpefBqrqmE8qbmkc9GTr3MZikmTfB51Nx5NvkybCTKhMoKw5AhNLmw0fnkaqxrei7Uif7WqxTkngJep6VLidmt2pRJ9Qj3AWOXsLZJPm0ZQuo71dWC049EeEVtfQkyz/9K2J+iNVRgdiEeg="
file_glob: true
file: target/release/sterling
skip_cleanup: true
file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
on:
repo: zcdziura/sterling
branch: master
addons:
artifacts: true
tags: true
provider: releases
skip_cleanup: true

cache: cargo
before_cache:
# Travis can't cache files that are not readable by "others"
- chmod -R a+r $HOME/.cargo

branches:
only:
# release tags
- /^v\d+\.\d+\.\d+.*$/
# - master

notifications:
email:
on_success: never
23 changes: 20 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
[package]
name = "sterling"
version = "0.3.0"
version = "1.0.0"
description = "Converts a given D&D 5e currency value to the Silver Standard."
authors = ["Zachary Dziura <zcdziura@gmail.com>"]
readme = "README.md"
license = "Unlicense/MIT"
repository = "https://gitlab.com/zcdziura/sterling"
keywords = ["dnd", "coins", "converter", "currency", "5e"]

[lib]
name = "sterling_ops"
path = "src/lib.rs"

[[bin]]
name = "sterling"
path = "src/main.rs"

[dependencies]
clap = "2.31"
clap = "2.32"
lazysort = "0.2"
lazy_static = "1.0"
regex = "1.0"
separator = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_yaml = "0.7"

[dev-dependencies]
criterion = "0.2"

[profile.release]
lto = true
panic = "abort"
panic = "abort"

[[bench]]
name = "bench"
harness = false
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ within my own campaign!
name: "guilder"
rate: 896
alias: "g"
plural: "guilders"
-
name: "shilling"
rate: 32
Expand Down
73 changes: 52 additions & 21 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
os: Visual Studio 2015
branches:
only:
- master
# Based on the "trust" template v0.1.2
# https://github.com/japaric/trust/tree/v0.1.2

environment:
global:
RUST_VERSION: stable
CRATE_NAME: sterling

matrix:
- channel: stable
target: x86_64-pc-windows-gnu
artifacts:
- path: target/release/sterling.exe
name: sterling
# MinGW
- TARGET: x86_64-pc-windows-gnu

install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init -yv --default-toolchain %channel% --default-host %target%
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
- rustc -vV
- cargo -vV
build: false
- ps: >-
If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') {
$Env:PATH += ';C:\msys64\mingw64\bin'
} ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') {
$Env:PATH += ';C:\msys64\mingw32\bin'
}
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- rustc -Vv
- cargo -V

test_script:
- cargo test --verbose
- cargo build --release
# we don't run the "test phase" when doing deploys
- if [%APPVEYOR_REPO_TAG%]==[true] (
cargo test --target %TARGET% &&
cargo build --target %TARGET% --release
)

before_deploy:
- ps: ci\before_deploy.ps1

deploy:
provider: GitHub
description: ''
artifact: /.*\.zip/
auth_token:
secure: bvA/4J1T0h65ur6tsg6k/wlZFjP3qr2QsyRsmGMEmm7DOF61xmzTnjuBcPjQYrba
artifact: target/release/sterling.exe
on:
branch: master
RUST_VERSION: stable
appveyor_repo_tag: true
provider: GitHub

cache:
- C:\Users\appveyor\.cargo\registry
- target

branches:
only:
# Release tags
- /^v\d+\.\d+\.\d+.*$/
# - master

notifications:
- provider: Email
on_build_success: false

# Building is done in the test phase, so we disable Appveyor's build phase.
build: false
27 changes: 27 additions & 0 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#[macro_use]
extern crate criterion;
#[macro_use]
extern crate lazy_static;
extern crate sterling_ops;

use criterion::Criterion;
use sterling_ops::currency::Currency;
use sterling_ops::*;

lazy_static! {
static ref CURRENCIES: Vec<Currency> = vec![
Currency::new("penny", 1, "p", Some("pence".to_owned()), None),
Currency::new("shilling", 100, "s", Some("sterling".to_owned()), None),
Currency::new("guilder", 10_000, "g", None, None),
Currency::new("note", 1_000_000, "N", None, Some(true)),
];
}

fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("default operation", |b| {
b.iter(|| default_operation("3p 5s 7s 132c", &CURRENCIES, true))
});
}

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);
22 changes: 22 additions & 0 deletions ci/before_deploy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This script takes care of packaging the build artifacts that will go in the
# release zipfile

$SRC_DIR = $PWD.Path
$STAGE = [System.Guid]::NewGuid().ToString()

Set-Location $ENV:Temp
New-Item -Type Directory -Name $STAGE
Set-Location $STAGE

$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"

Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\sterling.exe" '.\'

7z a "$ZIP" *

Push-AppveyorArtifact "$ZIP"

Remove-Item *.* -Force
Set-Location ..
Remove-Item $STAGE
Set-Location $SRC_DIR
32 changes: 32 additions & 0 deletions ci/before_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This script takes care of building your crate and packaging it for release

set -ex

main() {
local src=$(pwd) \
stage=

case $TRAVIS_OS_NAME in
linux)
stage=$(mktemp -d)
;;
osx)
stage=$(mktemp -d -t tmp)
;;
esac

test -f Cargo.lock || cargo generate-lockfile

cargo build --release --target $TARGET

# TODO Update this to package the right artifacts
cp target/$TARGET/release/sterling $stage/

cd $stage
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
cd $src

rm -rf $stage
}

main
14 changes: 14 additions & 0 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -ex

main() {
local target=
if [ $TRAVIS_OS_NAME = linux ]; then
target=x86_64-unknown-linux-gnu
sort=sort
else
target=x86_64-apple-darwin
sort=gsort # for `sort --sort-version`, from brew's coreutils.
fi
}

main
18 changes: 18 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This script takes care of testing your crate

set -ex

main() {
cross build --target $TARGET --release

if [ ! -z $DISABLE_TESTS ]; then
return
fi

cross test --target $TARGET
}

# we don't run the "test phase" when doing deploys
if [ -z $TRAVIS_TAG ]; then
main
fi
Loading

0 comments on commit 90a3f41

Please sign in to comment.