From fc6ac316d32418bba4470496d5ca2145d1abe18c Mon Sep 17 00:00:00 2001 From: Chawye Hsu Date: Wed, 1 Apr 2026 16:17:08 +0800 Subject: [PATCH] chore: refactor ci workflow Signed-off-by: Chawye Hsu --- .github/workflows/ci.yml | 46 +++++++++++------------------ .github/workflows/excavator.yml | 2 +- .github/workflows/issue_comment.yml | 2 +- .github/workflows/issues.yml | 2 +- .github/workflows/pull_request.yml | 2 +- 5 files changed, 22 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 757d5810f..e0733f6af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Tests +name: CI on: pull_request: @@ -6,43 +6,33 @@ on: workflow_dispatch: jobs: - test_powershell: - name: WindowsPowerShell + test: + name: Test runs-on: windows-latest + strategy: + matrix: + shell: [powershell, pwsh] + defaults: + run: + shell: ${{ matrix.shell }} steps: - name: Checkout Bucket - uses: actions/checkout@main + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: + # Need at least 2 commits to properly gather changed files for linting fetch-depth: 2 path: 'my_bucket' - name: Checkout Scoop - uses: actions/checkout@main + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: repository: ScoopInstaller/Scoop path: 'scoop_core' - - name: Init and Test - shell: powershell + - name: Install and cache test dependencies + uses: potatoqualitee/psmodulecache@ee5e9494714abf56f6efbfa51527b2aec5c761b8 # v6.2.1 + with: + modules-to-cache: BuildHelpers, Pester + shell: ${{ matrix.shell }} + - name: Run tests run: | $env:SCOOP_HOME="$(Resolve-Path '.\scoop_core')" - .\scoop_core\test\bin\init.ps1 - .\my_bucket\bin\test.ps1 - test_pwsh: - name: PowerShell - runs-on: windows-latest - steps: - - name: Checkout Bucket - uses: actions/checkout@main - with: - fetch-depth: 2 - path: 'my_bucket' - - name: Checkout Scoop - uses: actions/checkout@main - with: - repository: ScoopInstaller/Scoop - path: 'scoop_core' - - name: Init and Test - shell: pwsh - run: | - $env:SCOOP_HOME="$(Resolve-Path '.\scoop_core')" - .\scoop_core\test\bin\init.ps1 .\my_bucket\bin\test.ps1 diff --git a/.github/workflows/excavator.yml b/.github/workflows/excavator.yml index a389f42f2..7a94d1372 100644 --- a/.github/workflows/excavator.yml +++ b/.github/workflows/excavator.yml @@ -8,7 +8,7 @@ jobs: name: Excavate runs-on: windows-latest steps: - - uses: actions/checkout@main + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Excavate uses: ScoopInstaller/GithubActions@main env: diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml index 2286114b3..4a31a1051 100644 --- a/.github/workflows/issue_comment.yml +++ b/.github/workflows/issue_comment.yml @@ -7,7 +7,7 @@ jobs: name: PullRequestHandler runs-on: windows-latest steps: - - uses: actions/checkout@main + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: PullRequestHandler uses: ScoopInstaller/GithubActions@main if: startsWith(github.event.comment.body, '/verify') diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index a16162bd7..95202c413 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -7,7 +7,7 @@ jobs: name: IssueHandler runs-on: windows-latest steps: - - uses: actions/checkout@main + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: IssueHandler uses: ScoopInstaller/GithubActions@main if: github.event.action == 'opened' || (github.event.action == 'labeled' && contains(github.event.issue.labels.*.name, 'verify')) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index bc0d22281..2c0b8eaee 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,7 +7,7 @@ jobs: name: PullRequestHandler runs-on: windows-latest steps: - - uses: actions/checkout@main + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: PullRequestHandler uses: ScoopInstaller/GithubActions@main env: