Skip to content

Commit 55edc46

Browse files
authored
Merge pull request #33 from artichoke/sync-boba-best-practices
build and project improvements
2 parents aa34429 + fd43872 commit 55edc46

File tree

6 files changed

+165
-8
lines changed

6 files changed

+165
-8
lines changed

.github/labels.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@
104104
"color": "d3dddd",
105105
"description": "Status: This issue or pull request is not well-formed."
106106
},
107+
{
108+
"name": "S-speculative",
109+
"color": "d3dddd",
110+
"description": "Status: This is just an idea."
111+
},
107112
{
108113
"name": "S-wip",
109114
"color": "d3dddd",

.github/workflows/audit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: |
2222
curl -sL "$RELEASE" | sudo tar xvz -C /usr/local/bin/ --strip-components=1
2323
env:
24-
RELEASE: "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.6.6/cargo-deny-0.6.6-x86_64-unknown-linux-musl.tar.gz"
24+
RELEASE: "https://github.com/EmbarkStudios/cargo-deny/releases/download/0.6.8/cargo-deny-0.6.8-x86_64-unknown-linux-musl.tar.gz"
2525

2626
- name: Run cargo-deny
2727
run: cargo-deny check

.github/workflows/ci.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,3 @@ jobs:
8080

8181
- name: Format with prettier
8282
run: npx prettier --check '**/*'
83-
84-
- name: Format markdown with prettier
85-
run: npx prettier --prose-wrap always --check '**/*.md'
86-
87-
- name: Format YAML with prettier
88-
run: npx prettier --prose-wrap always --check '**/*.{yaml,yml}'

.github/workflows/rustdoc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
env:
1616
RUSTFLAGS: -D warnings
17+
RUSTDOCFLAGS: -D warnings
1718
RUST_BACKTRACE: 1
1819

1920
steps:
@@ -29,7 +30,7 @@ jobs:
2930
components: rustfmt, rust-src
3031

3132
- name: Build Documentation
32-
run: cargo doc --all --no-deps
33+
run: cargo doc
3334

3435
- name: Deploy Docs
3536
uses: peaceiris/actions-gh-pages@v3

.prettierrc.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
overrides:
2+
# Always wrap markdown
3+
- files: "*.md"
4+
options:
5+
proseWrap: always
6+
# Preserve wrap for yaml as wrapping make some commands less readable
7+
- files: "*.{yaml,yml}"
8+
options:
9+
proseWrap: preserve

CONTRIBUTING.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Contributing to Artichoke – rand_mt
2+
3+
👋 Hi and welcome to [Artichoke](https://github.com/artichoke). Thanks for
4+
taking the time to contribute! 💪💎🙌
5+
6+
Artichoke aspires to be a Ruby 2.6.3-compatible implementation of the Ruby
7+
programming language.
8+
[There is lots to do](https://github.com/artichoke/artichoke/issues).
9+
10+
rand_mt is used to implement the default psuedorandom number generator that
11+
backs the [`Random` core class](https://ruby-doc.org/core-2.6.3/Random.html).
12+
13+
If Artichoke does not run Ruby source code in the same way that MRI does, it is
14+
a bug and we would appreciate if you
15+
[filed an issue so we can fix it](https://github.com/artichoke/artichoke/issues/new).
16+
[File bugs specific to rand_mt in this repository](https://github.com/artichoke/rand_mt/issues/new).
17+
18+
If you would like to contribute code to rand_mt 👩‍💻👨‍💻, find an issue that looks
19+
interesting and leave a comment that you're beginning to investigate. If there
20+
is no issue, please file one before beginning to work on a PR.
21+
[Good first issues are labeled `E-easy`](https://github.com/artichoke/rand_mt/labels/E-easy).
22+
23+
## Discussion
24+
25+
If you'd like to engage in a discussion outside of GitHub, you can
26+
[join Artichoke's public Discord server](https://discord.gg/QCe2tp2).
27+
28+
## Setup
29+
30+
rand_mt includes Rust and Text sources. Developing on rand_mt requires
31+
configuring several dependencies.
32+
33+
### Rust Toolchain
34+
35+
rand_mt depends on Rust and several compiler plugins for linting and formatting.
36+
rand_mt is guaranteed to build on the latest stable release of the Rust
37+
compiler.
38+
39+
#### Installation
40+
41+
The recommended way to install the Rust toolchain is with
42+
[rustup](https://rustup.rs/). On macOS, you can install rustup with
43+
[Homebrew](https://docs.brew.sh/Installation):
44+
45+
```sh
46+
brew install rustup-init
47+
rustup-init
48+
```
49+
50+
Once you have rustup, you can install the Rust toolchain needed to compile
51+
rand_mt:
52+
53+
```sh
54+
rustup toolchain install stable
55+
rustup component add rustfmt
56+
rustup component add clippy
57+
```
58+
59+
To update your stable Rust compiler to the latest version, run:
60+
61+
```sh
62+
rustup update stable
63+
```
64+
65+
### Rust Crates
66+
67+
rand_mt depends on several Rust libraries, or crates. Once you have the Rust
68+
toolchain installed, you can install the crates specified in
69+
[`Cargo.toml`](Cargo.toml) by running:
70+
71+
```sh
72+
cargo build
73+
```
74+
75+
### Node.js
76+
77+
Node.js is an optional dependency that is used for formatting text sources with
78+
[prettier](https://prettier.io/).
79+
80+
Node.js is only required for formatting if modifying the following filetypes:
81+
82+
- `md`
83+
- `yaml`
84+
- `yml`
85+
86+
You will need to install
87+
[Node.js](https://nodejs.org/en/download/package-manager/).
88+
89+
On macOS, you can install Node.js with
90+
[Homebrew](https://docs.brew.sh/Installation):
91+
92+
```sh
93+
brew install node
94+
```
95+
96+
## Linting
97+
98+
To lint and format Rust sources run:
99+
100+
```sh
101+
cargo fmt
102+
touch src/lib.rs
103+
cargo clippy --all-targets --all-features
104+
```
105+
106+
To lint and format text sources run:
107+
108+
```sh
109+
npx prettier --write '**/*'
110+
```
111+
112+
## Testing
113+
114+
A PR must have new or existing tests for it to be merged. The
115+
[Rust book chapter on testing](https://doc.rust-lang.org/book/ch11-00-testing.html)
116+
is a good place to start.
117+
118+
To run tests:
119+
120+
```sh
121+
cargo test
122+
```
123+
124+
`cargo test` accepts a filter argument that will limit test execution to tests
125+
that substring match. For example, to run all of the tests for encoding:
126+
127+
```sh
128+
cargo test encode
129+
```
130+
131+
Tests are run for every PR. All builds must pass before merging a PR.
132+
133+
## Updating Dependencies
134+
135+
### Rust Crates
136+
137+
Version specifiers in `Cargo.toml` are NPM caret-style by default. A version
138+
specifier of `4.1.2` means `4.1.2 <= version < 5.0.0`.
139+
140+
To see what crates are outdated, you can use
141+
[cargo-outdated](https://github.com/kbknapp/cargo-outdated).
142+
143+
If you need to pull in an updated version of a crate for a bugfix or a new
144+
feature, update the version number in `Cargo.toml`. See
145+
[Artichoke GH-548](https://github.com/artichoke/artichoke/pull/548) for an
146+
example.
147+
148+
Regular dependency bumps are handled by [@dependabot](https://dependabot.com/).

0 commit comments

Comments
 (0)