From 7962e149056e2a5501e0c079416e78a1e6abe5c8 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Tue, 15 Nov 2022 13:15:15 +0800 Subject: [PATCH] (chore): Update CI and templates --- .github/ISSUE_TEMPLATE/Bug_report.md | 49 --------- .github/ISSUE_TEMPLATE/Package_request.md | 27 ----- .github/ISSUE_TEMPLATE/bug-report.yml | 113 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 + .github/ISSUE_TEMPLATE/package-request.yml | 52 ++++++++++ .github/issue_template.md | 12 --- .github/workflows/ci.yml | 29 ++++-- .github/workflows/excavator.yml | 12 +-- .github/workflows/issue_comment.yml | 14 +-- .github/workflows/issues.yml | 14 +-- .github/workflows/pull_request.yml | 12 +-- bin/auto-pr.ps1 | 4 +- bin/checkhashes.ps1 | 4 + bin/checkurls.ps1 | 4 +- bin/checkver.ps1 | 4 +- bin/formatjson.ps1 | 4 +- bin/missing-checkver.ps1 | 4 +- bin/test.ps1 | 16 ++- 18 files changed, 243 insertions(+), 136 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/Bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/Package_request.md create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/package-request.yml delete mode 100644 .github/issue_template.md create mode 100644 bin/checkhashes.ps1 diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md deleted file mode 100644 index a5a5dd9..0000000 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: "Bug Report" -about: "I am facing some problems." -title: "" -labels: "bug" ---- - - - -## Bug Report - -**Package Name:** [name of package which has bug(s)] - -### Current Behaviour - - - -### Expected Behaviour - - - -### Additional context/output - - - -### Possible Solution - - - -### System details - -**Windows version:** [e.g. 7, 8, 10] - -**OS architecture:** [e.g. 32bit, 64bit] - -**PowerShell version:** [output of `"$($PSVersionTable.PSVersion)"`] - -**Additional software:** [(optional) e.g. ConEmu, Git] - -#### Scoop Configuration - - -```json -//# Your configuration here -``` diff --git a/.github/ISSUE_TEMPLATE/Package_request.md b/.github/ISSUE_TEMPLATE/Package_request.md deleted file mode 100644 index 511b491..0000000 --- a/.github/ISSUE_TEMPLATE/Package_request.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: "Package Request" -about: "I have a suggestion for a package (and may want to implement it)!" -title: "[Request] " -labels: "package-request" ---- - - - -## Package Request - -### Information - -**Name:** [name of new package] - -**Description:** [clear and concise details of what it is] - -**Homepage:** [a URL/link] - -**Download link(s):** [URL(s)/link(s)] - -**Some indication of popularity/repute:** [GitHub stars/software reviews etc.] - diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..9f313b0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,113 @@ +name: 🐛 Bug Report +description: Open an issue about a bug that needs fixing. +title: "[Bug]: " +labels: ["bug"] +body: +- type: checkboxes + attributes: + label: Prerequisites + options: + - label: I have written a descriptive issue title. + required: true + - label: I have searched all issues/PRs to ensure it has not already been reported or fixed. + required: true + - label: I have verified that I am using the latest version of Scoop and corresponding bucket. + required: true +- type: input + attributes: + label: Package Name + description: Name of package (install name) which has bug(s) + placeholder: e.g. 7zip (not '7-Zip') + validations: + required: true +- type: textarea + attributes: + label: Expected/Current Behaviour + description: A clear and concise description of what you expected to happen and what actually happen. + placeholder: I am experiencing a problem with X. I think Y should be happening but Z is actually happening. + validations: + required: true +- type: textarea + attributes: + label: Steps to Reproduce + description: List of steps, sample code or failing test that reproduces the behavior. + render: console + placeholder: | + PS> scoop install tests/meson + Installing 'meson' (0.61.1) [64bit] + Loading meson-0.61.1-64.msi from cache. + Checking hash of meson-0.61.1-64.msi ... ok. + Extracting meson-0.61.1-64.msi ... done. + Running installer script... + Linking D:\Scoop\apps\meson\current => D:\Scoop\apps\meson\0.61.1 + Creating shim for 'meson'. + Can't shim 'meson.exe': File doesn't exist. + validations: + required: true +- type: textarea + attributes: + label: Possible Solution + description: Do you have some suggestions on a fix for the bug? + placeholder: I am experiencing a problem with X. I think Y should be happening but Z is actually happening. + validations: + required: true +- type: textarea + attributes: + label: Scoop and Buckets Version + description: Paste verbatim output from `scoop --version` below. + render: console + placeholder: | + PS> scoop --version + Current Scoop version: + c60df9cd (HEAD -> develop, origin/develop) docs(changelog): Prepare for version 0.3.1 (#5248) + + 'extras' bucket: + ea314b213 (HEAD -> master, origin/master, origin/HEAD) lazygit: Update to version 0.36.0 + + 'main' bucket: + c6e688d4d (HEAD -> master, origin/master, origin/HEAD) x265: Update to version 3.5+68-40e37bc + validations: + required: true +- type: textarea + attributes: + label: Scoop Config + description: Paste verbatim output from `scoop config` below. + render: console + placeholder: | + PS> scoop config + + last_update : 2022/11/14 22:05:50 + scoop_repo : https://github.com/ScoopInstaller/Scoop + scoop_branch : develop + use_lessmsi : True + aria2-enabled : True + aria2-warning-enabled : False + validations: + required: true +- type: textarea + attributes: + label: PowerShell Version + description: Paste verbatim output from `$PSVersionTable` below. + render: console + placeholder: | + PS> $PSVersionTable + + Name Value + ---- ----- + PSVersion 7.3.0 + PSEdition Core + GitCommitId 7.3.0 + OS Microsoft Windows 10.0.25236 + Platform Win32NT + PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} + PSRemotingProtocolVersion 2.3 + SerializationVersion 1.1.0.1 + WSManStackVersion 3.0 + validations: + required: true +- type: textarea + attributes: + label: Additional Softwares + description: List any additional software that you are using and may be related to this bug. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..a1d8f2a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Scoop Community Support + url: https://github.com/ScoopInstaller/Scoop/discussions + about: Please ask Scoop related questions here. diff --git a/.github/ISSUE_TEMPLATE/package-request.yml b/.github/ISSUE_TEMPLATE/package-request.yml new file mode 100644 index 0000000..f4fb808 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/package-request.yml @@ -0,0 +1,52 @@ +name: 📦 Package Request +description: Open an issue about a missing package. +title: "[Request]: " +labels: ["package-request"] +body: +- type: checkboxes + attributes: + label: Prerequisites + options: + - label: I have searched all issues/PRs to ensure it has not already been reported or fixed. + required: true +- type: checkboxes + attributes: + label: Criteria + description: For a package to be acceptable in this bucket, it should be + options: + - label: Criteria 1 + required: true + - label: Criteria 2 + required: true + - label: Criteria 2 + required: true +- type: input + attributes: + label: Name + description: Name of the package + validations: + required: true +- type: input + attributes: + label: Description + description: Clear and concise details of what it is + validations: + required: true +- type: input + attributes: + label: Homepage + description: URI of the package's homepage + validations: + required: true +- type: input + attributes: + label: Download Link(s) + description: URI(s) of the package's download(s) + validations: + required: true +- type: textarea + attributes: + label: Some Indication of Popularity/Repute + description: GitHub stars/software reviews etc. + validations: + required: true diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index 1df5c02..0000000 --- a/.github/issue_template.md +++ /dev/null @@ -1,12 +0,0 @@ - - - -#### Scoop Configuration - - -```json -//# Your configuration here -``` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c120364..bc34823 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,11 @@ name: Tests on: - pull_request: push: + branches: + - 'main' + - 'master' + pull_request: workflow_dispatch: jobs: @@ -14,17 +17,21 @@ jobs: uses: actions/checkout@main with: fetch-depth: 2 - path: 'my_bucket' + path: my_bucket - name: Checkout Scoop uses: actions/checkout@main with: repository: ScoopInstaller/Scoop - path: 'scoop_core' - - name: Init and Test + path: scoop_core + - name: Init Test Suite + uses: potatoqualitee/psmodulecache@v5.1 + with: + modules-to-cache: BuildHelpers + shell: powershell + - name: Test Bucket shell: powershell run: | $env:SCOOP_HOME="$(Convert-Path '.\scoop_core')" - .\scoop_core\test\bin\init.ps1 .\my_bucket\bin\test.ps1 test_pwsh: name: PowerShell @@ -34,15 +41,19 @@ jobs: uses: actions/checkout@main with: fetch-depth: 2 - path: 'my_bucket' + path: my_bucket - name: Checkout Scoop uses: actions/checkout@main with: repository: ScoopInstaller/Scoop - path: 'scoop_core' - - name: Init and Test + path: scoop_core + - name: Init Test Suite + uses: potatoqualitee/psmodulecache@v5.1 + with: + modules-to-cache: BuildHelpers + shell: pwsh + - name: Test Bucket shell: pwsh run: | $env:SCOOP_HOME="$(Convert-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 081c421..e5279eb 100644 --- a/.github/workflows/excavator.yml +++ b/.github/workflows/excavator.yml @@ -9,9 +9,9 @@ jobs: name: Excavate runs-on: windows-latest steps: - - uses: actions/checkout@main - - name: Excavate - uses: ScoopInstaller/GithubActions@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SKIP_UPDATED: '1' + - uses: actions/checkout@main + - name: Excavate + uses: ScoopInstaller/GithubActions@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SKIP_UPDATED: 1 diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml index 2286114..24b9018 100644 --- a/.github/workflows/issue_comment.yml +++ b/.github/workflows/issue_comment.yml @@ -1,15 +1,15 @@ on: issue_comment: - types: [ created ] + types: [created] name: Commented Pull Request jobs: pullRequestHandler: name: PullRequestHandler runs-on: windows-latest steps: - - uses: actions/checkout@main - - name: PullRequestHandler - uses: ScoopInstaller/GithubActions@main - if: startsWith(github.event.comment.body, '/verify') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@main + - name: PullRequestHandler + uses: ScoopInstaller/GithubActions@main + if: startsWith(github.event.comment.body, '/verify') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index a16162b..0c8b859 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -1,15 +1,15 @@ on: issues: - types: [ opened, labeled ] + types: [opened, labeled] name: Issues jobs: issueHandler: name: IssueHandler runs-on: windows-latest steps: - - uses: actions/checkout@main - - name: IssueHandler - uses: ScoopInstaller/GithubActions@main - if: github.event.action == 'opened' || (github.event.action == 'labeled' && contains(github.event.issue.labels.*.name, 'verify')) - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@main + - name: IssueHandler + uses: ScoopInstaller/GithubActions@main + if: github.event.action == 'opened' || (github.event.action == 'labeled' && contains(github.event.issue.labels.*.name, 'verify')) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index bc0d222..a726acb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,14 +1,14 @@ on: pull_request: - types: [ opened ] + types: [opened] name: Pull Requests jobs: pullRequestHandler: name: PullRequestHandler runs-on: windows-latest steps: - - uses: actions/checkout@main - - name: PullRequestHandler - uses: ScoopInstaller/GithubActions@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@main + - name: PullRequestHandler + uses: ScoopInstaller/GithubActions@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/bin/auto-pr.ps1 b/bin/auto-pr.ps1 index 1702bb7..3a91818 100644 --- a/bin/auto-pr.ps1 +++ b/bin/auto-pr.ps1 @@ -3,7 +3,7 @@ param( [String]$upstream = "/:main" ) -if(!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) } +if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Convert-Path (scoop prefix scoop) } $autopr = "$env:SCOOP_HOME/bin/auto-pr.ps1" $dir = "$PSScriptRoot/../bucket" # checks the parent dir -Invoke-Expression -command "& '$autopr' -dir '$dir' -upstream $upstream $($args | ForEach-Object { "$_ " })" +& $autopr -Dir $dir -Upstream $Upstream @Args diff --git a/bin/checkhashes.ps1 b/bin/checkhashes.ps1 new file mode 100644 index 0000000..6e7e052 --- /dev/null +++ b/bin/checkhashes.ps1 @@ -0,0 +1,4 @@ +if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Convert-Path (scoop prefix scoop) } +$checkhashes = "$env:SCOOP_HOME/bin/checkhashes.ps1" +$dir = "$PSScriptRoot/../bucket" # checks the parent dir +& $checkhashes -Dir $dir @Args diff --git a/bin/checkurls.ps1 b/bin/checkurls.ps1 index cfe5e7d..4895d54 100644 --- a/bin/checkurls.ps1 +++ b/bin/checkurls.ps1 @@ -1,4 +1,4 @@ -if(!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) } +if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Convert-Path (scoop prefix scoop) } $checkurls = "$env:SCOOP_HOME/bin/checkurls.ps1" $dir = "$PSScriptRoot/../bucket" # checks the parent dir -Invoke-Expression -command "& '$checkurls' -dir '$dir' $($args | ForEach-Object { "$_ " })" +& $checkurls -Dir $dir @Args diff --git a/bin/checkver.ps1 b/bin/checkver.ps1 index 6f6b53a..9bce8b4 100644 --- a/bin/checkver.ps1 +++ b/bin/checkver.ps1 @@ -1,4 +1,4 @@ -if(!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) } +if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Convert-Path (scoop prefix scoop) } $checkver = "$env:SCOOP_HOME/bin/checkver.ps1" $dir = "$PSScriptRoot/../bucket" # checks the parent dir -Invoke-Expression -command "& '$checkver' -dir '$dir' $($args | ForEach-Object { "$_ " })" +& $checkver -Dir $dir @Args diff --git a/bin/formatjson.ps1 b/bin/formatjson.ps1 index 1884583..2766bbc 100644 --- a/bin/formatjson.ps1 +++ b/bin/formatjson.ps1 @@ -1,4 +1,4 @@ -if(!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) } +if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Convert-Path (scoop prefix scoop) } $formatjson = "$env:SCOOP_HOME/bin/formatjson.ps1" $path = "$PSScriptRoot/../bucket" # checks the parent dir -Invoke-Expression -command "& '$formatjson' -dir '$path' $($args | ForEach-Object { "$_ " })" +& $formatjson -Dir $path @Args diff --git a/bin/missing-checkver.ps1 b/bin/missing-checkver.ps1 index bca8abb..e375704 100644 --- a/bin/missing-checkver.ps1 +++ b/bin/missing-checkver.ps1 @@ -1,4 +1,4 @@ -if(!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) } +if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Convert-Path (scoop prefix scoop) } $missing_checkver = "$env:SCOOP_HOME/bin/missing-checkver.ps1" $dir = "$PSScriptRoot/../bucket" # checks the parent dir -Invoke-Expression -command "& '$missing_checkver' -dir '$dir' $($args | ForEach-Object { "$_ " })" +& $missing_checkver -Dir $dir @Args diff --git a/bin/test.ps1 b/bin/test.ps1 index 9ff03ac..5c64841 100644 --- a/bin/test.ps1 +++ b/bin/test.ps1 @@ -1,5 +1,15 @@ -#Requires -Modules @{ ModuleName = 'Pester'; MaximumVersion = '4.99' } +#Requires -Version 5.1 +#Requires -Modules @{ ModuleName = 'BuildHelpers'; ModuleVersion = '2.0.1' } +#Requires -Modules @{ ModuleName = 'Pester'; ModuleVersion = '5.2.0' } -if (!$env:SCOOP_HOME) { $env:SCOOP_HOME = Resolve-Path (scoop prefix scoop) } -$result = Invoke-Pester "$PSScriptRoot/.." -PassThru +$pesterConfig = New-PesterConfiguration -Hashtable @{ + Run = @{ + Path = "$PSScriptRoot/.." + PassThru = $true + } + Output = @{ + Verbosity = 'Detailed' + } +} +$result = Invoke-Pester -Configuration $pesterConfig exit $result.FailedCount