1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub actionでwindows-latestのrunnerを使用する試み

Posted at

GitHub actionでwindowsが使えることは知りつつも使った事がなかったので使ってみる試みです。

https://docs.github.com/ja/actions/using-github-hosted-runners/about-github-hosted-runners
available with Ubuntu Linux, Windows, or macOS operating systems.

通常のGitHub action用のyamlファイルのうち、windows-latestを使うには、runs-on: windows-latestの部分を記述すればOK。
処理内容は、https://github.com/seigot/tetrisのリポジトリをgit cloneしてきて実行するだけのもの。
push, pullrequest時にci実行トリガーするようにしています。

.github.workflow/test-windows.yaml
name: test-windows
on: 
# push, pullrequest時にci実行
    push:
        paths-ignore:
          - '.gitignore'
          - 'LICENSE'
          - '**.md'
    pull_request:
        paths-ignore:
          - '.gitignore'
          - 'LICENSE'
          - '**.md'
jobs:
  build:
    name: MSBuild
    runs-on: windows-latest

    strategy:
      matrix:
        python-version: [3.9] # [3.5, 3.6, 3.7, 3.8]

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        shell: powershell
        run: |
          git --version
          python --version
          python -m pip install --upgrade pip
          pip install pyqt5
          pip install numpy

      - name: tetris
        shell: powershell
        run: |
          Remove-Item -Recurse -Force tetris
          git clone https://github.com/seigot/tetris
          cd tetris
          pip install -r requirements.txt
          $Env:QT_QPA_PLATFORM = 'offscreen'
          python start.py -m sample -t 3 -f $HOME/result.json

Powershellのコマンドは以下を駆使して調べればOK

https://docs.microsoft.com/ja-jp/powershell/scripting/learn/tutorials/01-discover-powershell?view=powershell-7.2
コマンドレットを使用して PowerShell を探索する
PowerShell を初めて選択したときは、学習することが多く見えるため、難しいと思われるかもしれません。 しかし、PowerShell は、必要に応じて少しずつ学習できるように設計されています。
PowerShell には、PowerShell をよく知るのに役立つコマンドレットが含まれています。 これら 4 つのコマンドレットを使用して、使用可能なコマンド、実行内容、および操作の対象となる型を確認できます。
Get-Verb. このコマンドを実行すると、ほとんどのコマンドが従う動詞の一覧が返されます。 また、応答には、これらの動詞の動作が記述されています。 ほとんどのコマンドがこの名前付け規則に従うため、コマンドの動作 (適切なコマンドの選択に役立ちます)、さらにはコマンドを作成する場合の名前付けに関する期待値が設定されます。
Get-Command. このコマンドでは、コンピューターにインストールされているすべてのコマンドの一覧が取得されます。
Get-Member. オブジェクトベースの出力に対して動作し、コマンドで使用できるオブジェクト、プロパティ、およびメソッドを検出できます。
Get-Help. コマンドの名前を引数として指定してこのコマンドを呼び出すと、コマンドのさまざまな部分について説明するヘルプ ページが表示されます。

参考

GitHub ActionsでMSBuildによるビルドを行う
GitHub Actions v2使ってMSBuildを試してみた
user interface - Windows用のxvfbやxnestのようなものはありますか?

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?