1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-31 11:34:15 -05:00

chore(ci): use mtime cache for fastci (#17373)

This commit is contained in:
David Sherret 2023-01-12 12:07:37 -05:00 committed by GitHub
parent 120bc5450f
commit 3713a10b64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View file

@ -150,7 +150,7 @@ function cancelEarlyIfDraftPr(
].join("\n"), ].join("\n"),
}, },
...nextSteps.map((step) => ...nextSteps.map((step) =>
skipForCondition(step, "steps.exit_early.outputs.EXIT_EARLY != 'true'") withCondition(step, "steps.exit_early.outputs.EXIT_EARLY != 'true'")
), ),
]; ];
} }
@ -162,14 +162,14 @@ function skipJobsIfPrAndMarkedSkip(
// so just apply this condition to all the steps. // so just apply this condition to all the steps.
// https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional // https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional
return steps.map((s) => return steps.map((s) =>
skipForCondition( withCondition(
s, s,
"!(github.event_name == 'pull_request' && matrix.skip_pr)", "!(github.event_name == 'pull_request' && matrix.skip_pr)",
) )
); );
} }
function skipForCondition( function withCondition(
step: Record<string, unknown>, step: Record<string, unknown>,
condition: string, condition: string,
): Record<string, unknown> { ): Record<string, unknown> {
@ -327,7 +327,9 @@ const ci = {
if: "matrix.job == 'lint' || matrix.job == 'test'", if: "matrix.job == 'lint' || matrix.job == 'test'",
...installDenoStep, ...installDenoStep,
}, },
...installPythonSteps, ...installPythonSteps.map((s) =>
withCondition(s, "matrix.job != 'lint'")
),
{ {
// only necessary for benchmarks // only necessary for benchmarks
if: "matrix.job == 'bench'", if: "matrix.job == 'bench'",
@ -435,9 +437,11 @@ const ci = {
}, },
{ {
name: "Apply and update mtime cache", name: "Apply and update mtime cache",
if: "matrix.profile == 'release'", if: "!startsWith(github.ref, 'refs/tags/')",
uses: "./.github/mtime_cache", uses: "./.github/mtime_cache",
with: { "cache-path": "./target" }, with: {
"cache-path": "./target",
},
}, },
{ {
// Shallow the cloning the crates.io index makes CI faster because it // Shallow the cloning the crates.io index makes CI faster because it

View file

@ -113,9 +113,9 @@ jobs:
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.8 python-version: 3.8
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'')' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'' && (matrix.job != ''lint''))'
- name: Remove unused versions of Python - name: Remove unused versions of Python
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'' && (startsWith(matrix.os, ''windows'')))' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'' && (matrix.job != ''lint'' && (startsWith(matrix.os, ''windows''))))'
shell: pwsh shell: pwsh
run: |- run: |-
$env:PATH -split ";" | $env:PATH -split ";" |
@ -269,7 +269,7 @@ jobs:
key: never_saved key: never_saved
restore-keys: '18-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-' restore-keys: '18-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-'
- name: Apply and update mtime cache - name: Apply and update mtime cache
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'' && (matrix.profile == ''release''))' if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (steps.exit_early.outputs.EXIT_EARLY != ''true'' && (!startsWith(github.ref, ''refs/tags/'')))'
uses: ./.github/mtime_cache uses: ./.github/mtime_cache
with: with:
cache-path: ./target cache-path: ./target