# windows builds ooniprobe for Windows
name: windows
on:
  push:
    branches:
      - "release/**"
jobs:
  build:
    runs-on: "ubuntu-20.04"
    steps:
      - uses: actions/setup-go@v1
        with:
          go-version: "1.17.3"
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - run: sudo apt install mingw-w64
      - run: |
          echo -n $PSIPHON_CONFIG_KEY > ./internal/engine/psiphon-config.key
          echo $PSIPHON_CONFIG_JSON_AGE_BASE64 | base64 -d > ./internal/engine/psiphon-config.json.age
        env:
          PSIPHON_CONFIG_KEY: ${{ secrets.PSIPHON_CONFIG_KEY }}
          PSIPHON_CONFIG_JSON_AGE_BASE64: ${{ secrets.PSIPHON_CONFIG_JSON_AGE_BASE64 }}
      - run: ./mk MINGW_W64_VERSION="9.3-win32" ./CLI/windows/amd64/ooniprobe.exe
      - uses: actions/upload-artifact@v2
        with:
          name: ooniprobe.exe
          path: ./CLI/windows/amd64/ooniprobe.exe
  test:
    needs: build
    runs-on: "windows-2019"
    steps:
      - uses: actions/checkout@v2
      - uses: actions/download-artifact@v2
        with:
          name: ooniprobe.exe
      - run: bash.exe ./E2E/ooniprobe.sh ./ooniprobe.exe
