Skip to content

Commit

Permalink
Merge pull request #1 from EmbarkStudios/impl
Browse files Browse the repository at this point in the history
Initial implementation
  • Loading branch information
Jake-Shadle authored Feb 20, 2024
2 parents e1d9ac8 + 3997e4b commit 555634e
Show file tree
Hide file tree
Showing 212 changed files with 8,893 additions and 338 deletions.
82 changes: 82 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[target.'cfg(all())']
rustflags = [
# BEGIN - Embark standard lints v6 for Rust 1.55+
# do not change or add/remove here, but one can add exceptions after this section
# for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
"-Dunsafe_code",
"-Wclippy::all",
"-Wclippy::await_holding_lock",
"-Wclippy::char_lit_as_u8",
"-Wclippy::checked_conversions",
"-Wclippy::dbg_macro",
"-Wclippy::debug_assert_with_mut_call",
"-Wclippy::doc_markdown",
"-Wclippy::empty_enum",
"-Wclippy::enum_glob_use",
"-Wclippy::exit",
"-Wclippy::expl_impl_clone_on_copy",
"-Wclippy::explicit_deref_methods",
"-Wclippy::explicit_into_iter_loop",
"-Wclippy::fallible_impl_from",
"-Wclippy::filter_map_next",
"-Wclippy::flat_map_option",
"-Wclippy::float_cmp_const",
"-Wclippy::fn_params_excessive_bools",
"-Wclippy::from_iter_instead_of_collect",
"-Wclippy::if_let_mutex",
"-Wclippy::implicit_clone",
"-Wclippy::imprecise_flops",
"-Wclippy::inefficient_to_string",
"-Wclippy::invalid_upcast_comparisons",
"-Wclippy::large_digit_groups",
"-Wclippy::large_stack_arrays",
"-Wclippy::large_types_passed_by_value",
"-Wclippy::let_unit_value",
"-Wclippy::linkedlist",
"-Wclippy::lossy_float_literal",
"-Wclippy::macro_use_imports",
"-Wclippy::manual_ok_or",
"-Wclippy::map_err_ignore",
"-Wclippy::map_flatten",
"-Wclippy::map_unwrap_or",
"-Wclippy::match_on_vec_items",
"-Wclippy::match_same_arms",
"-Wclippy::match_wild_err_arm",
"-Wclippy::match_wildcard_for_single_variants",
"-Wclippy::mem_forget",
"-Wclippy::mismatched_target_os",
"-Wclippy::missing_enforced_import_renames",
"-Wclippy::mut_mut",
"-Wclippy::mutex_integer",
"-Wclippy::needless_borrow",
"-Wclippy::needless_continue",
"-Wclippy::needless_for_each",
"-Wclippy::option_option",
"-Wclippy::path_buf_push_overwrite",
"-Wclippy::ptr_as_ptr",
"-Wclippy::rc_mutex",
"-Wclippy::ref_option_ref",
"-Wclippy::rest_pat_in_fully_bound_structs",
"-Wclippy::same_functions_in_if_condition",
"-Wclippy::semicolon_if_nothing_returned",
"-Wclippy::single_match_else",
"-Wclippy::string_add_assign",
"-Wclippy::string_add",
"-Wclippy::string_lit_as_bytes",
"-Wclippy::string_to_string",
"-Wclippy::todo",
"-Wclippy::trait_duplication_in_bounds",
"-Wclippy::unimplemented",
"-Wclippy::unnested_or_patterns",
"-Wclippy::unused_self",
"-Wclippy::useless_transmute",
"-Wclippy::verbose_file_reads",
"-Wclippy::zero_sized_map_values",
"-Wfuture_incompatible",
"-Wnonstandard_style",
"-Wrust_2018_idioms",
# END - Embark standard lints v6 for Rust 1.55+
]

[target.'cfg(target_env = "musl")']
rustflags = ["-C", "target-feature=+crt-static"]
186 changes: 25 additions & 161 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# 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:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

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
with:
toolchain: stable
override: true
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

# make sure all code has been formatted with rustfmt
- name: check rustfmt
Expand All @@ -35,164 +34,29 @@ jobs:
test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions/checkout@v4
- 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
- name: cargo test
run: cargo test --release
run: cargo test

# 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: actions/checkout@v4
- 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: actions/checkout@v4
- 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 }}
run: cargo publish --dry-run -p toml-span
64 changes: 0 additions & 64 deletions .github/workflows/rustdoc-pages.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/target
**/*.rs.bk
Cargo.lock
**.snap.new
24 changes: 0 additions & 24 deletions .mergify.yml

This file was deleted.

Loading

0 comments on commit 555634e

Please sign in to comment.