Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtask #788

Merged
merged 3 commits into from
Jun 13, 2022
Merged

xtask #788

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[alias]
cross-dev = ["run", "--bin", "cross-dev", "--features", "dev", "--"]
build-docker-image = ["cross-dev", "build-docker-image"]
xtask = ["run", "-p", "xtask", "--"]
build-docker-image = ["xtask", "build-docker-image"]
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ jobs:
if: matrix.deploy
run: cargo install --path . --force

- name: Install cross-dev
run: cargo install --path . --force --features=dev --bin cross-dev --debug
- name: Build xtask
run: cargo build -p xtask

- name: Docker Meta
if: runner.os == 'Linux'
Expand All @@ -229,7 +229,7 @@ jobs:
id: build-docker-image
if: runner.os == 'Linux'
timeout-minutes: 60
run: cross-dev build-docker-image "${TARGET}"
run: cargo xtask build-docker-image -v "${TARGET}"
env:
TARGET: ${{ matrix.target }}
LABELS: ${{ steps.docker-meta.outputs.labels }}
Expand Down Expand Up @@ -287,7 +287,7 @@ jobs:
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ||
startsWith(github.ref, 'refs/tags/v')
)
run: cross-dev build-docker-image --push "${TARGET}"
run: cargo xtask build-docker-image -v --push "${TARGET}"
env:
TARGET: ${{ matrix.target }}
LABELS: ${{ steps.docker-meta2.outputs.labels }}
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

- #775 - forward Cargo exit code to host
- #772 - added `CROSS_CONTAINER_OPTS` environment variable to replace `DOCKER_OPTS`.
- #767 - added the `cross-util` and `cross-dev` commands.
- #767, #788 - added the `cross-util` and `xtask` commands.
- #745 - added `thumbv7neon-*` targets.
- #741 - added `armv7-unknown-linux-gnueabi` and `armv7-unknown-linux-musleabi` targets.
- #721 - add support for running doctests on nightly if `CROSS_UNSTABLE_ENABLE_DOCTESTS=true`.
Expand Down
15 changes: 14 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ edition = "2021"

[features]
default = []
dev = ["serde_yaml", "walkdir"]
dev = []

[workspace]
members = ["xtask"]

[dependencies]
atty = "0.2"
# Pinned until further action to migrate to newer clap, see https://github.com/clap-rs/clap/issues/3822#issuecomment-1154069623
clap = { version = "~3.1", features = ["derive", "env"] }
clap = { version = "~3.1", features = ["derive"] }
color-eyre = "0.6"
eyre = "0.6"
home = "0.5"
Expand All @@ -26,10 +29,8 @@ which = { version = "4", default_features = false }
shell-escape = "0.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = { version = "0.8", optional = true }
serde_ignored = "0.1.2"
shell-words = "1.1.0"
walkdir = { version = "2", optional = true }

[target.'cfg(not(windows))'.dependencies]
nix = { version = "0.24", default-features = false, features = ["user"] }
Expand All @@ -46,8 +47,3 @@ lto = true
regex = "1"
once_cell = "1"
walkdir = "2"

[[bin]]
name = "cross-dev"
path = "cross-dev/main.rs"
required-features = ["dev"]
18 changes: 18 additions & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
documentation = "https://github.com/cross-rs/cross"
license = "MIT OR Apache-2.0"
name = "xtask"
repository = "https://github.com/cross-rs/cross"
version = "0.0.0-dev.0"
edition = "2021"


[dependencies]
cross = { path = "..", features = ["dev"] }
walkdir = { version = "2" }
color-eyre = "0.6"
eyre = "0.6"
clap = { version = "~3.1", features = ["derive", "env"] }
which = { version = "4", default_features = false }
serde = { version = "1", features = ["derive"] }
serde_yaml = "0.8"
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn build_docker_image(

if ["staging", "trying"]
.iter()
.any(|branch| branch == &ref_name)
.any(|branch| branch != &ref_name)
{
tags.push(format!("{image_name}:edge"));
}
Expand Down Expand Up @@ -159,7 +159,7 @@ pub fn build_docker_image(
println!("::set-output name=image::{}", &tags[0])
}
}
if (std::env::var("GITHUB_ACTIONS").is_ok() || !force) && push {
if !(std::env::var("GITHUB_ACTIONS").is_ok() || !push || force) {
panic!("refusing to push, use --force to override");
}
Ok(())
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cross-dev/target_info.rs → xtask/src/target_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use serde::Deserialize;
// Store raw text data in the binary so we don't need a data directory
// when extracting all targets, or running our target info script.
const TARGET_INFO_SCRIPT: &str = include_str!("target_info.sh");
const WORKFLOW: &str = include_str!("../.github/workflows/ci.yml");
const WORKFLOW: &str = include_str!("../../.github/workflows/ci.yml");

#[derive(Args, Debug)]
pub struct TargetInfo {
Expand Down
File renamed without changes.