Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ci,tests): Support both AppVeyor and GitHub Actions #4655

Merged
merged 6 commits into from
Jan 14, 2022

Conversation

chawyehsu
Copy link
Member

@chawyehsu chawyehsu commented Jan 13, 2022

Description

refactor(ci,tests): Support both AppVeyor and GitHub Actions

Motivation and Context

test\bin\init.ps1: Refactor to support both AppVeyor and GitHub
Actions. The Zstd helper will only be downloaded and installed on
the AppVeyor CI. On GitHub Actions it's built-in on the CI.

test\bin\test.ps1: Refactor to support both AppVeyor and GitHub
Actions. Only on AppVeyor CI the TestResults will be uploaded.
Exclusion rules of tests are only applied when tests are called
from the Core itself on CI, skipped when tests are called either
from the external bucket or not on CI.

test\Scoop-Manifest.Test.ps1: Manifests test and validation have
been merged into test\Import-Bucket-Tests.ps1, since the main
bucket has been separated from the Core and there is no need to do
manifest test in the Core repo.

How Has This Been Tested?

For Core:
GitHub Actions - WindowsPowerShell: https://github.com/ScoopInstaller/Scoop/runs/4805272264?check_suite_focus=true
GitHub Actions - PowerShell: https://github.com/ScoopInstaller/Scoop/runs/4805272339?check_suite_focus=true

AppVeyor - WindowsPowerShell: https://ci.appveyor.com/project/chawyehsu/scoop/builds/42190020/job/tu163a54spx9xny9
AppVeyor - PowerShell: https://ci.appveyor.com/project/chawyehsu/scoop/builds/42190020/job/026e90ce719k4ewg

For bucket:
GitHub Actions - WindowsPowerShell: https://github.com/chawyehsu/bucket-gh-ci-test/runs/4805180209?check_suite_focus=true
GitHub Actions - PowerShell: https://github.com/chawyehsu/bucket-gh-ci-test/runs/4805180122?check_suite_focus=true
AppVeyor: https://ci.appveyor.com/project/chawyehsu/bucket-gh-ci-test/builds/42190228

If a bucket was using AppVeyor for manifest testing, nothing needs to be changed. But if you want to migrate it to GitHub Actions, you'll need to setup the workflow manually for the bucket. Here is an example workflow.

name: Tests

on:
  pull_request:
    types: [ opened ]
  push:
  workflow_dispatch:

jobs:
  test_powershell:
    name: WindowsPowerShell
    runs-on: windows-latest
    steps:
      - name: Checkout Bucket
        uses: actions/checkout@v2
        with:
          fetch-depth: 2
          path: 'my_bucket'
      - name: Checkout Scoop
        uses: actions/checkout@v2
        with:
          repository: ScoopInstaller/Scoop
          path: 'scoop_core'
      - name: Init and Test
        shell: powershell
        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@v2
        with:
          fetch-depth: 2
          path: 'my_bucket'
      - name: Checkout Scoop
        uses: actions/checkout@v2
        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

Checklist:

  • I have read the Contributing Guide.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

Signed-off-by: Chawye Hsu <chawyehsu@hotmail.com>
Signed-off-by: Chawye Hsu <chawyehsu@hotmail.com>
`test\bin\init.ps1`: Refactor to support both AppVeyor and GitHub
Actions. The Zstd helper will only be downloaded and installed on
the AppVeyor CI. On GitHub Actions it's built-in on the CI.

`test\bin\test.ps1`: Refactor to support both AppVeyor and GitHub
Actions. Only on AppVeyor CI the TestResults will be uploaded.
Exclusion rules of tests are only applied when tests are called
from the Core itself on CI, skipped when tests are called either
from the external bucket or not on CI.

`test\Scoop-Manifest.Test.ps1`: Manifests test and validation have
been merged into `test\Import-Bucket-Tests.ps1`, since the main
bucket has been separated from the Core and there is no need to do
manifest test in the Core repo.

Signed-off-by: Chawye Hsu <chawyehsu@hotmail.com>
@chawyehsu chawyehsu marked this pull request as ready for review January 13, 2022 15:38
test/bin/test.ps1 Outdated Show resolved Hide resolved
Signed-off-by: Chawye Hsu <chawyehsu@hotmail.com>
@niheaven
Copy link
Member

Could you please update CHANGELOG with an item under Builds section?

@chawyehsu
Copy link
Member Author

Added

@rashil2000
Copy link
Member

Also I think .github/workflows/ci.yml would be a more precise name.

We would be running it on each push and pull request, so I still feel ci.yml reflects the name better

@niheaven
Copy link
Member

We would be running it on each push and pull request, so I still feel ci.yml reflects the name better

I've no idea, and it seems that @chawyehsu use ci.yml in the test bucket. So should we merge this PR and open a new issue/discussion for the name or just decide the name here?

@chawyehsu
Copy link
Member Author

Updated

Copy link
Member

@niheaven niheaven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, perfect job!

@niheaven niheaven merged commit d9f55a3 into ScoopInstaller:develop Jan 14, 2022
@chawyehsu chawyehsu deleted the refactor/test-and-ci branch January 20, 2022 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants