Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and deploy actions #6

Merged
merged 11 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release - crate

env:
PIPELINE: test
RELEASE_TARGET: x86_64-unknown-linux-gnu

on:
push:
tags:
- 'release/**'

jobs:
test-release:
uses: ./.github/workflows/test.yml
push-crates:
runs-on: ubuntu-latest
needs:
- test-release
steps:
- name: checkout this source code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: push crates to registry
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
make_github_release:
runs-on: ubuntu-latest
if: ${{ success() && github.ref_type == 'tag' }}
needs:
- push-crates
permissions:
contents: write
steps:
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
generateReleaseNotes: false
makeLatest: true
22 changes: 22 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: fmt

on:
pull_request:
paths-ignore:
- README.md
- CHANGELOG.md
- 'doc/**'

jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: FMT
run: |
cargo fmt --all -- --check
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tests

on:
pull_request:
paths-ignore:
- README.md
- CHANGELOG.md
- 'doc/**'
push:
branches:
- main
workflow_call:

env:
RELEASE_TARGET: x86_64-unknown-linux-gnu

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: checkout this source code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: ./source

- name: install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ env.RELEASE_TARGET }}"

- name: restore rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: ./source
cache-on-failure: true
shared-key: all-deps-tests

- name: run tests
working-directory: ./source
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/source/target
run: |
cargo test --all-features
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[workspace]
resolver = "2"
members = ["kind_proc"]

[package]
name = "kind"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
rust-version = "1.65"
description = "Costless typed identifiers backed by UUID, with kind readable in serialized versions"
Expand All @@ -18,13 +22,13 @@ serde = ["dep:serde", "dep:serde_json"]
sqlx = ["dep:sqlx"]

[dependencies]
kind_proc = { path = "kind_proc", version = "0.2.0" }
kind_proc = { path = "kind_proc", version = "0.3.0" }
schemars = { optional = true, version = "0.8.16" }
serde = { optional = true, version = "1.0", features = ["derive"] }
serde_json = { optional = true, version = "1.0" }
sqlx = { optional = true, version = "0.7", default-features = false, features = ["macros", "runtime-async-std-rustls", "postgres", "chrono", "json", "uuid"] }
utoipa = { optional = true, version = "4.2" }
uuid = { version = "1.4", features = ["v4"] }
uuid = { version = "1.7", features = ["v4"] }

[dev-dependencies]
rstest = "0.18"
Expand Down
2 changes: 1 addition & 1 deletion kind_proc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kind_proc"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
rust-version = "1.65"
description = "procedural macro for the 'kind' crate"
Expand Down