diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..b4bb3a7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: Bug Report +about: Report a bug here +labels: + - bug +--- + +# Bug Report + +### Expected Behavior +Add here... + +### Actual Behavior +Add here... + +### Steps to Reproduce the Problem + +1. +2. +3. + +### Specifications + +- OS platform: +- Rust version: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..466cf3c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: General Questions + url: https://github.com/databento/epoch/discussions + about: Please ask questions like "How do I achieve x?" here. + - name: DatabentoHQ + url: https://twitter.com/DatabentoHQ + about: Follow us on twitter for news and updates! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..670f2d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,10 @@ +--- +name: Feature Request +about: Request a new feature to be added here +labels: + - enhancement +--- + +# Feature Request + +Please provide a detailed description of your proposal, with some examples. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..5678c9d --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,38 @@ +# Pull request + +Please include a summary of the changes. +Please also include relevant motivation and context. +List any dependencies that are required for this change. + +Fixes # (issue) + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## How has this change been tested? + +Please describe the tests that you ran to verify your changes. +Provide instructions so we can reproduce. +Please also list any relevant details for your test configuration. + +- [ ] Test A +- [ ] Test B + +## Checklist + +- [ ] My code builds locally with no new warnings (`scripts/build.sh`) +- [ ] My code follows the style guidelines (`scripts/lint.sh` and `scripts/format.sh`) +- [ ] New and existing unit tests pass locally with my changes (`scripts/test.sh`) +- [ ] I have made corresponding changes to the documentation +- [ ] I have added tests that prove my fix is effective or that my feature works + +## Declaration + +I confirm this contribution is made under an Apache 2.0 license and that I have the authority +necessary to make this contribution on behalf of its copyright owner. diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..952e6b8 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,41 @@ +name: build +on: + pull_request: + push: + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + name: build (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Rust + run: rustup toolchain add --profile minimal stable --component clippy,rustfmt + # Cargo setup + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + + - name: Format + run: scripts/format.sh + shell: bash + - name: Build + run: scripts/build.sh + shell: bash + - name: Lint + run: scripts/lint.sh + shell: bash + - name: Test + run: scripts/test.sh + shell: bash diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3431d42 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,69 @@ +name: release +on: + workflow_run: + workflows: [build] + branches: [main] + types: + - completed + workflow_dispatch: + branches: [main] + +jobs: + tag-release: + if: ${{ github.event.workflow_run.conclusion == 'success' }} || ${{ github.event.workflow_dispatch }} + name: tag-release (ubuntu-latest) + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create-release.outputs.upload_url }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Set up Rust + run: rustup toolchain add --profile minimal stable --component clippy,rustfmt + + # Cargo setup + - name: Set up Cargo cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} + + # Tag the commit with the library version + - name: Create git tag + uses: salsify/action-detect-and-tag-new-version@v2 + with: + version-command: scripts/get_version.sh + + # Set release output variables + - name: Set output + id: vars + run: | + echo "TAG_NAME=v$(scripts/get_version.sh)" >> $GITHUB_ENV + echo "RELEASE_NAME=$(scripts/get_version.sh)" >> $GITHUB_ENV + echo "## Release notes" > NOTES.md + sed -n '/^## /{n; :a; /^## /q; p; n; ba}' CHANGELOG.md >> NOTES.md + # Create GitHub release + - name: Create release + id: create-release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.RELEASE_NAME }} + tag_name: ${{ env.TAG_NAME }} + append_body: true + body_path: ./NOTES.md + prerelease: false + + - name: Remove notes + # Force to not error if it doesn't exist + run: rm --force NOTES.md + + - name: Publish to crates.io + run: cargo publish --token ${CARGO_REGISTRY_TOKEN} + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ffa7226 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +# Changelog + +## 0.3.0 - 2025-09-11 +- Initial public release diff --git a/Cargo.toml b/Cargo.toml index 057f9a6..ffd1501 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "epoch" +name = "epoch-to" authors = ["Databento "] version = "0.3.0" edition = "2021" @@ -11,6 +11,9 @@ keywords = ["epoch", "timestamps"] # see https://crates.io/category_slugs categories = ["command-line-utilities", "date-and-time", "value-formatting"] +[[bin]] +name = "epoch" +path = "src/main.rs" [dependencies] anyhow = "1.0.98" diff --git a/README.md b/README.md index a9426be..cf94e0f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ [![build](https://github.com/databento/epoch/actions/workflows/build.yaml/badge.svg)](https://github.com/databento/epoch/actions/workflows/build.yaml) [![license](https://img.shields.io/github/license/databento/epoch?color=blue)](./LICENSE) -[![Current Crates.io Version](https://img.shields.io/crates/v/epoch-cli.svg)](https://crates.io/crates/epoch-cli) +[![Current Crates.io Version](https://img.shields.io/crates/v/epoch-to.svg)](https://crates.io/crates/epoch-to) Utility for making UNIX timestamps human-readable diff --git a/src/main.rs b/src/main.rs index 1a0b507..7552a59 100644 --- a/src/main.rs +++ b/src/main.rs @@ -155,6 +155,7 @@ fn main() -> anyhow::Result<()> { for line in stdin().lock().lines() { reformatter.write(&mut output, &line?)?; output.write_all(b"\n")?; + output.flush()?; } }