From 9e5fb40807f97fe47d2eaca99daeb1f1f6ff07a7 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 20 Jul 2020 08:58:10 -0400 Subject: [PATCH 01/11] 1.45.1 release --- RELEASES.md | 11 +++++++++++ src/bootstrap/channel.rs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index 977796c66132e..12b04bcce198e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,14 @@ +Version 1.45.1 (2020-07-30) +========================== + +* [rustfmt accepts rustfmt_skip in cfg_attr again.][73078] +* [Avoid spurious implicit region bound.][74509] +* [Install clippy on x.py install][74457] + +[73078]: https://github.com/rust-lang/rust/issues/73078 +[74509]: https://github.com/rust-lang/rust/pull/74509 +[74457]: https://github.com/rust-lang/rust/pull/74457 + Version 1.45.0 (2020-07-16) ========================== diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index f9d3b454246b1..85b4dbd72653d 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -13,7 +13,7 @@ use build_helper::output; use crate::Build; // The version number -pub const CFG_RELEASE_NUM: &str = "1.45.0"; +pub const CFG_RELEASE_NUM: &str = "1.45.1"; pub struct GitInfo { inner: Option, From 309234718434a3b2b513de1a82324b542e3d05f7 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 20 Jul 2020 09:08:33 -0400 Subject: [PATCH 02/11] Update to rustfmt 1.4.17 --- Cargo.lock | 2 +- src/tools/rustfmt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6cfedd4a56da8..a243ca49cc93c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4467,7 +4467,7 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "1.4.15" +version = "1.4.17" dependencies = [ "annotate-snippets", "bytecount", diff --git a/src/tools/rustfmt b/src/tools/rustfmt index 530eadf4b42dd..8a93416c2a6b3 160000 --- a/src/tools/rustfmt +++ b/src/tools/rustfmt @@ -1 +1 @@ -Subproject commit 530eadf4b42ddf35b209d4f4acd120f3fcc467ce +Subproject commit 8a93416c2a6b389a7807dcdc6e6111d5f1e9213a From 0f24c5a33871eda38c8a3292ee3dfa9ae384ecb6 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sun, 19 Jul 2020 12:31:42 +0100 Subject: [PATCH 03/11] Use `ReEmpty(U0)` as the implicit region bound in typeck --- src/librustc_typeck/check/mod.rs | 9 --- src/librustc_typeck/check/regionck.rs | 2 +- ...pe-param-outlives-reempty-issue-74429-2.rs | 66 +++++++++++++++++++ ...type-param-outlives-reempty-issue-74429.rs | 35 ++++++++++ 4 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 src/test/ui/regions/type-param-outlives-reempty-issue-74429-2.rs create mode 100644 src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index a8fa65a135ac2..5fbb5cd75d71f 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -255,14 +255,6 @@ pub struct Inherited<'a, 'tcx> { /// opaque type. opaque_types_vars: RefCell, Ty<'tcx>>>, - /// Each type parameter has an implicit region bound that - /// indicates it must outlive at least the function body (the user - /// may specify stronger requirements). This field indicates the - /// region of the callee. If it is `None`, then the parameter - /// environment is for an item or something where the "callee" is - /// not clear. - implicit_region_bound: Option>, - body_id: Option, } @@ -681,7 +673,6 @@ impl Inherited<'a, 'tcx> { deferred_generator_interiors: RefCell::new(Vec::new()), opaque_types: RefCell::new(Default::default()), opaque_types_vars: RefCell::new(Default::default()), - implicit_region_bound: None, body_id, } } diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 90ba15aa08988..6da27d7c0805c 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -308,7 +308,7 @@ impl<'a, 'tcx> RegionCtxt<'a, 'tcx> { fn resolve_regions_and_report_errors(&self, mode: RegionckMode) { self.infcx.process_registered_region_obligations( self.outlives_environment.region_bound_pairs_map(), - self.implicit_region_bound, + Some(self.tcx.lifetimes.re_root_empty), self.param_env, ); diff --git a/src/test/ui/regions/type-param-outlives-reempty-issue-74429-2.rs b/src/test/ui/regions/type-param-outlives-reempty-issue-74429-2.rs new file mode 100644 index 0000000000000..a65c17e0efc3c --- /dev/null +++ b/src/test/ui/regions/type-param-outlives-reempty-issue-74429-2.rs @@ -0,0 +1,66 @@ +// Regression test for #74429, where we didn't think that a type parameter +// outlived `ReEmpty`. + +// check-pass + +use std::marker::PhantomData; +use std::ptr::NonNull; + +pub unsafe trait RawData { + type Elem; +} + +unsafe impl RawData for OwnedRepr { + type Elem = A; +} + +unsafe impl<'a, A> RawData for ViewRepr<&'a A> { + type Elem = A; +} + +pub struct OwnedRepr { + ptr: PhantomData, +} + +// these Copy impls are not necessary for the repro, but allow the code to compile without error +// on 1.44.1 +#[derive(Copy, Clone)] +pub struct ViewRepr { + life: PhantomData, +} + +#[derive(Copy, Clone)] +pub struct ArrayBase +where + S: RawData, +{ + ptr: NonNull, +} + +pub type Array = ArrayBase>; + +pub type ArrayView<'a, A> = ArrayBase>; + +impl ArrayBase +where + S: RawData, +{ + pub fn index_axis(&self) -> ArrayView<'_, A> { + unimplemented!() + } + + pub fn axis_iter<'a>(&'a self) -> std::iter::Empty<&'a A> { + unimplemented!() + } +} + +pub fn x(a: Array) { + // drop just avoids a must_use warning + drop((0..1).filter(|_| true)); + let y = a.index_axis(); + a.axis_iter().for_each(|_| { + drop(y); + }); +} + +fn main() {} diff --git a/src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs b/src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs new file mode 100644 index 0000000000000..d463f311c34e9 --- /dev/null +++ b/src/test/ui/regions/type-param-outlives-reempty-issue-74429.rs @@ -0,0 +1,35 @@ +// Regression test for #74429, where we didn't think that a type parameter +// outlived `ReEmpty`. + +// check-pass + +use std::marker::PhantomData; + +fn apply(_: T, _: F) {} + +#[derive(Clone, Copy)] +struct Invariant { + t: T, + p: PhantomData T>, +} + +fn verify_reempty(x: T) { + // r is inferred to have type `Invariant<&ReEmpty(U0) T>` + let r = Invariant { t: &x, p: PhantomData }; + // Creates a new universe, all variables from now on are in `U1`, say. + let _: fn(&()) = |_| {}; + // Closure parameter is of type `&ReEmpty(U1) T`, so the closure has an implied + // bound of `T: ReEmpty(U1)` + apply(&x, |_| { + // Requires `typeof(r)` is well-formed, i.e. `T: ReEmpty(U0)`. If we + // only have the implied bound from the closure parameter to use this + // requires `ReEmpty(U1): ReEmpty(U0)`, which isn't true so we reported + // an error. + // + // This doesn't happen any more because we ensure that `T: ReEmpty(U0)` + // is an implicit bound for all type parameters. + drop(r); + }); +} + +fn main() {} From 452a29cc2e6c0bc418d4efb398c93cdbdd217434 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Fri, 17 Jul 2020 22:10:37 +0200 Subject: [PATCH 04/11] rustbuild: drop tool::should_install Always install when the build succeeds Fixes #74431 Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/install.rs | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index fafd3cdf927c0..6ad307e302738 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -153,11 +153,6 @@ macro_rules! install { config.extended && config.tools.as_ref() .map_or(true, |t| t.contains($path)) } - - #[allow(dead_code)] - fn should_install(builder: &Builder<'_>) -> bool { - builder.config.tools.as_ref().map_or(false, |t| t.contains($path)) - } } impl Step for $name { @@ -204,8 +199,7 @@ install!((self, builder, _config), install_cargo(builder, self.compiler.stage, self.target); }; Rls, "rls", Self::should_build(_config), only_hosts: true, { - if builder.ensure(dist::Rls { compiler: self.compiler, target: self.target }).is_some() || - Self::should_install(builder) { + if builder.ensure(dist::Rls { compiler: self.compiler, target: self.target }).is_some() { install_rls(builder, self.compiler.stage, self.target); } else { builder.info( @@ -215,17 +209,10 @@ install!((self, builder, _config), }; Clippy, "clippy", Self::should_build(_config), only_hosts: true, { builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target }); - if Self::should_install(builder) { - install_clippy(builder, self.compiler.stage, self.target); - } else { - builder.info( - &format!("skipping Install clippy stage{} ({})", self.compiler.stage, self.target), - ); - } + install_clippy(builder, self.compiler.stage, self.target); }; Miri, "miri", Self::should_build(_config), only_hosts: true, { - if builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }).is_some() || - Self::should_install(builder) { + if builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }).is_some() { install_miri(builder, self.compiler.stage, self.target); } else { builder.info( @@ -237,7 +224,7 @@ install!((self, builder, _config), if builder.ensure(dist::Rustfmt { compiler: self.compiler, target: self.target - }).is_some() || Self::should_install(builder) { + }).is_some() { install_rustfmt(builder, self.compiler.stage, self.target); } else { builder.info( From 38148199511e8ff9f769991770735dad78843f80 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 23 Jul 2020 10:11:29 -0400 Subject: [PATCH 05/11] Bump cargo This is not a user-visible change as Cargo's library API is not exposed by Rust, but this way the version in 1.45.1 will appropriately match with published Cargo 0.46.1. --- Cargo.lock | 2 +- src/tools/cargo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a243ca49cc93c..7ae17b0b25ac8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,7 +284,7 @@ checksum = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" [[package]] name = "cargo" -version = "0.46.0" +version = "0.46.1" dependencies = [ "anyhow", "atty", diff --git a/src/tools/cargo b/src/tools/cargo index 744bd1fbb666f..f242df6edb897 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 744bd1fbb666f33b20b09d5bacc5047957c8ed42 +Subproject commit f242df6edb897f6f69d393a22bb257f5af0f52d0 From 174b58287c66a6ad3eaa1897279d769611919960 Mon Sep 17 00:00:00 2001 From: Jakub Adam Wieczorek Date: Mon, 20 Jul 2020 15:13:00 +0200 Subject: [PATCH 06/11] Fix an ICE on an invalid `binding @ ...` in a tuple struct pattern --- src/librustc_resolve/late.rs | 8 +++++++- src/test/ui/issues/issue-74539.rs | 12 ++++++++++++ src/test/ui/issues/issue-74539.stderr | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/issues/issue-74539.rs create mode 100644 src/test/ui/issues/issue-74539.stderr diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 3b49b3b6ff7d2..2d282c7464ead 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -1407,11 +1407,17 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { pat_src: PatternSource, bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet); 1]>, ) { + let is_tuple_struct_pat = matches!(pat.kind, PatKind::TupleStruct(_, _)); + // Visit all direct subpatterns of this pattern. pat.walk(&mut |pat| { debug!("resolve_pattern pat={:?} node={:?}", pat, pat.kind); match pat.kind { - PatKind::Ident(bmode, ident, ref sub) => { + // In tuple struct patterns ignore the invalid `ident @ ...`. + // It will be handled as an error by the AST lowering. + PatKind::Ident(bmode, ident, ref sub) + if !(is_tuple_struct_pat && sub.as_ref().filter(|p| p.is_rest()).is_some()) => + { // First try to resolve the identifier as some existing entity, // then fall back to a fresh binding. let has_sub = sub.is_some(); diff --git a/src/test/ui/issues/issue-74539.rs b/src/test/ui/issues/issue-74539.rs new file mode 100644 index 0000000000000..75632d11c1df0 --- /dev/null +++ b/src/test/ui/issues/issue-74539.rs @@ -0,0 +1,12 @@ +enum E { + A(u8, u8), +} + +fn main() { + let e = E::A(2, 3); + match e { + E::A(x @ ..) => { //~ ERROR `x @` is not allowed in a tuple + x //~ ERROR cannot find value `x` in this scope + } + }; +} diff --git a/src/test/ui/issues/issue-74539.stderr b/src/test/ui/issues/issue-74539.stderr new file mode 100644 index 0000000000000..94526dcd7cb39 --- /dev/null +++ b/src/test/ui/issues/issue-74539.stderr @@ -0,0 +1,21 @@ +error[E0425]: cannot find value `x` in this scope + --> $DIR/issue-74539.rs:9:13 + | +LL | x + | ^ help: a local variable with a similar name exists: `e` + +error: `x @` is not allowed in a tuple struct + --> $DIR/issue-74539.rs:8:14 + | +LL | E::A(x @ ..) => { + | ^^^^^^ this is only allowed in slice patterns + | + = help: remove this and bind each tuple field independently +help: if you don't need to use the contents of x, discard the tuple's remaining fields + | +LL | E::A(..) => { + | ^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0425`. From d01e1093baf4d5ebe08a067a2a8e720e7fa7eb22 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 23 Jul 2020 11:02:44 -0400 Subject: [PATCH 07/11] delay_span_bug instead of silent ignore --- src/librustc_resolve/late.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 2d282c7464ead..9577a21c743c9 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -1415,16 +1415,22 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { match pat.kind { // In tuple struct patterns ignore the invalid `ident @ ...`. // It will be handled as an error by the AST lowering. - PatKind::Ident(bmode, ident, ref sub) - if !(is_tuple_struct_pat && sub.as_ref().filter(|p| p.is_rest()).is_some()) => - { - // First try to resolve the identifier as some existing entity, - // then fall back to a fresh binding. - let has_sub = sub.is_some(); - let res = self - .try_resolve_as_non_binding(pat_src, pat, bmode, ident, has_sub) - .unwrap_or_else(|| self.fresh_binding(ident, pat.id, pat_src, bindings)); - self.r.record_partial_res(pat.id, PartialRes::new(res)); + PatKind::Ident(bmode, ident, ref sub) => { + if is_tuple_struct_pat && sub.as_ref().filter(|p| p.is_rest()).is_some() { + self.r + .session + .delay_span_bug(ident.span, "ident in tuple pattern is invalid"); + } else { + // First try to resolve the identifier as some existing entity, + // then fall back to a fresh binding. + let has_sub = sub.is_some(); + let res = self + .try_resolve_as_non_binding(pat_src, pat, bmode, ident, has_sub) + .unwrap_or_else(|| { + self.fresh_binding(ident, pat.id, pat_src, bindings) + }); + self.r.record_partial_res(pat.id, PartialRes::new(res)); + } } PatKind::TupleStruct(ref path, ..) => { self.smart_resolve_path(pat.id, None, path, PathSource::TupleStruct); From 7747315455af79afddaef1192e53649ca092ecc4 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 16 Jul 2020 13:47:37 -0400 Subject: [PATCH 08/11] Set shell for github actions CI --- .github/workflows/ci.yml | 58 ++++++++++++++++++++++++++++++++++++ src/ci/github-actions/ci.yml | 20 +++++++++++++ 2 files changed, 78 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3c95226aebf6..534db0f541728 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,65 +66,83 @@ jobs: if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'" - name: add extra environment variables run: src/ci/scripts/setup-environment.sh + shell: bash env: EXTRA_VARIABLES: "${{ toJson(matrix.env) }}" if: success() && !env.SKIP_JOB - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh + shell: bash if: success() && !env.SKIP_JOB - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh + shell: bash if: success() && !env.SKIP_JOB - name: show the current environment run: src/ci/scripts/dump-environment.sh + shell: bash if: success() && !env.SKIP_JOB - name: install awscli run: src/ci/scripts/install-awscli.sh + shell: bash if: success() && !env.SKIP_JOB - name: install sccache run: src/ci/scripts/install-sccache.sh + shell: bash if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh + shell: bash if: success() && !env.SKIP_JOB - name: install WIX run: src/ci/scripts/install-wix.sh + shell: bash if: success() && !env.SKIP_JOB - name: install InnoSetup run: src/ci/scripts/install-innosetup.sh if: success() && !env.SKIP_JOB - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh + shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 run: src/ci/scripts/install-msys2.sh + shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 packages run: src/ci/scripts/install-msys2-packages.sh if: success() && !env.SKIP_JOB - name: install MinGW run: src/ci/scripts/install-mingw.sh + shell: bash if: success() && !env.SKIP_JOB - name: install ninja run: src/ci/scripts/install-ninja.sh + shell: bash if: success() && !env.SKIP_JOB - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh + shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash if: success() && !env.SKIP_JOB - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh + shell: bash if: success() && !env.SKIP_JOB - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh + shell: bash if: success() && !env.SKIP_JOB - name: run the build run: src/ci/scripts/run-build-from-ci.sh + shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}" @@ -132,6 +150,7 @@ jobs: if: success() && !env.SKIP_JOB - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh + shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}" @@ -176,65 +195,83 @@ jobs: if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'" - name: add extra environment variables run: src/ci/scripts/setup-environment.sh + shell: bash env: EXTRA_VARIABLES: "${{ toJson(matrix.env) }}" if: success() && !env.SKIP_JOB - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh + shell: bash if: success() && !env.SKIP_JOB - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh + shell: bash if: success() && !env.SKIP_JOB - name: show the current environment run: src/ci/scripts/dump-environment.sh + shell: bash if: success() && !env.SKIP_JOB - name: install awscli run: src/ci/scripts/install-awscli.sh + shell: bash if: success() && !env.SKIP_JOB - name: install sccache run: src/ci/scripts/install-sccache.sh + shell: bash if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh + shell: bash if: success() && !env.SKIP_JOB - name: install WIX run: src/ci/scripts/install-wix.sh + shell: bash if: success() && !env.SKIP_JOB - name: install InnoSetup run: src/ci/scripts/install-innosetup.sh if: success() && !env.SKIP_JOB - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh + shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 run: src/ci/scripts/install-msys2.sh + shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 packages run: src/ci/scripts/install-msys2-packages.sh if: success() && !env.SKIP_JOB - name: install MinGW run: src/ci/scripts/install-mingw.sh + shell: bash if: success() && !env.SKIP_JOB - name: install ninja run: src/ci/scripts/install-ninja.sh + shell: bash if: success() && !env.SKIP_JOB - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh + shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash if: success() && !env.SKIP_JOB - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh + shell: bash if: success() && !env.SKIP_JOB - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh + shell: bash if: success() && !env.SKIP_JOB - name: run the build run: src/ci/scripts/run-build-from-ci.sh + shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}" @@ -242,6 +279,7 @@ jobs: if: success() && !env.SKIP_JOB - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh + shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}" @@ -528,65 +566,83 @@ jobs: if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'" - name: add extra environment variables run: src/ci/scripts/setup-environment.sh + shell: bash env: EXTRA_VARIABLES: "${{ toJson(matrix.env) }}" if: success() && !env.SKIP_JOB - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh + shell: bash if: success() && !env.SKIP_JOB - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh + shell: bash if: success() && !env.SKIP_JOB - name: show the current environment run: src/ci/scripts/dump-environment.sh + shell: bash if: success() && !env.SKIP_JOB - name: install awscli run: src/ci/scripts/install-awscli.sh + shell: bash if: success() && !env.SKIP_JOB - name: install sccache run: src/ci/scripts/install-sccache.sh + shell: bash if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh + shell: bash if: success() && !env.SKIP_JOB - name: install WIX run: src/ci/scripts/install-wix.sh + shell: bash if: success() && !env.SKIP_JOB - name: install InnoSetup run: src/ci/scripts/install-innosetup.sh if: success() && !env.SKIP_JOB - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh + shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 run: src/ci/scripts/install-msys2.sh + shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 packages run: src/ci/scripts/install-msys2-packages.sh if: success() && !env.SKIP_JOB - name: install MinGW run: src/ci/scripts/install-mingw.sh + shell: bash if: success() && !env.SKIP_JOB - name: install ninja run: src/ci/scripts/install-ninja.sh + shell: bash if: success() && !env.SKIP_JOB - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh + shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash if: success() && !env.SKIP_JOB - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh + shell: bash if: success() && !env.SKIP_JOB - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh + shell: bash if: success() && !env.SKIP_JOB - name: run the build run: src/ci/scripts/run-build-from-ci.sh + shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}" @@ -594,6 +650,7 @@ jobs: if: success() && !env.SKIP_JOB - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh + shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}" @@ -618,6 +675,7 @@ jobs: fetch-depth: 2 - name: publish toolstate run: src/ci/publish_toolstate.sh + shell: bash env: TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}" if: success() && !env.SKIP_JOB diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 92fec593a5410..736ff4b9e7c3e 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -95,6 +95,7 @@ x--expand-yaml-anchors--remove: - name: add extra environment variables run: src/ci/scripts/setup-environment.sh + shell: bash env: # Since it's not possible to merge `${{ matrix.env }}` with the other # variables in `job..env`, the variables defined in the matrix @@ -105,30 +106,37 @@ x--expand-yaml-anchors--remove: - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh + shell: bash <<: *step - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh + shell: bash <<: *step - name: show the current environment run: src/ci/scripts/dump-environment.sh + shell: bash <<: *step - name: install awscli run: src/ci/scripts/install-awscli.sh + shell: bash <<: *step - name: install sccache run: src/ci/scripts/install-sccache.sh + shell: bash <<: *step - name: install clang run: src/ci/scripts/install-clang.sh + shell: bash <<: *step - name: install WIX run: src/ci/scripts/install-wix.sh + shell: bash <<: *step - name: install InnoSetup @@ -137,14 +145,17 @@ x--expand-yaml-anchors--remove: - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh + shell: bash <<: *step - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash <<: *step - name: install MSYS2 run: src/ci/scripts/install-msys2.sh + shell: bash <<: *step - name: install MSYS2 packages @@ -153,14 +164,17 @@ x--expand-yaml-anchors--remove: - name: install MinGW run: src/ci/scripts/install-mingw.sh + shell: bash <<: *step - name: install ninja run: src/ci/scripts/install-ninja.sh + shell: bash <<: *step - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh + shell: bash <<: *step # Disable automatic line ending conversion (again). On Windows, when we're @@ -170,18 +184,22 @@ x--expand-yaml-anchors--remove: # appropriate line endings. - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh + shell: bash <<: *step - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh + shell: bash <<: *step - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh + shell: bash <<: *step - name: run the build run: src/ci/scripts/run-build-from-ci.sh + shell: bash env: AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }} @@ -190,6 +208,7 @@ x--expand-yaml-anchors--remove: - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh + shell: bash env: AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }} @@ -624,6 +643,7 @@ jobs: - name: publish toolstate run: src/ci/publish_toolstate.sh + shell: bash env: TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }} <<: *step From 7d0afb1ea2166f14cb9e2b1880d8968c2d26a605 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Thu, 16 Jul 2020 13:32:46 -0500 Subject: [PATCH 09/11] ci: Set `shell: bash` as a default, remove duplicates A follow-up to #74406, this commit merely removes the `shell: bash` lines where they are explicitly added in favor of setting defaults for *all* "run" steps. Signed-off-by: Kristofer Rye --- .github/workflows/ci.yml | 69 +++++------------------------------- src/ci/github-actions/ci.yml | 23 ++---------- 2 files changed, 12 insertions(+), 80 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 534db0f541728..2ba541fe312cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,10 +51,12 @@ jobs: os: ubuntu-latest-xl timeout-minutes: 600 runs-on: "${{ matrix.os }}" + defaults: + run: + shell: bash steps: - name: disable git crlf conversion run: git config --global core.autocrlf false - shell: bash - name: checkout the source code uses: actions/checkout@v1 with: @@ -66,83 +68,65 @@ jobs: if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'" - name: add extra environment variables run: src/ci/scripts/setup-environment.sh - shell: bash env: EXTRA_VARIABLES: "${{ toJson(matrix.env) }}" if: success() && !env.SKIP_JOB - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh - shell: bash if: success() && !env.SKIP_JOB - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh - shell: bash if: success() && !env.SKIP_JOB - name: show the current environment run: src/ci/scripts/dump-environment.sh - shell: bash if: success() && !env.SKIP_JOB - name: install awscli run: src/ci/scripts/install-awscli.sh - shell: bash if: success() && !env.SKIP_JOB - name: install sccache run: src/ci/scripts/install-sccache.sh - shell: bash if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh - shell: bash if: success() && !env.SKIP_JOB - name: install WIX run: src/ci/scripts/install-wix.sh - shell: bash if: success() && !env.SKIP_JOB - name: install InnoSetup run: src/ci/scripts/install-innosetup.sh if: success() && !env.SKIP_JOB - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh - shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 run: src/ci/scripts/install-msys2.sh - shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 packages run: src/ci/scripts/install-msys2-packages.sh if: success() && !env.SKIP_JOB - name: install MinGW run: src/ci/scripts/install-mingw.sh - shell: bash if: success() && !env.SKIP_JOB - name: install ninja run: src/ci/scripts/install-ninja.sh - shell: bash if: success() && !env.SKIP_JOB - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh - shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash if: success() && !env.SKIP_JOB - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh - shell: bash if: success() && !env.SKIP_JOB - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh - shell: bash if: success() && !env.SKIP_JOB - name: run the build run: src/ci/scripts/run-build-from-ci.sh - shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}" @@ -150,7 +134,6 @@ jobs: if: success() && !env.SKIP_JOB - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh - shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}" @@ -180,10 +163,12 @@ jobs: os: ubuntu-latest-xl timeout-minutes: 600 runs-on: "${{ matrix.os }}" + defaults: + run: + shell: bash steps: - name: disable git crlf conversion run: git config --global core.autocrlf false - shell: bash - name: checkout the source code uses: actions/checkout@v1 with: @@ -195,83 +180,65 @@ jobs: if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'" - name: add extra environment variables run: src/ci/scripts/setup-environment.sh - shell: bash env: EXTRA_VARIABLES: "${{ toJson(matrix.env) }}" if: success() && !env.SKIP_JOB - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh - shell: bash if: success() && !env.SKIP_JOB - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh - shell: bash if: success() && !env.SKIP_JOB - name: show the current environment run: src/ci/scripts/dump-environment.sh - shell: bash if: success() && !env.SKIP_JOB - name: install awscli run: src/ci/scripts/install-awscli.sh - shell: bash if: success() && !env.SKIP_JOB - name: install sccache run: src/ci/scripts/install-sccache.sh - shell: bash if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh - shell: bash if: success() && !env.SKIP_JOB - name: install WIX run: src/ci/scripts/install-wix.sh - shell: bash if: success() && !env.SKIP_JOB - name: install InnoSetup run: src/ci/scripts/install-innosetup.sh if: success() && !env.SKIP_JOB - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh - shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 run: src/ci/scripts/install-msys2.sh - shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 packages run: src/ci/scripts/install-msys2-packages.sh if: success() && !env.SKIP_JOB - name: install MinGW run: src/ci/scripts/install-mingw.sh - shell: bash if: success() && !env.SKIP_JOB - name: install ninja run: src/ci/scripts/install-ninja.sh - shell: bash if: success() && !env.SKIP_JOB - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh - shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash if: success() && !env.SKIP_JOB - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh - shell: bash if: success() && !env.SKIP_JOB - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh - shell: bash if: success() && !env.SKIP_JOB - name: run the build run: src/ci/scripts/run-build-from-ci.sh - shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}" @@ -279,7 +246,6 @@ jobs: if: success() && !env.SKIP_JOB - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh - shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}" @@ -551,10 +517,12 @@ jobs: os: windows-latest-xl timeout-minutes: 600 runs-on: "${{ matrix.os }}" + defaults: + run: + shell: bash steps: - name: disable git crlf conversion run: git config --global core.autocrlf false - shell: bash - name: checkout the source code uses: actions/checkout@v1 with: @@ -566,83 +534,65 @@ jobs: if: "success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'" - name: add extra environment variables run: src/ci/scripts/setup-environment.sh - shell: bash env: EXTRA_VARIABLES: "${{ toJson(matrix.env) }}" if: success() && !env.SKIP_JOB - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh - shell: bash if: success() && !env.SKIP_JOB - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh - shell: bash if: success() && !env.SKIP_JOB - name: show the current environment run: src/ci/scripts/dump-environment.sh - shell: bash if: success() && !env.SKIP_JOB - name: install awscli run: src/ci/scripts/install-awscli.sh - shell: bash if: success() && !env.SKIP_JOB - name: install sccache run: src/ci/scripts/install-sccache.sh - shell: bash if: success() && !env.SKIP_JOB - name: install clang run: src/ci/scripts/install-clang.sh - shell: bash if: success() && !env.SKIP_JOB - name: install WIX run: src/ci/scripts/install-wix.sh - shell: bash if: success() && !env.SKIP_JOB - name: install InnoSetup run: src/ci/scripts/install-innosetup.sh if: success() && !env.SKIP_JOB - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh - shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 run: src/ci/scripts/install-msys2.sh - shell: bash if: success() && !env.SKIP_JOB - name: install MSYS2 packages run: src/ci/scripts/install-msys2-packages.sh if: success() && !env.SKIP_JOB - name: install MinGW run: src/ci/scripts/install-mingw.sh - shell: bash if: success() && !env.SKIP_JOB - name: install ninja run: src/ci/scripts/install-ninja.sh - shell: bash if: success() && !env.SKIP_JOB - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh - shell: bash if: success() && !env.SKIP_JOB - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash if: success() && !env.SKIP_JOB - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh - shell: bash if: success() && !env.SKIP_JOB - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh - shell: bash if: success() && !env.SKIP_JOB - name: run the build run: src/ci/scripts/run-build-from-ci.sh - shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.CACHES_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}" @@ -650,7 +600,6 @@ jobs: if: success() && !env.SKIP_JOB - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh - shell: bash env: AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}" AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}" diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 736ff4b9e7c3e..1902613cfe11c 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -75,11 +75,13 @@ x--expand-yaml-anchors--remove: - &base-ci-job timeout-minutes: 600 runs-on: "${{ matrix.os }}" + defaults: + run: + shell: bash env: *shared-ci-variables steps: - name: disable git crlf conversion run: git config --global core.autocrlf false - shell: bash - name: checkout the source code uses: actions/checkout@v1 @@ -95,7 +97,6 @@ x--expand-yaml-anchors--remove: - name: add extra environment variables run: src/ci/scripts/setup-environment.sh - shell: bash env: # Since it's not possible to merge `${{ matrix.env }}` with the other # variables in `job..env`, the variables defined in the matrix @@ -106,37 +107,30 @@ x--expand-yaml-anchors--remove: - name: decide whether to skip this job run: src/ci/scripts/should-skip-this.sh - shell: bash <<: *step - name: collect CPU statistics run: src/ci/scripts/collect-cpu-stats.sh - shell: bash <<: *step - name: show the current environment run: src/ci/scripts/dump-environment.sh - shell: bash <<: *step - name: install awscli run: src/ci/scripts/install-awscli.sh - shell: bash <<: *step - name: install sccache run: src/ci/scripts/install-sccache.sh - shell: bash <<: *step - name: install clang run: src/ci/scripts/install-clang.sh - shell: bash <<: *step - name: install WIX run: src/ci/scripts/install-wix.sh - shell: bash <<: *step - name: install InnoSetup @@ -145,17 +139,14 @@ x--expand-yaml-anchors--remove: - name: ensure the build happens on a partition with enough space run: src/ci/scripts/symlink-build-dir.sh - shell: bash <<: *step - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash <<: *step - name: install MSYS2 run: src/ci/scripts/install-msys2.sh - shell: bash <<: *step - name: install MSYS2 packages @@ -164,17 +155,14 @@ x--expand-yaml-anchors--remove: - name: install MinGW run: src/ci/scripts/install-mingw.sh - shell: bash <<: *step - name: install ninja run: src/ci/scripts/install-ninja.sh - shell: bash <<: *step - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh - shell: bash <<: *step # Disable automatic line ending conversion (again). On Windows, when we're @@ -184,22 +172,18 @@ x--expand-yaml-anchors--remove: # appropriate line endings. - name: disable git crlf conversion run: src/ci/scripts/disable-git-crlf-conversion.sh - shell: bash <<: *step - name: checkout submodules run: src/ci/scripts/checkout-submodules.sh - shell: bash <<: *step - name: ensure line endings are correct run: src/ci/scripts/verify-line-endings.sh - shell: bash <<: *step - name: run the build run: src/ci/scripts/run-build-from-ci.sh - shell: bash env: AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }} @@ -208,7 +192,6 @@ x--expand-yaml-anchors--remove: - name: upload artifacts to S3 run: src/ci/scripts/upload-artifacts.sh - shell: bash env: AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }} From 132887ccc26fb6f2251214a1d5b0e60547cfd984 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Fri, 17 Jul 2020 08:29:01 -0500 Subject: [PATCH 10/11] ci: Stop setting CI_OVERRIDE_SHELL environment variable This will render the src/ci/exec-with-shell.py script more or less useless, but we're going to replace that by just using the system bash instead. Signed-off-by: Kristofer Rye --- src/ci/scripts/install-msys2.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/install-msys2.sh b/src/ci/scripts/install-msys2.sh index 3c3b5007f8697..0ecc14b946842 100755 --- a/src/ci/scripts/install-msys2.sh +++ b/src/ci/scripts/install-msys2.sh @@ -23,6 +23,19 @@ if isWindows; then mkdir -p "$(ciCheckoutPath)/msys2/home/${USERNAME}" ciCommandAddPath "$(ciCheckoutPath)/msys2/usr/bin" - echo "switching shell to use our own bash" - ciCommandSetEnv CI_OVERRIDE_SHELL "$(ciCheckoutPath)/msys2/usr/bin/bash.exe" + # Detect the native Python version installed on the agent. On GitHub + # Actions, the C:\hostedtoolcache\windows\Python directory contains a + # subdirectory for each installed Python version. + # + # The -V flag of the sort command sorts the input by version number. + native_python_version="$(ls /c/hostedtoolcache/windows/Python | sort -Vr | head -n 1)" + + # Make sure we use the native python interpreter instead of some msys equivalent + # one way or another. The msys interpreters seem to have weird path conversions + # baked in which break LLVM's build system one way or another, so let's use the + # native version which keeps everything as native as possible. + python_home="/c/hostedtoolcache/windows/Python/${native_python_version}/x64" + cp "${python_home}/python.exe" "${python_home}/python3.exe" + ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64" + ciCommandAddPath "C:\\hostedtoolcache\\windows\\Python\\${native_python_version}\\x64\\Scripts" fi From 884ea63115b6aee487112890e55008ef97783942 Mon Sep 17 00:00:00 2001 From: Kristofer Rye Date: Fri, 17 Jul 2020 08:44:14 -0500 Subject: [PATCH 11/11] ci: Replace exec-with-shell wrapper with "plain bash" Also, promote defaults.run.shell from inside only the primary jobs to the top level. The src/ci/exec-with-shell.py wrapper script was formerly used to change out the shell mid-job by intercepting a CI_OVERRIDE_SHELL environment variable. Now, instead, we just set `bash` as the global default across all jobs, and we also delete the exec-with-shell.py script. Signed-off-by: Kristofer Rye --- .github/workflows/ci.yml | 11 +---------- src/ci/exec-with-shell.py | 16 ---------------- src/ci/github-actions/ci.yml | 19 ++++--------------- 3 files changed, 5 insertions(+), 41 deletions(-) delete mode 100755 src/ci/exec-with-shell.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ba541fe312cc..3006e61b8183f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ name: CI - "**" defaults: run: - shell: "python src/ci/exec-with-shell.py {0}" + shell: bash jobs: pr: name: PR @@ -51,9 +51,6 @@ jobs: os: ubuntu-latest-xl timeout-minutes: 600 runs-on: "${{ matrix.os }}" - defaults: - run: - shell: bash steps: - name: disable git crlf conversion run: git config --global core.autocrlf false @@ -163,9 +160,6 @@ jobs: os: ubuntu-latest-xl timeout-minutes: 600 runs-on: "${{ matrix.os }}" - defaults: - run: - shell: bash steps: - name: disable git crlf conversion run: git config --global core.autocrlf false @@ -517,9 +511,6 @@ jobs: os: windows-latest-xl timeout-minutes: 600 runs-on: "${{ matrix.os }}" - defaults: - run: - shell: bash steps: - name: disable git crlf conversion run: git config --global core.autocrlf false diff --git a/src/ci/exec-with-shell.py b/src/ci/exec-with-shell.py deleted file mode 100755 index 26ce69e33d9c3..0000000000000 --- a/src/ci/exec-with-shell.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -# A simple wrapper that forwards the arguments to bash, unless the -# CI_OVERRIDE_SHELL environment variable is present: in that case the content -# of that environment variable is used as the shell path. - -import os -import sys -import subprocess - -try: - shell = os.environ["CI_OVERRIDE_SHELL"] -except KeyError: - shell = "bash" - -res = subprocess.call([shell] + sys.argv[1:]) -sys.exit(res) diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 1902613cfe11c..1cf828fd64e20 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -75,9 +75,6 @@ x--expand-yaml-anchors--remove: - &base-ci-job timeout-minutes: 600 runs-on: "${{ matrix.os }}" - defaults: - run: - shell: bash env: *shared-ci-variables steps: - name: disable git crlf conversion @@ -241,18 +238,10 @@ on: defaults: run: - # While on Linux and macOS builders it just forwards the arguments to the - # system bash, this wrapper allows switching from the host's bash.exe to - # the one we install along with MSYS2 mid-build on Windows. - # - # Once the step to install MSYS2 is executed, the CI_OVERRIDE_SHELL - # environment variable is set pointing to our MSYS2's bash.exe. From that - # moment the host's bash.exe will not be called anymore. - # - # This is needed because we can't launch our own bash.exe from the host - # bash.exe, as that would load two different cygwin1.dll in memory, causing - # "cygwin heap mismatch" errors. - shell: python src/ci/exec-with-shell.py {0} + # On Linux, macOS, and Windows, use the system-provided bash as the default + # shell. (This should only make a difference on Windows, where the default + # shell is PowerShell.) + shell: bash jobs: pr: