Skip to content

Commit

Permalink
chore: fix located_script_name test (#18418)
Browse files Browse the repository at this point in the history
Closes #18417
  • Loading branch information
dsherret authored and mmastrac committed Mar 31, 2023
1 parent 87e09da commit a9e53df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ function cancelEarlyIfDraftPr(
name: "Cancel if draft PR",
id: "exit_early",
if: "github.event.pull_request.draft == true",
shell: "bash",
run: [
"GIT_MESSAGE=$(git log --format=%s -n 1 ${{github.event.after}})",
"echo Commit message: $GIT_MESSAGE",
Expand Down Expand Up @@ -214,6 +213,12 @@ const ci = {
name: "${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os }}",
"runs-on": "${{ matrix.runner || matrix.os }}",
"timeout-minutes": 120,
defaults: {
run: {
// GH actions doesn't use `set -e` by default unless you specify bash
shell: "bash",
},
},
strategy: {
matrix: {
include: [
Expand Down Expand Up @@ -391,7 +396,6 @@ const ci = {
"github.repository == 'denoland/deno' &&",
"github.ref == 'refs/heads/main'",
].join("\n"),
shell: "bash",
run: 'echo "DENO_CANARY=true" >> $GITHUB_ENV',
},
{
Expand All @@ -400,7 +404,6 @@ const ci = {
},
{
name: "Log versions",
shell: "bash",
run: [
"python --version",
"rustc --version",
Expand Down Expand Up @@ -464,7 +467,6 @@ const ci = {
// identifier '1ecc6299db9ec823' will ever change, but if it does then this
// command must be updated.
name: "Shallow clone crates.io index",
shell: "bash",
run: [
"if [ ! -d ~/.cargo/registry/index/github.com-1ecc6299db9ec823/.git ]",
"then",
Expand Down Expand Up @@ -591,7 +593,6 @@ const ci = {
env: {
CLOUDSDK_PYTHON: "${{env.pythonLocation}}\\python.exe",
},
shell: "bash",
run:
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs:https://dl.deno.land/canary/$(git rev-parse HEAD)/',
},
Expand Down Expand Up @@ -634,7 +635,6 @@ const ci = {
name: "Check deno binary",
if:
"matrix.profile == 'release' && startsWith(github.ref, 'refs/tags/')",
shell: "bash",
run: 'target/release/deno eval "console.log(1+2)" | grep 3',
env: {
NO_COLOR: 1,
Expand Down Expand Up @@ -798,13 +798,11 @@ const ci = {
env: {
CLOUDSDK_PYTHON: "${{env.pythonLocation}}\\python.exe",
},
shell: "bash",
run:
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs:https://dl.deno.land/release/${GITHUB_REF#refs/*/}/',
},
{
name: "Create release notes",
shell: "bash",
if: [
"matrix.job == 'test' &&",
"matrix.profile == 'release' &&",
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
name: '${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os }}'
runs-on: '${{ matrix.runner || matrix.os }}'
timeout-minutes: 120
defaults:
run:
shell: bash
strategy:
matrix:
include:
Expand Down Expand Up @@ -76,7 +79,6 @@ jobs:
- name: Cancel if draft PR
id: exit_early
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (github.event.pull_request.draft == true)'
shell: bash
run: |-
GIT_MESSAGE=$(git log --format=%s -n 1 ${{github.event.after}})
echo Commit message: $GIT_MESSAGE
Expand Down Expand Up @@ -169,7 +171,6 @@ jobs:
matrix.profile == 'release' &&
github.repository == 'denoland/deno' &&
github.ref == 'refs/heads/main'))
shell: bash
run: echo "DENO_CANARY=true" >> $GITHUB_ENV
- if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'' && (matrix.use_sysroot))'
name: Set up incremental LTO and sysroot build
Expand Down Expand Up @@ -241,7 +242,6 @@ jobs:
CFLAGS=-flto=thin --sysroot=/sysroot
__0
- name: Log versions
shell: bash
run: |-
python --version
rustc --version
Expand Down Expand Up @@ -281,7 +281,6 @@ jobs:
with:
cache-path: ./target
- name: Shallow clone crates.io index
shell: bash
run: |-
if [ ! -d ~/.cargo/registry/index/github.com-1ecc6299db9ec823/.git ]
then
Expand Down Expand Up @@ -370,7 +369,6 @@ jobs:
github.ref == 'refs/heads/main'))
env:
CLOUDSDK_PYTHON: '${{env.pythonLocation}}\python.exe'
shell: bash
run: 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs:https://dl.deno.land/canary/$(git rev-parse HEAD)/'
- name: Test debug
if: |-
Expand All @@ -397,7 +395,6 @@ jobs:
run: cargo test --release --locked
- name: Check deno binary
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'' && (matrix.profile == ''release'' && startsWith(github.ref, ''refs/tags/'')))'
shell: bash
run: target/release/deno eval "console.log(1+2)" | grep 3
env:
NO_COLOR: 1
Expand Down Expand Up @@ -515,10 +512,8 @@ jobs:
startsWith(github.ref, 'refs/tags/')))
env:
CLOUDSDK_PYTHON: '${{env.pythonLocation}}\python.exe'
shell: bash
run: 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs:https://dl.deno.land/release/${GITHUB_REF#refs/*/}/'
- name: Create release notes
shell: bash
if: |-
!(github.event_name == 'pull_request' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != 'true' && (matrix.job == 'test' &&
matrix.profile == 'release' &&
Expand Down
8 changes: 7 additions & 1 deletion core/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ mod tests {
fn located_script_name() {
// Note that this test will fail if this file is moved. We don't
// test line locations because that's just too brittle.
assert!(located_script_name!().starts_with("[ext:core/lib.rs:"));
let name = located_script_name!();
let expected = if cfg!(windows) {
"[ext:core\\lib.rs:"
} else {
"[ext:core/lib.rs:"
};
assert_eq!(&name[..expected.len()], expected);
}

#[test]
Expand Down

0 comments on commit a9e53df

Please sign in to comment.