summaryrefslogtreecommitdiffstats
path: root/.github/workflows/windows10_build.yml
blob: 57a2ff18d7a1bff9b41fbd3583139e6835e92005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Windows10 Build

env:
  OPENBB_ENABLE_QUICK_EXIT: true
  OPENBB_LOG_COLLECT: false
  OPENBB_USE_PROMPT_TOOLKIT: false
  PIP_DEFAULT_TIMEOUT: 100
  PYTHONNOUSERSITE: 1

on: workflow_dispatch

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  Windows-Build:
    name: Windows10 Build ENV
    runs-on: windows-latest
    # Configuring -------------
    steps:
      - name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system
        run: |
          Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
          git config --system core.longpaths true

      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up Python & Create OpenBB Environment
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Create and start virtual environment
        run: |
          python -m venv venv --upgrade-deps
          source venv/Scripts/activate
          python -m pip install setuptools==65.4.1 wheel
          python -m pip install -r requirements-full.txt
          python -m pip uninstall papermill -y
          python -m pip install git+https://github.com/nteract/papermill.git@main
          python -m PyInstaller build/pyinstaller/terminal.spec --clean
          pwd
        shell: bash

      - name: zip the file
        run: |
          Get-Location
          Compress-Archive dist release.zip
        shell: pwsh

      - name: Upload Artifact
        uses: actions/upload-artifact@v3
        with:
          name: OpenBB-Windows10-ENV
          path: release.zip


  Build-Exe:
    name: Windows10 Build-Exe
    runs-on: [self-hosted, Windows, x64]
    needs: Windows-Build
    # Configuring -------------
    steps:
      - name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system
        run: |
          Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
          git config --system core.longpaths true

      - name: Checkout
        uses: actions/checkout@v3

      - name: Download Artifact
        uses: actions/download-artifact@v3
        with:
          name: OpenBB-Windows10-ENV
          path: .

      - name: unzip artifact for deployment
        run: Expand-Archive release.zip -DestinationPath .
        shell: pwsh

      - name: Move Files into App Folder
        run: cp -r .\dist\OpenBBTerminal\ .\build\nsis\app\
      # don't need this because log collection is turned off
      # - name: Remove Log Data
      #   run: Remove-Item .\build\nsis\app\openbb_terminal\logs\ -Recurse
      - name: Build Exe File
        run: |
          C:\'.\Program Files (x86)\'\nsis\makensis.exe .\build\nsis\setup.nsi

      # This should autosign the installer now - We really need to only do this when needed though. ON RELEASE
      - name: Sign Installer
        if: startsWith(github.ref, 'refs/heads/main')
        run: |
          & 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /td sha256 /sha1 0bf95b74b3b8763434e1782df36052d42c5c0bef 'C:\Users\Administrator\actions-runner\_work\OpenBBTerminal\OpenBBTerminal\build\nsis\OpenBB Terminal Setup.exe'

      - name: Save Build Artifact
        uses: actions/upload-artifact@v3
        with:
          name: Windows EXE Artifact
          path: '.\build\nsis\OpenBB Terminal Setup.exe'

      - name: Run Integration Tests
        run: |
          dist\OpenBBTerminal\OpenBBTerminal.exe -t -s forecast cryptocurrency reports alternative economy futures econometrics dashboards portfolio stocks/test_stocks_options_screen.openbb stocks/test_stocks_options.openbb forex etf stocks/test_stocks_fa.openbb | tee result.txt
          Select-String "================================ Integration Test Summary ================================" result.txt -Context 0,100 | Select-Object -Last 2000 | Out-File summary.txt
          Write-output `n >> summary.txt

      - name: Run Integration Tests Coverage Report
        run: |
          dist\OpenBBTerminal\OpenBBTerminal.exe -t --coverage | tee result.txt
          Select-String "============================== Integration Coverage Summary ==============================" result.txt -Context 0,300 | Select-Object -Last 2000 >> summary.txt

      - name: Upload summary to Slack
        uses: adrey/slack-file-upload-action@master
        with:
          token: ${{ secrets.SLACK_API_TOKEN }}
          initial_comment: "Windows Build Integration test summary"
          title: "Windows Build Integration test summary"
          path: summary.txt
          channel: ${{ secrets.SLACK_CHANNEL_ID }}

      # Cleaning ------------------------
      # Make sure to add Remove-Item C:\Users\Administrator\Desktop\OPENBB-exports -Recurse whenever integration tests get fixed
      - name: Remove Previous Build
        run: |
          Remove-Item '.\build\nsis\OpenBB Terminal Setup.exe' -Recurse
          Remove-Item .\build\nsis\app\ -Recurse
          Remove-Item .\dist\ -Recurse