seigot / tetris

A Tetris Game for programming education in Japanese
MIT License
30 stars 107 forks source link

GitAuto: gitHub action を windows powershell で実行したい #159

Open gitauto-ai[bot] opened 3 weeks ago

gitauto-ai[bot] commented 3 weeks ago

Resolves #38

What is the feature

Enable the execution of GitHub Actions workflows using Windows PowerShell.

Why we need the feature

Currently, GitHub Actions workflows are predominantly optimized for environments like Ubuntu and Mac, with limited support for Windows PowerShell. This limitation affects developers who rely on Windows-specific tools and scripts, reducing the efficiency and flexibility of continuous integration and deployment processes on Windows platforms. By enabling GitHub Actions to run smoothly with Windows PowerShell, we can provide a more robust and versatile CI/CD pipeline that caters to a broader range of development environments.

How to implement and why

  1. Update Workflow Configuration:

    • Modify existing workflow YAML files or create new ones to specify powershell as the shell for relevant job steps.
    • Example:

      jobs:
      build:
       runs-on: windows-latest
       steps:
         - name: Checkout Repository
           uses: actions/checkout@v2
      
         - name: Set up MSBuild
           uses: microsoft/setup-msbuild@v1.0.2
      
         - name: Build with MSBuild
           shell: powershell
           run: |
             if (${{ matrix.arch }} -eq "x64") {
               $msbuildPlatform = "x64"
             } else {
               $msbuildPlatform = "Win32"
             }
             msbuild -version
  2. Incorporate PowerShell Scripts:

    • Develop PowerShell scripts to handle Windows-specific build and deployment tasks.
    • Ensure scripts are placed in a directory accessible to the workflow, such as a scripts folder within the repository.
  3. Configure Dependencies and Environment:

    • Install necessary dependencies using PowerShell commands within the workflow.
    • Example:
      Install-Module -Name SomeModule -Force
  4. Handle Environment Variables:

    • Set and manage environment variables within PowerShell to ensure that builds and deployments have the necessary context.
    • Example:
      $Env:QT_QPA_PLATFORM = 'offscreen'
  5. Testing and Validation:

    • Create test workflows to validate the PowerShell integration.
    • Use matrix strategies to test across different Windows environments and configurations.
    • Example:
      strategy:
      matrix:
       python-version: [3.9]
  6. Documentation and References:

    • Update repository documentation to include guidelines on using PowerShell with GitHub Actions.
    • Reference helpful resources and examples to assist developers in setting up their workflows.

About backward compatibility

Implementing Windows PowerShell support in GitHub Actions will not affect existing workflows running on other operating systems like Ubuntu and Mac. The changes are additive and allow developers to choose the appropriate environment for their needs. By maintaining separate job configurations for different shells and environments, we ensure that current CI/CD processes remain stable and unaffected.

Test these changes locally

git checkout -b gitauto/issue-38-2ebe8c78-771b-4ab1-b605-885e2ea7d4d4
git pull origin gitauto/issue-38-2ebe8c78-771b-4ab1-b605-885e2ea7d4d4