|
| 1 | +name: build macOS, Linux, Windows |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + if: "!contains(github.event.head_commit.message, '[ci skip]')" |
| 8 | + |
| 9 | + timeout-minutes: 40 |
| 10 | + |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + os: [macos-10.15, ubuntu-20.04, windows-2019] |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Cancel previous workflow runs |
| 19 | + uses: n1hility/cancel-previous-runs@v2 |
| 20 | + with: |
| 21 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + |
| 23 | + - name: Check-out repository |
| 24 | + uses: actions/checkout@v2 |
| 25 | + |
| 26 | + - name: Set up access to private repos |
| 27 | + uses: webfactory/[email protected] |
| 28 | + with: |
| 29 | + ssh-private-key: ${{ secrets.GH_WEBFACTORY_KEY }} |
| 30 | + |
| 31 | + - name: Set up non-Python dependences (Linux) |
| 32 | + if: runner.os == 'Linux' |
| 33 | + run: | |
| 34 | + sudo apt-get -o Acquire::Retries=3 update |
| 35 | + sudo apt-get -o Acquire::Retries=3 install libxcb-xinerama0 |
| 36 | + sudo apt-get -o Acquire::Retries=3 install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 |
| 37 | + sudo apt-get -o Acquire::Retries=3 install libpulse-mainloop-glib0 |
| 38 | + # sudo apt-get install libgfortran4 |
| 39 | + # echo "QT_DEBUG_PLUGINS=1" >> $GITHUB_ENV |
| 40 | + |
| 41 | + - name: Set up Python environment |
| 42 | + uses: actions/setup-python@v2 |
| 43 | + with: |
| 44 | + python-version: 3.9 |
| 45 | + |
| 46 | + - name: Upgrade PIP |
| 47 | + run: python -m pip install --upgrade pip |
| 48 | + |
| 49 | + - name: Declare env variables on push only |
| 50 | + if: github.event_name == 'push' |
| 51 | + shell: bash |
| 52 | + run: echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV |
| 53 | + |
| 54 | + - name: Declare env variables on pull_request only |
| 55 | + if: github.event_name == 'pull_request' |
| 56 | + shell: bash |
| 57 | + run: echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV |
| 58 | + |
| 59 | + - name: Add extra info to pyproject.toml |
| 60 | + run: python utils.py --update |
| 61 | + |
| 62 | + # https://docs.github.com/en/actions/reference/environment-variables |
| 63 | + - name: Declare env variables on push and pull_request |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + echo "APP_NAME=$(python utils.py --get tool.poetry.name)" >> $GITHUB_ENV |
| 67 | + echo "SCRIPTS_PATH=$(python utils.py --get ci.project.subdirs.scripts)" >> $GITHUB_ENV |
| 68 | + echo "DISTRIBUTION_PATH=$(python utils.py --get ci.project.subdirs.distribution)" >> $GITHUB_ENV |
| 69 | + echo "DOWNLOAD_PATH=$(python utils.py --get ci.project.subdirs.download)" >> $GITHUB_ENV |
| 70 | + echo "QTIFW_PATH=$(python utils.py --get ci.qtifw.setup.installation_path.${{ runner.os }})" >> $GITHUB_ENV |
| 71 | + echo "PYTHON_PACKAGES_PATH=$(python utils.py --get ci.cache.python_packages_path)" >> $GITHUB_ENV |
| 72 | + echo "GIT_INSTALL_URL=git+ssh://[email protected]/$GITHUB_REPOSITORY@${{ env.BRANCH_NAME }}" >> $GITHUB_ENV |
| 73 | +
|
| 74 | + - name: Cache dependencies |
| 75 | + if: False # disable caching |
| 76 | + uses: actions/cache@v2 |
| 77 | + id: cache |
| 78 | + with: |
| 79 | + path: | |
| 80 | + ${{ env.DOWNLOAD_PATH }} |
| 81 | + ${{ env.QTIFW_PATH }} |
| 82 | + ${{ env.PYTHON_PACKAGES_PATH }} |
| 83 | + key: ${{ matrix.os }}-${{ hashFiles('pyproject.toml') }} |
| 84 | + |
| 85 | + - name: Set up Python dependences |
| 86 | + #if: steps.cache.outputs.cache-hit != 'true' |
| 87 | + run: pip install ${{ env.GIT_INSTALL_URL }} |
| 88 | + |
| 89 | + #- name: Relink CrysFML from default Python dylib |
| 90 | + # run: python ${{ env.SCRIPTS_PATH }}/RelinkCrysfml.py |
| 91 | + |
| 92 | + - name: Create freezed python app bundle |
| 93 | + run: python ${{ env.SCRIPTS_PATH }}/FreezeApp.py |
| 94 | + |
| 95 | + - name: Create offline and online app installers from freezed app bundle |
| 96 | + run: python ${{ env.SCRIPTS_PATH }}/MakeInstaller.py ${{ secrets.BINARY_SIGN_WIN }} ${{ secrets.CERT_ZIP_PASS }} |
| 97 | + |
| 98 | + - name: Sign the installer |
| 99 | + run: python ${{ env.SCRIPTS_PATH }}/Signatures.py ${{ secrets.BINARY_SIGN_WIN }} ${{ secrets.CERT_ZIP_PASS }} |
| 100 | + |
| 101 | + - name: Set up screen recording dependencies (macOS) |
| 102 | + if: runner.os == 'macOS' |
| 103 | + run: | |
| 104 | + "/Library/Application Support/VMware Tools/vmware-resolutionSet" 1920 1080 |
| 105 | + system_profiler SPDisplaysDataType | grep Resolution |
| 106 | +
|
| 107 | + - name: Set up screen recording dependencies (Linux) |
| 108 | + if: runner.os == 'Linux' |
| 109 | + run: | |
| 110 | + sudo apt-get install libxkbcommon-x11-0 |
| 111 | + Xvfb :0 -screen 0 1920x1080x24 -ac & |
| 112 | + echo "DISPLAY=:0" >> $GITHUB_ENV |
| 113 | +
|
| 114 | + - name: Set up screen recording dependencies (Windows) |
| 115 | + if: runner.os == 'Windows' |
| 116 | + run: | |
| 117 | + Set-DisplayResolution -Width 1920 -Height 1080 -Force |
| 118 | + Get-DisplayResolution |
| 119 | +
|
| 120 | + - name: Make dir for .desktop file (Linux) |
| 121 | + if: runner.os == 'Linux' |
| 122 | + run: mkdir -p ~/.local/share/applications/ |
| 123 | + |
| 124 | + - name: Install app |
| 125 | + run: python ${{ env.SCRIPTS_PATH }}/InstallApp.py |
| 126 | + |
| 127 | + - name: Run app in testmode, record screen and quit |
| 128 | + # if: runner.os != 'Windows' |
| 129 | + run: python ${{ env.SCRIPTS_PATH }}/RunApp.py --testmode |
| 130 | + |
| 131 | + - name: Rename test videos |
| 132 | + run: python ${{ env.SCRIPTS_PATH }}/CreateTestVideos.py ${{ env.BRANCH_NAME }} |
| 133 | + |
| 134 | + - name: Create zip archive of offline app installer |
| 135 | + run: python ${{ env.SCRIPTS_PATH }}/ZipArtifacts.py ${{ env.BRANCH_NAME }} |
| 136 | + |
| 137 | + - name: Upload zipped offline app installer to GitHub releases |
| 138 | + if: github.event_name == 'push' |
| 139 | + uses: ncipollo/release-action@v1 |
| 140 | + with: |
| 141 | + draft: true |
| 142 | + prerelease: true |
| 143 | + allowUpdates: true |
| 144 | + replacesArtifacts: true |
| 145 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 146 | + artifacts: "${{ env.DISTRIBUTION_PATH }}/${{ env.APP_NAME }}_*.zip,${{ env.DISTRIBUTION_PATH }}/tutorial_*.mp4" |
| 147 | + tag: ${{ env.BRANCH_NAME }} |
| 148 | + commit: ${{ env.BRANCH_NAME }} |
| 149 | + bodyFile: "RELEASE.md" |
| 150 | + |
| 151 | + #- name: Upload online app installer to repository via FTP |
| 152 | + # if: github.event_name == 'push' |
| 153 | + # run: python ${{ env.SCRIPTS_PATH }}/UploadToFtp.py ${{ env.BRANCH_NAME }} ${{ secrets.APP_REPO_FTP_PASSWORD }} |
0 commit comments