Skip to content

Commit

Permalink
Cleanup template
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Jun 19, 2023
1 parent ad8d04f commit 9624e09
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 280 deletions.
178 changes: 20 additions & 158 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -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 }}
64 changes: 0 additions & 64 deletions .github/workflows/rustdoc-pages.yml

This file was deleted.

9 changes: 1 addition & 8 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,11 @@ 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
- name: delete head branch after merge
conditions:
- merged
actions:
delete_head_branch: {}
delete_head_branch: {}
28 changes: 4 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- next-header -->
## [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

<!-- next-url -->
[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
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "tame-index"
version = "0.1.0"
edition = "2021"
rust-version = "1.70.0"

[dependencies]
31 changes: 6 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,18 @@

<div align="center">

<!--- FIXME: Pick an emoji and name your project! --->
# `🌻 opensource-template`
# `📇 tame-index`

<!--- FIXME: Write short catchy description/tagline of project --->
**Template for creating new open source repositories that follow the Embark open source guidelines**

<!--- FIXME: Update crate, repo and CI workflow names here! Remove any that are not relevant --->
**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)
</div>

## 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)
Expand Down
2 changes: 1 addition & 1 deletion release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<!-- next-header -->", replace = "<!-- next-header -->\n## [Unreleased] - ReleaseDate" },
{ file = "CHANGELOG.md", search = "<!-- next-url -->", replace = "<!-- next-url -->\n[Unreleased]: https://github.com/EmbarkStudios/$REPO_NAME/compare/{{tag_name}}...HEAD" },
{ file = "CHANGELOG.md", search = "<!-- next-url -->", replace = "<!-- next-url -->\n[Unreleased]: https://github.com/EmbarkStudios/tame-index/compare/{{tag_name}}...HEAD" },
]
Empty file added src/lib.rs
Empty file.

0 comments on commit 9624e09

Please sign in to comment.