-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI CD, coverage report, LICENSE, etc.
- Loading branch information
Showing
10 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DESTDIR="${PWD}/target/cover" | ||
|
||
rustup component add llvm-tools | ||
cargo install grcov | ||
|
||
export RUSTFLAGS="-Cinstrument-coverage" | ||
export LLVM_PROFILE_FILE="${DESTDIR}/default_%m_%p.profraw" | ||
cargo test | ||
|
||
grcov "${DESTDIR}" \ | ||
--ignore '**/clang-sys*/**' \ | ||
--ignore "$HOME/.cargo/**" \ | ||
--ignore-not-existing \ | ||
--ignore '**/tests/**' \ | ||
--ignore 'build.rs' \ | ||
--ignore 'target/**' \ | ||
--excl-start '#(\[cfg\(test\)\]|\[test\])' \ | ||
--excl-line 'unreachable\!\(\)' \ | ||
--llvm \ | ||
--binary-path "target/debug/" \ | ||
-s . \ | ||
--branch \ | ||
-o "${DESTDIR}" \ | ||
--token 5DOLLPIHEO \ | ||
--output-types html,coveralls | ||
|
||
if [ "$(uname -o)" = "Darwin" ] && [ -z "$CI" ]; then | ||
open "${DESTDIR}/html/index.html" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: 📦 Cargo Publish | ||
on: | ||
push: | ||
branches-ignore: [wip/**] | ||
tags: ["**"] | ||
pull_request: | ||
jobs: | ||
test: | ||
name: 📦 Cargo ${{ startsWith(github.ref, 'refs/tags') && 'Publish' || 'Package' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Rust Cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: { toolchain: stable } | ||
- name: Package | ||
run: cargo publish --dry-run | ||
- name: Publish | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
run: | | ||
v="v$(grep "^version" Cargo.toml | sed -r 's/version[^"]+"([^"]+).*/\1/')" | ||
if [ "$v" != "$GITHUB_REF_NAME" ]; then | ||
printf "Cargo.toml version %s does not match tag %s\n" "$v" "$GITHUB_REF_NAME" >&2 | ||
exit 1 | ||
fi | ||
cargo publish | ||
if: startsWith( github.ref, 'refs/tags/v' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: 🧪 Test and Lint | ||
on: | ||
push: | ||
branches-ignore: [wip/**] | ||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [[🐧, Ubuntu], [🍎, macOS], [🪟, Windows]] | ||
toolchain: ["stable", "beta", "nightly"] | ||
name: 🦀 ${{ matrix.toolchain }} on ${{ matrix.os[0] }} ${{ matrix.os[1] }} | ||
runs-on: ${{ matrix.os[1] }}-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Rust Cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: { toolchain: "${{ matrix.toolchain }}" } | ||
- name: Test | ||
run: make test | ||
|
||
lint: | ||
name: 🔎 Lint and Cover | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Rust Cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Run pre-commit | ||
uses: pre-commit/[email protected] | ||
- uses: actions-rust-lang/audit@v1 | ||
name: Audit Rust Dependencies | ||
- name: Generate Coverage | ||
run: make cover RUST_BACKTRACE=1 | ||
- name: Publish Coverage | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: pgxn/deps | ||
files: target/cover/coveralls | ||
- name: Clear Badge Cache | ||
uses: kevincobain2000/action-camo-purge@v1 | ||
if: github.ref_name == 'main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
.DS_Store | ||
.idea/ | ||
/target | ||
.vscode/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# auth-global hooks will be managed / updated across all auth repos. | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
name: Lint trailing whitespace | ||
exclude_types: [image] | ||
- id: end-of-file-fixer | ||
name: Lint end-of-file newline | ||
exclude_types: [image] | ||
- id: check-added-large-files | ||
name: Don't permit large files | ||
exclude_types: [image] | ||
|
||
- repo: local | ||
hooks: | ||
- id: cargo-doc | ||
name: cargo doc | ||
entry: cargo doc | ||
language: system | ||
pass_filenames: false | ||
|
||
- repo: https://github.com/backplane/pre-commit-rust-hooks | ||
rev: v1.1.0 | ||
hooks: | ||
- id: fmt | ||
- id: check | ||
- id: clippy | ||
# - id: test | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.1.0 | ||
hooks: | ||
- id: prettier | ||
name: JSON and YAML formatting | ||
types_or: [json, yaml] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. It uses the | ||
[Keep a Changelog] format, and this project adheres to [Semantic Versioning]. | ||
|
||
[Keep a Changelog]: https://keepachangelog.com/en/1.1.0/ | ||
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html | ||
"Semantic Versioning 2.0.0" | ||
|
||
## [v0.1.0] — Unreleased | ||
|
||
The theme of this release is *Foundations.* | ||
|
||
### ⚡ Improvements | ||
|
||
* First release, everything is new! | ||
* `pgxn_deps` crate | ||
|
||
### 🏗️ Build Setup | ||
|
||
* Built with Rust | ||
* Install from [crates.io] or [GitHub] | ||
|
||
[v0.1.0]: https://github.com/pgxn/deps/compare/20b058a...v0.1.0 | ||
[crates.io]: https://crates.io/crates/deps | ||
[GitHub]: https://github.com/pgxn/deps/releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Code of Conduct | ||
=============== | ||
|
||
PGXN abides by the [PostgresSQL Code of Conduct](https://www.postgresql.org/about/policies/coc/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Copyright (c) 2010-2024 The PGXN Maintainers. | ||
|
||
This module is free software; you can redistribute it and/or modify it under | ||
the [PostgreSQL License](https://www.opensource.org/licenses/postgresql). | ||
|
||
Permission to use, copy, modify, and distribute this software and its | ||
documentation for any purpose, without fee, and without a written agreement is | ||
hereby granted, provided that the above copyright notice and this paragraph | ||
and the following two paragraphs appear in all copies. | ||
|
||
In no event shall The pg-semver Maintainers be liable to any party for direct, | ||
indirect, special, incidental, or consequential damages, including lost | ||
profits, arising out of the use of this software and its documentation, even | ||
if The pg-semver Maintainers have been advised of the possibility of such | ||
damage. | ||
|
||
The pg-semver Maintainers specifically disclaim any warranties, including, but | ||
not limited to, the implied warranties of merchantability and fitness for a | ||
particular purpose. The software provided hereunder is on an "as is" basis, | ||
and The pg-semver Maintainers no obligations to provide maintenance, support, | ||
updates, enhancements, or modifications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.PHONY: test # Run the full test suite. | ||
test: | ||
@cargo test | ||
|
||
.git/hooks/pre-commit: | ||
@printf "#!/bin/sh\nmake lint\n" > $@ | ||
@chmod +x $@ | ||
|
||
.PHONY: lint # Lint the project | ||
lint: .pre-commit-config.yaml | ||
@pre-commit run --show-diff-on-failure --color=always --all-files | ||
|
||
.PHONY: cover # Run cover tests and generate & open a report. | ||
cover: | ||
@./.ci/test-cover | ||
|
||
.PHONY: docs # Generate and open cargo docs. | ||
docs: target/doc/pgxn_deps/index.html | ||
open $< | ||
|
||
target/doc/pgxn_deps/index.html: $(shell find . -name \*.rs) | ||
cargo doc | ||
|
||
VERSION = $(shell perl -nE '/^version\s*=\s*"([^"]+)/ && do { say $$1; exit }' Cargo.toml) | ||
.PHONY: release-notes # Show release notes for current version (must have `mknotes` in PATH). | ||
release-notes: CHANGELOG.md | ||
mknotes -v v$(VERSION) -f $< -r https://github.com/$(or $(GITHUB_REPOSITORY),pgxn/deps) | ||
|
||
.PHONY: clean # Remove generated files | ||
clean: | ||
@rm -rf target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# PGXN Dependencies Crate | ||
|
||
[![license-badge]][license] [![crates-badge]][crates] [![release-badge]][release] [![ci-badge]][ci] [![cov-badge]][cov] [![docs-badge]][docs] [![deps-badge]][deps] | ||
|
||
**The pgxn_deps crate determines OS-specific installation patterns for [PGXN] | ||
system Dependencies.** | ||
|
||
--- | ||
|
||
Contributing | ||
------------ | ||
|
||
We welcome community contributions to this project. All contributors must | ||
abide by the [PostgresSQL Code of Conduct]. | ||
|
||
* Create [Issues] to submit bug reports and feature requests | ||
* Submit [Pull Requests] to fix issues or add features | ||
|
||
License | ||
------- | ||
|
||
This project is distributed under the [PostgreSQL License][license]. | ||
|
||
[license-badge]: https://img.shields.io/badge/License-PostgreSQL-blue.svg "⚖️ PostgreSQL License" | ||
[license]: https://opensource.org/licenses/PostgreSQL "⚖️ PostgreSQL License" | ||
[crates-badge]: https://img.shields.io/crates/v/pgxn_deps.svg "📦 Crate" | ||
[crates]: https://crates.io/crates/pgxn_deps "📦 Crate" | ||
[docs-badge]: https://docs.rs/pgxn_deps/badge.svg "📚 Docs Status" | ||
[docs]: https://docs.rs/pgxn_deps "📚 Docs Status" | ||
[ci-badge]: https://github.com/pgxn/deps/actions/workflows/test-and-lint.yml/badge.svg "🧪 Test and Lint" | ||
[ci]: https://github.com/pgxn/deps/actions/workflows/test-and-lint "🧪 Test and Lint" | ||
[cov-badge]: https://codecov.io/gh/pgxn/deps/graph/badge.svg?token=s1oeDPKWwM "📊 Code Coverage" | ||
[cov]: https://codecov.io/gh/pgxn/deps "📊 Code Coverage" | ||
[deps-badge]: https://deps.rs/repo/github/pgxn/deps/status.svg "⬆️ Dependency Status" | ||
[deps]: https://deps.rs/repo/github/pgxn/deps "⬆️ Dependency Status" | ||
[release-badge]: https://img.shields.io/github/release/pgxn/deps.svg "🚀 Latest Release" | ||
[release]: https://github.com/pgxn/deps/releases/latest "🚀 Latest Release" | ||
[PGXN]: https://pgxn.org "PGXN: PostgreSQL Extension Network" | ||
[PostgresSQL Code of Conduct]: https://www.postgresql.org/about/policies/coc/ | ||
[`pgxn_deps` docs on docs.rs]: https://docs.rs/ubi/latest/pgxn_deps/ | ||
[Issues]: https://github.com/pgxn/deps/issues | ||
[Pull Requests]: https://github.com/pgxn/deps/pulls |