about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTom Milligan <tommilligan@users.noreply.github.com>2022-06-21 16:23:13 +0100
committerGitHub <noreply@github.com>2022-06-21 10:23:13 -0500
commit2c8b3bef2bb5d708e047afc4d0dadf0a85528470 (patch)
treebafba72f055d77ba9f87fe9b22d49d32112eb5d7
parent3de1a095e0ed52ade1b88d165d44d80455d3e6c5 (diff)
downloadrust-2c8b3bef2bb5d708e047afc4d0dadf0a85528470.tar.gz
rust-2c8b3bef2bb5d708e047afc4d0dadf0a85528470.zip
ci: include config_proc_macro crate in ci (#5389)
* config_proc_macro: fix failing doctests

* ci: include config_proc_macro crate in ci

* [review] working native windows ci

* [fix] add --locked file for ci

* [fix] quoting of cmd variables
-rw-r--r--.github/workflows/linux.yml14
-rw-r--r--.github/workflows/mac.yml10
-rw-r--r--.github/workflows/windows.yml11
-rwxr-xr-xci/build_and_test.bat14
-rwxr-xr-xci/build_and_test.sh18
-rw-r--r--config_proc_macro/Cargo.lock44
-rw-r--r--config_proc_macro/src/lib.rs4
7 files changed, 64 insertions, 51 deletions
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 6a3f9d89d98..bce9b0c8d5a 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -35,15 +35,5 @@ jobs:
         sh rustup-init.sh -y --default-toolchain none
         rustup target add ${{ matrix.target }}
 
-    - name: build
-      run: |
-        rustc -Vv
-        cargo -V
-        cargo build
-      env:
-        RUSTFLAGS: '-D warnings'
-
-    - name: test
-      run: cargo test
-      env:
-        RUSTFLAGS: '-D warnings'
+    - name: Build and Test
+      run: ./ci/build_and_test.sh
diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml
index 7dfda3142ca..89a980c42c5 100644
--- a/.github/workflows/mac.yml
+++ b/.github/workflows/mac.yml
@@ -32,11 +32,5 @@ jobs:
         sh rustup-init.sh -y --default-toolchain none
         rustup target add ${{ matrix.target }}
 
-    - name: build
-      run: |
-        rustc -Vv
-        cargo -V
-        cargo build
-
-    - name: test
-      run: cargo test
+    - name: Build and Test
+      run: ./ci/build_and_test.sh
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 4ebc2963849..ec37c714b08 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -57,13 +57,6 @@ jobs:
       if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
       shell: bash
 
-    - name: build
-      run: |
-        rustc -Vv
-        cargo -V
-        cargo build
-      shell: cmd
-
-    - name: test
-      run: cargo test
+    - name: Build and Test
       shell: cmd
+      run: ci\build_and_test.bat
diff --git a/ci/build_and_test.bat b/ci/build_and_test.bat
new file mode 100755
index 00000000000..ef41017783f
--- /dev/null
+++ b/ci/build_and_test.bat
@@ -0,0 +1,14 @@
+set "RUSTFLAGS=-D warnings"
+
+:: Print version information
+rustc -Vv || exit /b 1
+cargo -V || exit /b 1
+
+:: Build and test main crate
+cargo build --locked || exit /b 1
+cargo test || exit /b 1
+
+:: Build and test other crates
+cd config_proc_macro || exit /b 1
+cargo build --locked || exit /b 1
+cargo test || exit /b 1
diff --git a/ci/build_and_test.sh b/ci/build_and_test.sh
new file mode 100755
index 00000000000..8fa0f67b0d0
--- /dev/null
+++ b/ci/build_and_test.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -euo pipefail
+
+export RUSTFLAGS="-D warnings"
+
+# Print version information
+rustc -Vv
+cargo -V
+
+# Build and test main crate
+cargo build --locked
+cargo test
+
+# Build and test other crates
+cd config_proc_macro
+cargo build --locked
+cargo test
diff --git a/config_proc_macro/Cargo.lock b/config_proc_macro/Cargo.lock
index abcf9654e5d..ecf561f28fb 100644
--- a/config_proc_macro/Cargo.lock
+++ b/config_proc_macro/Cargo.lock
@@ -1,68 +1,68 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+version = 3
+
 [[package]]
 name = "proc-macro2"
 version = "1.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8"
 dependencies = [
- "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid",
 ]
 
 [[package]]
 name = "quote"
 version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
 dependencies = [
- "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2",
 ]
 
 [[package]]
 name = "rustfmt-config_proc_macro"
-version = "0.1.2"
+version = "0.2.0"
 dependencies = [
- "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2",
+ "quote",
+ "serde",
+ "syn",
 ]
 
 [[package]]
 name = "serde"
 version = "1.0.99"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f"
 dependencies = [
- "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
 version = "1.0.99"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425"
 dependencies = [
- "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "syn"
 version = "1.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
 dependencies = [
- "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2",
+ "quote",
+ "unicode-xid",
 ]
 
 [[package]]
 name = "unicode-xid"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[metadata]
-"checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8"
-"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
-"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f"
-"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425"
-"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
-"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
+checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
diff --git a/config_proc_macro/src/lib.rs b/config_proc_macro/src/lib.rs
index 51301821319..e772c53f423 100644
--- a/config_proc_macro/src/lib.rs
+++ b/config_proc_macro/src/lib.rs
@@ -29,6 +29,8 @@ pub fn config_type(_args: TokenStream, input: TokenStream) -> TokenStream {
 /// Used to conditionally output the TokenStream for tests that need to be run on nightly only.
 ///
 /// ```rust
+/// # use rustfmt_config_proc_macro::nightly_only_test;
+///
 /// #[nightly_only_test]
 /// #[test]
 /// fn test_needs_nightly_rustfmt() {
@@ -49,6 +51,8 @@ pub fn nightly_only_test(_args: TokenStream, input: TokenStream) -> TokenStream
 /// Used to conditionally output the TokenStream for tests that need to be run on stable only.
 ///
 /// ```rust
+/// # use rustfmt_config_proc_macro::stable_only_test;
+///
 /// #[stable_only_test]
 /// #[test]
 /// fn test_needs_stable_rustfmt() {