💭

runn を GitHub Actions で実行する

2024/03/18に公開

チュートリアルを参考に CI にシナリオテストを組み込みます。

GitHub Environments を使って API のエンドポイントなどの環境依存の設定を切り替えています。

name: Run Scenario Test

on:
  workflow_call:
    inputs:
      version:
        description: Runn version
        required: true
        type: 'string'
      environment:
        description: Target environment
        required: true
        type: 'string'
  workflow_dispatch:
    inputs:
      version:
        type: choice
        required: true
        default: "v0.99.5"
        description: Runn version
        options:
          - "v0.99.5"
          - "v0.99.1"
      environment:
        type: choice
        required: true
        default: "development"
        description: Target environment
        options:
          - "development"
          - "production"

jobs:
  scenario-test:
    name: Scenario test run
    runs-on: ubuntu-latest
    timeout-minutes: 20
    environment: ${{ inputs.environment }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup k1LoW/runn
        uses: k1LoW/gh-setup@v1
        with:
          repo: k1LoW/runn
          version: ${{ inputs.version }}
      - name: Runn version
        run: |
          runn --version
      - name: Run runn
        run: |
          echo "Run runn in ${{ inputs.environment }}"
          runn run --verbose test/runn/scenarios/**/scenario.yml
        env:
          END_POINT: ${{ vars.RUNN_END_POINT }}
          ... 省略 ...

簡単ですがこれで Actions からシナリオテストを実行することが可能となります。

Discussion