on:
  workflow_dispatch: {}
  schedule:
    - cron: '0 * * * *' # Every hour
  push:
    tags:
    - '*'
  pull_request:
    types: [opened, edited]
name: Package manager test
jobs:
  homebrew:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
        with:
          sparse-checkout: |
            scripts/install-test.sh
          sparse-checkout-cone-mode: false
      - run: bash scripts/install-test.sh homebrew
        env:
          PAGERDUTY_INTEGRATION_KEY: ${{ secrets.PAGERDUTY_INTEGRATION_KEY }}
  apt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          sparse-checkout: |
            scripts/install-test.sh
          sparse-checkout-cone-mode: false
      - run: bash scripts/install-test.sh apt
        env:
          PAGERDUTY_INTEGRATION_KEY: ${{ secrets.PAGERDUTY_INTEGRATION_KEY }}
  yum:
    runs-on: ubuntu-latest
    container: fedora:latest
    steps:
      - run: |
          if [ ! -d "/etc/yum.repos.d" ]; then
              sudo mkdir /etc/yum.repos.d
          fi
              echo "[Stripe]
          name=stripe
          baseurl=https://packages.stripe.dev/stripe-cli-rpm-local/
          enabled=1
          gpgcheck=0" | sudo tee /etc/yum.repos.d/stripe.repo

      - uses: actions/checkout@v4
        with:
          sparse-checkout: |
            scripts/install-test.sh
          sparse-checkout-cone-mode: false
      - run: bash scripts/install-test.sh yum
        env:
          PAGERDUTY_INTEGRATION_KEY: ${{ secrets.PAGERDUTY_INTEGRATION_KEY }}
  scoop:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v4
      with:
        sparse-checkout: |
          scripts/install-test.sh
        sparse-checkout-cone-mode: false
    - uses: MinoruSekine/setup-scoop@v4
    - shell: powershell
      run: bash scripts/install-test.sh scoop
      env:
          PAGERDUTY_INTEGRATION_KEY: ${{ secrets.PAGERDUTY_INTEGRATION_KEY }}
  docker:
    runs-on: ubuntu-latest
    container: stripe/stripe-cli:latest
    steps:
      - uses: actions/checkout@v4
        with:
          sparse-checkout: |
            scripts/install-test.sh
          sparse-checkout-cone-mode: false
      - run: sh scripts/install-test.sh docker
        env:
          PAGERDUTY_INTEGRATION_KEY: ${{ secrets.PAGERDUTY_INTEGRATION_KEY }}
