Skip to content

Commit

Permalink
chore(ci): use mtime cache for fastci (denoland#17373)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jan 12, 2023
1 parent 120bc54 commit 3713a10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function cancelEarlyIfDraftPr(
].join("\n"),
},
...nextSteps.map((step) =>
skipForCondition(step, "steps.exit_early.outputs.EXIT_EARLY != 'true'")
withCondition(step, "steps.exit_early.outputs.EXIT_EARLY != 'true'")
),
];
}
Expand All @@ -162,14 +162,14 @@ function skipJobsIfPrAndMarkedSkip(
// so just apply this condition to all the steps.
// https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional
return steps.map((s) =>
skipForCondition(
withCondition(
s,
"!(github.event_name == 'pull_request' && matrix.skip_pr)",
)
);
}

function skipForCondition(
function withCondition(
step: Record<string, unknown>,
condition: string,
): Record<string, unknown> {
Expand Down Expand Up @@ -327,7 +327,9 @@ const ci = {
if: "matrix.job == 'lint' || matrix.job == 'test'",
...installDenoStep,
},
...installPythonSteps,
...installPythonSteps.map((s) =>
withCondition(s, "matrix.job != 'lint'")
),
{
// only necessary for benchmarks
if: "matrix.job == 'bench'",
Expand Down Expand Up @@ -435,9 +437,11 @@ const ci = {
},
{
name: "Apply and update mtime cache",
if: "matrix.profile == 'release'",
if: "!startsWith(github.ref, 'refs/tags/')",
uses: "./.github/mtime_cache",
with: { "cache-path": "./target" },
with: {
"cache-path": "./target",
},
},
{
// Shallow the cloning the crates.io index makes CI faster because it
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ jobs:
uses: actions/setup-python@v4
with:
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
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
run: |-
$env:PATH -split ";" |
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
key: never_saved
restore-keys: '18-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-'
- 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
with:
cache-path: ./target
Expand Down

0 comments on commit 3713a10

Please sign in to comment.