From 9624e09ff4f8bc58b395e7fe72262f9139a8eac3 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Mon, 19 Jun 2023 15:01:33 +0200 Subject: [PATCH] Cleanup template --- .github/workflows/rust-ci.yml | 178 ++++------------------------ .github/workflows/rustdoc-pages.yml | 64 ---------- .mergify.yml | 9 +- CHANGELOG.md | 28 +---- Cargo.toml | 7 ++ README.md | 31 +---- release.toml | 2 +- src/lib.rs | 0 8 files changed, 39 insertions(+), 280 deletions(-) delete mode 100644 .github/workflows/rustdoc-pages.yml create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 3278b80..ef1eb53 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -1,198 +1,60 @@ -# TODO: Replace this line with the commented ones to actually run the action in your repo(s) -on: public -# on: -# push: -# branches: -# - main -# tags: -# - "*" -# pull_request: +on: + push: + branches: + - main + tags: + - "*" + pull_request: name: CI jobs: lint: name: Lint - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - override: true + components: "clippy, rustfmt" + - uses: Swatinem/rust-cache@v2 # make sure all code has been formatted with rustfmt - name: check rustfmt - run: | - rustup component add rustfmt - cargo fmt -- --check --color always + run: cargo fmt -- --check --color always # run clippy to verify we have no warnings - run: cargo fetch - name: cargo clippy - run: | - rustup component add clippy - cargo clippy --all-targets --all-features -- -D warnings + run: cargo clippy --all-targets --all-features -- -D warnings test: name: Test strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] + os: [ubuntu-22.04, windows-12] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: dtolnay/rust-toolchain@stable - run: cargo fetch - name: cargo test build - # Note the use of release here means longer compile time, but much - # faster test execution time. If you don't have any heavy tests it - # might be faster to take off release and just compile in debug - run: cargo build --tests --release + run: cargo build --tests --all-features - name: cargo test - run: cargo test --release + run: cargo test --all-features - # TODO: Remove this check if you don't use cargo-deny in the repo deny-check: name: cargo-deny - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: EmbarkStudios/cargo-deny-action@v1 - # TODO: Remove this check if you don't publish the crate(s) from this repo publish-check: name: Publish Check - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - uses: dtolnay/rust-toolchain@stable - run: cargo fetch - name: cargo publish check run: cargo publish --dry-run - - # TODO: Remove this job if you don't release binaries - # Replace occurances of $BIN_NAME with the name of your binary - release: - name: Release - needs: [test, deny-check] - if: startsWith(github.ref, 'refs/tags/') - strategy: - matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] - include: - - os: ubuntu-latest - rust: stable - target: x86_64-unknown-linux-musl - bin: $BIN_NAME - # We don't enable the progress feature when targeting - # musl since there are some dependencies on shared libs - features: "" - - os: windows-latest - rust: stable - target: x86_64-pc-windows-msvc - bin: $BIN_NAME.exe - features: progress - - os: macOS-latest - rust: stable - target: x86_64-apple-darwin - bin: $BIN_NAME - features: progress - runs-on: ${{ matrix.os }} - steps: - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - target: ${{ matrix.target }} - - name: Install musl tools - if: matrix.os == 'ubuntu-latest' - run: sudo apt-get install -y musl-tools - - name: Checkout - uses: actions/checkout@v3 - - run: cargo fetch --target ${{ matrix.target }} - - name: Release build - shell: bash - run: | - if [ "${{ matrix.features }}" != "" ]; then - cargo build --release --target ${{ matrix.target }} --features ${{ matrix.features }} - else - cargo build --release --target ${{ matrix.target }} - fi - - name: Package - shell: bash - run: | - name=$BIN_NAME - tag=$(git describe --tags --abbrev=0) - release_name="$name-$tag-${{ matrix.target }}" - release_tar="${release_name}.tar.gz" - mkdir "$release_name" - - if [ "${{ matrix.target }}" != "x86_64-pc-windows-msvc" ]; then - strip "target/${{ matrix.target }}/release/${{ matrix.bin }}" - fi - - cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "$release_name/" - cp README.md LICENSE-APACHE LICENSE-MIT "$release_name/" - tar czvf "$release_tar" "$release_name" - - rm -r "$release_name" - - # Windows environments in github actions don't have the gnu coreutils installed, - # which includes the shasum exe, so we just use powershell instead - if [ "${{ matrix.os }}" == "windows-latest" ]; then - echo "(Get-FileHash \"${release_tar}\" -Algorithm SHA256).Hash | Out-File -Encoding ASCII -NoNewline \"${release_tar}.sha256\"" | pwsh -c - - else - echo -n "$(shasum -ba 256 "${release_tar}" | cut -d " " -f 1)" > "${release_tar}.sha256" - fi - - name: Publish - uses: softprops/action-gh-release@v1 - with: - draft: true - files: "$BIN_NAME*" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # TODO: Remove this job if you don't publish container images on each release - # TODO: Create a repository on DockerHub with the same name as the GitHub repo - # TODO: Add the new repo to the buildbot group with read & write permissions - # TODO: Add the embarkbot dockerhub password to the repo secrets as DOCKERHUB_PASSWORD - publish-container-images: - name: Publish container images - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - needs: [test, deny-check] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to Dockerhub - uses: docker/login-action@v1 - with: - username: embarkbot - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Docker meta - id: docker_meta - uses: crazy-max/ghaction-docker-meta@v1 - with: - images: embarkstudios/${{ github.event.repository.name }} - tag-semver: | - {{version}} - {{major}}.{{minor}} - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ steps.docker_meta.outputs.tags }} - labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/.github/workflows/rustdoc-pages.yml b/.github/workflows/rustdoc-pages.yml deleted file mode 100644 index 2450699..0000000 --- a/.github/workflows/rustdoc-pages.yml +++ /dev/null @@ -1,64 +0,0 @@ -# Publishes docs built off latest git main branch to a GitHub Pages site. -# The docs root will then be served at https://$YOUR_USERNAME.github.io/$REPO_NAME/$CRATE_NAME/index.html -# For example, https://embarkstudios.github.io/presser/presser/index.html -# -# You must also go to the Pages settings for your repo and set it to serve from Actions for this to work -name: Publish Docs - -# TODO: Replace this line with the commented ones to actually run the action in your repo(s) -on: public -# on: -# workflow_dispatch: -# push: -# branches: [ "main" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - name: Build Docs - - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Rust Env - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - - name: Build Docs - run: RUSTDOCFLAGS="--cfg docs_build" cargo doc - - name: Setup Pages - id: pages - uses: actions/configure-pages@v2 - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - with: - # Upload entire doc folder - path: './target/doc' - - deploy: - name: Deploy to Pages - - needs: build - - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment - permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment originates from an appropriate source - - # Deploy to the github-pages environment - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - # Specify runner + deployment step - runs-on: ubuntu-latest - - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.mergify.yml b/.mergify.yml index 51f3119..7bea7e0 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -7,13 +7,6 @@ pull_request_rules: - "#review-threads-unresolved=0" - base=main - label!=block-automerge - # TODO: If you're not a Rust project and aren't using the bundled rust-ci workflows, - # remove these or change them to the relevant CI job names: - - check-success=Lint - - check-success=Build & Test (ubuntu-latest) - - check-success=Build & Test (windows-latest) - - check-success=Build & Test (macOS-latest) - - check-success=Publish Check actions: merge: method: squash @@ -21,4 +14,4 @@ pull_request_rules: conditions: - merged actions: - delete_head_branch: {} \ No newline at end of file + delete_head_branch: {} diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d96b42..4abd7c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,30 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate -## [0.1.1] - 2019-09-03 +## [0.0.1] - 2023-06-19 ### Added -- New features go here in a bullet list - -### Changed -- Changes to existing functionality go here in a bullet list - -### Deprecated -- Mark features soon-to-be removed in a bullet list - -### Removed -- Features that have been removed in a bullet list - -### Fixed -- Bug fixes in a bullet list - -### Security -- Changes/fixes related to security vulnerabilities in a bullet list - -## [0.1.0] - 2019-09-02 -### Added -- Initial add of the thing +- Initial crate squat -[Unreleased]: https://github.com/EmbarkStudios/$REPO_NAME/compare/0.1.1...HEAD -[0.1.1]: https://github.com/EmbarkStudios/$REPO_NAME/compare/0.1.0...0.1.1 -[0.1.0]: https://github.com/EmbarkStudios/$REPO_NAME/releases/tag/0.1.0 +[Unreleased]: https://github.com/EmbarkStudios/tame-index/compare/0.0.1...HEAD +[0.0.1]: https://github.com/EmbarkStudios/tame-index/releases/tag/0.0.1 diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..3086770 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "tame-index" +version = "0.1.0" +edition = "2021" +rust-version = "1.70.0" + +[dependencies] diff --git a/README.md b/README.md index 0c48f41..6a46d3c 100644 --- a/README.md +++ b/README.md @@ -6,37 +6,18 @@
- -# `🌻 opensource-template` +# `📇 tame-index` - -**Template for creating new open source repositories that follow the Embark open source guidelines** - - +**Small crate for interacting with cargo indices** [![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev) [![Embark](https://img.shields.io/badge/discord-ark-%237289da.svg?logo=discord)](https://discord.gg/dAuKfZS) -[![Crates.io](https://img.shields.io/crates/v/rust-gpu.svg)](https://crates.io/crates/rust-gpu) -[![Docs](https://docs.rs/rust-gpu/badge.svg)](https://docs.rs/rust-gpu) -[![Git Docs](https://img.shields.io/badge/git%20main%20docs-published-blue)](https://embarkstudios.github.io/presser/presser/index.html) -[![dependency status](https://deps.rs/repo/github/EmbarkStudios/rust-gpu/status.svg)](https://deps.rs/repo/github/EmbarkStudios/rust-gpu) -[![Build status](https://github.com/EmbarkStudios/physx-rs/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/physx-rs/actions) +[![Crates.io](https://img.shields.io/crates/v/tame-index.svg)](https://crates.io/crates/tame-index) +[![Docs](https://docs.rs/tame-index/badge.svg)](https://docs.rs/tame-index) +[![dependency status](https://deps.rs/repo/github/EmbarkStudios/tame-index/status.svg)](https://deps.rs/repo/github/EmbarkStudios/tame-index) +[![Build status](https://github.com/EmbarkStudios/tame-index/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/tame-index/actions)
-## TEMPLATE INSTRUCTIONS - -1. Create a new repository under EmbarkStudios using this template. -1. **Title:** Change the first line of this README to the name of your project, and replace the sunflower with an emoji that represents your project. 🚨 Your emoji selection is critical. -1. **Badges:** In the badges section above, change the repo name in each URL. If you are creating something other than a Rust crate, remove the crates.io and docs badges (and feel free to add more appropriate ones for your language). -1. **CI:** In `./github/workflows/` rename `rust-ci.yml` (or the appropriate config for your language) to `ci.yml`. And go over it and adapt it to work for your project - - If you aren't using or customized the CI workflow, also see the TODO in `.mergify.yml` - - If you want to use the automatic rustdoc publishing to github pages for git main, see `rustdoc-pages.yml` -1. **Issue & PR Templates**: Review the files in `.github/ISSUE_TEMPLATE` and `.github/pull_request_template`. Adapt them -to suit your needs, removing or re-wording any sections that don't make sense for your use case. -1. **CHANGELOG.md:** Change the `$REPO_NAME` in the links at the bottom to the name of the repository, and replace the example template lines with the actual notes for the repository/crate. -1. **release.toml:** in `./release.toml` change the `$REPO_NAME` to the name of the repository -1. **Cleanup:** Remove this section of the README and any unused files (such as configs for other languages) from the repo. - ## Contributing [![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4-ff69b4.svg)](CODE_OF_CONDUCT.md) diff --git a/release.toml b/release.toml index b915562..c999106 100644 --- a/release.toml +++ b/release.toml @@ -7,5 +7,5 @@ pre-release-replacements = [ { file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}" }, { file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}" }, { file = "CHANGELOG.md", search = "", replace = "\n## [Unreleased] - ReleaseDate" }, - { file = "CHANGELOG.md", search = "", replace = "\n[Unreleased]: https://github.com/EmbarkStudios/$REPO_NAME/compare/{{tag_name}}...HEAD" }, + { file = "CHANGELOG.md", search = "", replace = "\n[Unreleased]: https://github.com/EmbarkStudios/tame-index/compare/{{tag_name}}...HEAD" }, ] diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..e69de29