3 Commits

Author SHA1 Message Date
Dave Rolsky
9a602122c2 Changes for v0.0.2 2023-03-05 15:16:31 -06:00
Dave Rolsky
b34ced72c6 Add dev tooling to use precious 2023-03-05 15:15:31 -06:00
Dave Rolsky
aa7ccd3cba Fix typos in README.md 2023-03-05 15:15:22 -06:00
7 changed files with 122 additions and 3 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
/node_modules
/package-lock.json
/package.json
.\#*
\#*\#

View File

@@ -1,3 +1,7 @@
## 0.0.2 - 2023-03-05
- Fixed some typos in the `README.md` documentation.
## 0.0.1 - 2023-03-05
* First release upon an unsuspecting world.
- First release upon an unsuspecting world.

View File

@@ -3,7 +3,7 @@
This action lets you easily cross-compile Rust projects using
[cross](https://github.com/cross-rs/cross).
Here's an example from the release workflor for
Here's an example from the release workflow for
[my tool `precious`](https://github.com/houseabsolute/precious):
```yaml
@@ -55,7 +55,7 @@ This action takes the following parameters:
| -------------- | --------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `target` | string | yes | The target triple to compile for. This should be one of the targets listed by running `rustup target list`. |
| `GITHUB_TOKEN` | string | no | Defaults to the value of `${{ github.token }}`. |
| `args` | string | no | A string-separated list of arguments to be passed to the `cross build`, like `--release --locked`. |
| `args` | string | no | A string-separated list of arguments to be passed to `cross build`, like `--release --locked`. |
| `strip` | boolean (`true` or `false`) | no | If this is true, then the resulting binary will be stripped if possible. This is only possible for binaries which weren't cross-compiled. |
## How it Works

43
dev/bin/install-dev-tools.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
set -eo pipefail
function run () {
echo $1
eval $1
}
function install_tools () {
curl --silent --location \
https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh |
sh
run "rustup component add clippy"
run "ubi --project houseabsolute/precious --in ~/bin"
run "npm install prettier"
}
if [ "$1" == "-v" ]; then
set -x
fi
mkdir -p $HOME/bin
set +e
echo ":$PATH:" | grep --extended-regexp ":$HOME/bin:" >& /dev/null
if [ "$?" -eq "0" ]; then
path_has_home_bin=1
fi
set -e
if [ -z "$path_has_home_bin" ]; then
PATH=$HOME/bin:$PATH
fi
install_tools
echo "Tools were installed into $HOME/bin."
if [ -z "$path_has_home_bin" ]; then
echo "You should add $HOME/bin to your PATH."
fi
exit 0

15
git/hooks/pre-commit.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
status=0
PRECIOUS=$(which precious)
if [[ -z $PRECIOUS ]]; then
PRECIOUS=./bin/precious
fi
"$PRECIOUS" lint -s
if (( $? != 0 )); then
status+=1
fi
exit $status

26
git/setup.pl Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd qw( abs_path );
symlink_hook('pre-commit');
sub symlink_hook {
my $hook = shift;
my $dot = ".git/hooks/$hook";
my $file = "git/hooks/$hook.sh";
my $link = "../../$file";
if ( -e $dot ) {
if ( -l $dot ) {
return if readlink $dot eq $link;
}
warn "You already have a hook at $dot!\n";
return;
}
symlink $link, $dot;
}

26
precious.toml Normal file
View File

@@ -0,0 +1,26 @@
exclude = [
"target",
]
[commands.prettier]
type = "both"
include = [ "**/*.md", "**/*.yml" ]
cmd = [ "./node_modules/.bin/prettier", "--no-config" ]
lint_flags = "--check"
tidy_flags = "--write"
ok_exit_codes = 0
lint_failure_exit_codes = 1
ignore_stderr = [ "Code style issues" ]
[commands.omegasort-gitignore]
type = "both"
include = "**/.gitignore"
cmd = [ "omegasort", "--sort", "path", "--unique" ]
lint_flags = "--check"
tidy_flags = "--in-place"
ok_exit_codes = 0
lint_failure_exit_codes = 1
ignore_stderr = [
"The .+ file is not sorted",
"The .+ file is not unique",
]