### ----------------------------------------------------
### -- SparrowCI
### -- Licenses: Artistic-2.0
### -- Authors: Alexey Melezhik
### -- File: examples/raku/sparrow.yaml
### ----------------------------------------------------
tasks:
  -
    name: test
    default: true
    language: Bash
    code: |
      set -e
      set -x
      s6 --index-update
      cd source 
      tomty --profile=ci --all --show-failed --color 
    depends:
      -
        name: install-zef-deps
      -
        name: install-deps
      -
        name: install-carton
      -
        name: install-powershell
  -
    name: install-zef-deps
    language: Bash
    code: |
      set -e
      cd source
      zef install . --/test

  -
    name: install-deps
    language: Bash
    code: |
      set -e
      sudo apk add --wait 100 \
      ruby-dev ruby-bundler \
      python3 py3-pip python3-dev py3-pytest \
      perl perl-utils
  -
    name: install-carton
    language: Bash
    code: |
      set -e
      sudo apk add --wait 100 perl-dev perl-app-cpanminus
      sudo cpanm -nv Carton 

  - name: install-powershell
    language: Bash
    code: |
      # install the requirements
      sudo apk add --wait 100 --no-cache \
          ca-certificates \
          less \
          ncurses-terminfo-base \
          krb5-libs \
          libgcc \
          libintl \
          libssl1.1 \
          libstdc++ \
          tzdata \
          userspace-rcu \
          zlib \
          icu-libs \
          curl

      sudo apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --wait 100 --no-cache \
          lttng-ust

      # Download the powershell '.tar.gz' archive
      curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.2.7/powershell-7.2.7-linux-alpine-x64.tar.gz -o /tmp/powershell.tar.gz

      # Create the target folder where powershell will be placed
      sudo mkdir -p /opt/microsoft/powershell/7

      # Expand powershell to the target folder
      sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7

      # Set execute permissions
      sudo chmod +x /opt/microsoft/powershell/7/pwsh

      # Create the symbolic link that points to pwsh
      sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh



