Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77a5caf54b | ||
|
|
7c7b8fbbff | ||
|
|
ab89553767 | ||
|
|
5d15c12d99 | ||
|
|
b1e766fe8f | ||
|
|
dd8fb2fac4 | ||
|
|
ab3f022734 | ||
|
|
e41de97f0a | ||
|
|
d788e00f15 |
25
.github/workflows/lint.yml
vendored
Normal file
25
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Lint
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Check that code is lint clean using precious
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.email "jdoe@example.com"
|
||||
git config --global user.name "J. Doe"
|
||||
- name: Run install-dev-tools.sh
|
||||
run: |
|
||||
set -e
|
||||
mkdir $HOME/bin
|
||||
./dev/bin/install-dev-tools.sh
|
||||
- name: Run precious
|
||||
run: |
|
||||
PATH=$PATH:$HOME/bin precious lint -a
|
||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@@ -181,21 +181,21 @@ jobs:
|
||||
cp -a test-project/* .
|
||||
rm -fr test-project
|
||||
- name: Run both commands
|
||||
uses: "houseabsolute/actions-rust-cross@v0"
|
||||
uses: ./
|
||||
with:
|
||||
command: both
|
||||
target: ${{ matrix.platform.target }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: ${{ matrix.platform.can_test }}
|
||||
- name: Run test command
|
||||
uses: "houseabsolute/actions-rust-cross@v0"
|
||||
uses: ./
|
||||
with:
|
||||
command: test
|
||||
target: ${{ matrix.platform.target }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: ${{ matrix.platform.can_test }}
|
||||
- name: Run build command
|
||||
uses: "houseabsolute/actions-rust-cross@v0"
|
||||
uses: ./
|
||||
with:
|
||||
command: build
|
||||
target: ${{ matrix.platform.target }}
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age,
|
||||
body size, disability, ethnicity, gender identity and expression, level of
|
||||
experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers
|
||||
pledge to making participation in our project and our community a harassment-free experience for
|
||||
everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level
|
||||
of experience, education, socio-economic status, nationality, personal appearance, race, religion,
|
||||
or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
@@ -22,53 +20,46 @@ include:
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
- Publishing others' private information, such as a physical or electronic address, without explicit
|
||||
permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are
|
||||
expected to take appropriate and fair corrective action in response to any instances of unacceptable
|
||||
behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits,
|
||||
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or
|
||||
to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an
|
||||
appointed representative at an online or offline event. Representation of a
|
||||
project may be further defined and clarified by project maintainers.
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is
|
||||
representing the project or its community. Examples of representing a project or community include
|
||||
using an official project e-mail address, posting via an official social media account, or acting as
|
||||
an appointed representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at autarch@urth.org. All complaints
|
||||
will be reviewed and investigated and will result in a response that is deemed
|
||||
necessary and appropriate to the circumstances. The project team is obligated
|
||||
to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
|
||||
the project team at autarch@urth.org. All complaints will be reviewed and investigated and will
|
||||
result in a response that is deemed necessary and appropriate to the circumstances. The project team
|
||||
is obligated to maintain confidentiality with regard to the reporter of an incident. Further details
|
||||
of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face
|
||||
temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 1.4, available at
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at
|
||||
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
38
Changes.md
38
Changes.md
@@ -1,29 +1,37 @@
|
||||
## 0.0.8 - 2023-07-22
|
||||
|
||||
- For builds that need the `cross` binary, this binary is now cached. A cache hit saves about 20
|
||||
seconds in my tests. Suggested by @timon-schelling. GH #4.
|
||||
|
||||
## 0.0.7 - 2023-04-21
|
||||
|
||||
- The toolchain argument was (probably) not being respected with cross builds, though it's hard to
|
||||
be sure since none of the output from past CI runs I've looked at it includes the toolchain
|
||||
version in the output. But now the toolchain version is explicitly passed to all `cargo` and
|
||||
`cross` commands.
|
||||
|
||||
## 0.0.6 - 2023-04-21
|
||||
|
||||
- When the `strip` parameter was true, stripping binaries could fail if there
|
||||
were both `target/*/debug` and `target/*/release` directories present and
|
||||
the `debug` directory didn't have a binary. Now it will strip all binaries
|
||||
it finds under `target`.
|
||||
- When the `strip` parameter was true, stripping binaries could fail if there were both
|
||||
`target/*/debug` and `target/*/release` directories present and the `debug` directory didn't have
|
||||
a binary. Now it will strip all binaries it finds under `target`.
|
||||
|
||||
## 0.0.5 - 2023-03-19
|
||||
|
||||
- Fix use of `dtolnay/rust-toolchain` action to allow passing a `toolchain`
|
||||
input.
|
||||
- Fix use of `dtolnay/rust-toolchain` action to allow passing a `toolchain` input.
|
||||
|
||||
## 0.0.4 - 2023-03-19
|
||||
|
||||
- Added a new `toolchain` parameter to allow selecting a Rust toolchain other
|
||||
than stable. This supports picking on of "stable", "beta", or "nightly".
|
||||
- Fixed binary stripping to work in more situations. Previously it depended on
|
||||
a very specific setup plus expected to be run in the context of the matrix I
|
||||
use for my own projects.
|
||||
- Fixed a reference to a matrix variable that should have referenced an input
|
||||
variable.
|
||||
- Added a new `toolchain` parameter to allow selecting a Rust toolchain other than stable. This
|
||||
supports picking on of "stable", "beta", or "nightly".
|
||||
- Fixed binary stripping to work in more situations. Previously it depended on a very specific setup
|
||||
plus expected to be run in the context of the matrix I use for my own projects.
|
||||
- Fixed a reference to a matrix variable that should have referenced an input variable.
|
||||
|
||||
## 0.0.3 - 2023-03-17
|
||||
|
||||
- This action now supports running the `build` and `test` commands, or both,
|
||||
with a new input parameter, `command`. The default is `build`.
|
||||
- This action now supports running the `build` and `test` commands, or both, with a new input
|
||||
parameter, `command`. The default is `build`.
|
||||
|
||||
## 0.0.2 - 2023-03-05
|
||||
|
||||
|
||||
@@ -83,3 +83,9 @@ corner cases, like compiling the `openssl` crate with the `vendored` feature.
|
||||
Finally, it will run `strip` to strip the binary if the `strip` parameter is true. This is only
|
||||
possible for builds that are not done via `cross`. In addition, Windows builds for `aarch64` cannot
|
||||
be stripped either.
|
||||
|
||||
## Caching Rust Compilation Output
|
||||
|
||||
You can use the [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) action with this one
|
||||
seemlessly, whether or not a specific build target needs `cross. There is no special configuration
|
||||
that you need for this. It just works.
|
||||
|
||||
42
action.yml
42
action.yml
@@ -39,32 +39,46 @@ runs:
|
||||
id: determine-cross-compile
|
||||
shell: bash
|
||||
run: set-cross-compile.sh ${{ inputs.target }}
|
||||
- name: Install toolchain if not cross-compiling
|
||||
- name: Install toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
targets: ${{ inputs.target }}
|
||||
toolchain: ${{ inputs.toolchain }}
|
||||
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'false' }}
|
||||
- name: Install cross if cross-compiling (*nix)
|
||||
- name: Determine latest cross version
|
||||
id: determine-latest-cross-version
|
||||
shell: bash
|
||||
run: install-cross-nix.sh
|
||||
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' && runner.os != 'Windows' }}
|
||||
run: determine-latest-cross-version.sh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||
- name: Install cross if cross-compiling (Windows)
|
||||
shell: powershell
|
||||
run: install-cross-windows.ps1
|
||||
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' && runner.os == 'Windows' }}
|
||||
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' }}
|
||||
# We need to accesss this in both this YAML config and shell scripts. It
|
||||
# doesn't seem like using ${{ env.RUNNER_TEMP }} works in the YAML config.
|
||||
- name: Set directory for installing cross
|
||||
id: set-cross-dir
|
||||
shell: bash
|
||||
run: set-cross-dir.sh
|
||||
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' }}
|
||||
- name: Cache cross
|
||||
id: cache-cross
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.set-cross-dir.outputs.cross-dir }}/cross
|
||||
key: ${{ runner.os }}-${{ steps.determine-latest-cross-version.outputs.cross-version }}
|
||||
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' }}
|
||||
- name: Install cross if cross-compiling (*nix)
|
||||
shell: bash
|
||||
run: install-cross-nix.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
|
||||
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' && steps.cache-cross.outputs.cache-hit != 'true' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||
- name: Set build command
|
||||
id: set-build-command
|
||||
shell: bash
|
||||
run: set-build-command.sh
|
||||
run: set-build-command.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
|
||||
- name: Run tests (*nix)
|
||||
shell: bash
|
||||
run: |
|
||||
${{ steps.set-build-command.outputs.build-command }} test ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
if: ${{ inputs.command != 'build' && runner.os != 'Windows' }}
|
||||
# We want to run in Powershell on Windows to make sure we compile in a
|
||||
# native Windows environment. Some things won't compile properly under
|
||||
@@ -73,17 +87,17 @@ runs:
|
||||
- name: Run tests (Windows)
|
||||
shell: powershell
|
||||
run: |
|
||||
& ${{ steps.set-build-command.outputs.build-command }} test ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} test ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
if: ${{ inputs.command != 'build' && runner.os == 'Windows' }}
|
||||
- name: Build binary (*nix)
|
||||
shell: bash
|
||||
run: |
|
||||
${{ steps.set-build-command.outputs.build-command }} build ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
if: ${{ inputs.command != 'test' && runner.os != 'Windows' }}
|
||||
- name: Build binary (Windows)
|
||||
shell: powershell
|
||||
run: |
|
||||
& ${{ steps.set-build-command.outputs.build-command }} build ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
& ${{ steps.set-build-command.outputs.build-command }} +${{inputs.toolchain}} build ${{ inputs.args }} --target ${{ inputs.target }}
|
||||
if: ${{ inputs.command != 'test' && runner.os == 'Windows' }}
|
||||
- name: Strip binary
|
||||
shell: bash
|
||||
|
||||
11
determine-latest-cross-version.sh
Executable file
11
determine-latest-cross-version.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
set -e
|
||||
set -x
|
||||
set -o pipefail
|
||||
|
||||
JSON=$( curl \
|
||||
--request GET \
|
||||
--header "Authorization: Bearer $GITHUB_TOKEN" \
|
||||
https://api.github.com/repos/cross-rs/cross/releases/latest )
|
||||
VERSION=$( echo "$JSON" | jq -r ".tag_name")
|
||||
|
||||
echo "cross-version=$VERSION" >> $GITHUB_OUTPUT
|
||||
@@ -11,8 +11,8 @@ 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 "ubi --project houseabsolute/omegasort --in ~/bin"
|
||||
run "npm install prettier"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
set -e
|
||||
set -x
|
||||
set -o pipefail
|
||||
|
||||
cd "$RUNNER_TEMP"
|
||||
CROSS_DIR="$1"
|
||||
cd "$CROSS_DIR"
|
||||
export TARGET=.
|
||||
curl --silent --location \
|
||||
https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh |
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
cd $Env:RUNNER_TEMP
|
||||
Invoke-WebRequest -URI 'https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.ps1' -UseBasicParsing | Invoke-Expression
|
||||
.\ubi --project cross-rs/cross --in .
|
||||
|
||||
@@ -2,9 +2,19 @@ exclude = [
|
||||
"target",
|
||||
]
|
||||
|
||||
[commands.prettier]
|
||||
[commands.prettier-md]
|
||||
type = "both"
|
||||
include = [ "**/*.md", "**/*.yml" ]
|
||||
include = [ "**/*.md" ]
|
||||
cmd = [ "./node_modules/.bin/prettier", "--no-config", "--print-width", "100", "--prose-wrap", "always" ]
|
||||
lint_flags = "--check"
|
||||
tidy_flags = "--write"
|
||||
ok_exit_codes = 0
|
||||
lint_failure_exit_codes = 1
|
||||
ignore_stderr = [ "Code style issues" ]
|
||||
|
||||
[commands.prettier-yml]
|
||||
type = "both"
|
||||
include = [ "**/*.yml" ]
|
||||
cmd = [ "./node_modules/.bin/prettier", "--no-config" ]
|
||||
lint_flags = "--check"
|
||||
tidy_flags = "--write"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ -f "$RUNNER_TEMP/cross" ]; then
|
||||
echo "build-command=$RUNNER_TEMP/cross" >> $GITHUB_OUTPUT
|
||||
CROSS_DIR="$1"
|
||||
if [ -f "$CROSS_DIR/cross" ]; then
|
||||
echo "build-command=$CROSS_DIR/cross" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "build-command=cargo" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
4
set-cross-dir.sh
Executable file
4
set-cross-dir.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
set -e
|
||||
set -x
|
||||
|
||||
echo "cross-dir=$RUNNER_TEMP" >> $GITHUB_OUTPUT
|
||||
Reference in New Issue
Block a user