diff --git a/.github/workflows/build_parallel.yaml b/.github/workflows/build_parallel.yaml new file mode 100644 index 0000000..4798af5 --- /dev/null +++ b/.github/workflows/build_parallel.yaml @@ -0,0 +1,187 @@ +name: Build Windows Parallel +on: + workflow_dispatch: + push: + branches: + - main +jobs: + download_otb: + runs-on: windows-latest + steps: + - run: mkdir OTB-9.0.0-Win64 + - name: Get otb cache directory + id: otb-cache + shell: pwsh + run: echo "dir=$(pwd)\OTB-9.0.0-Win64" >> ${env:GITHUB_OUTPUT} + - name: otb cache + uses: actions/cache@v3 + with: + path: ${{ steps.otb-cache.outputs.dir }} + key: ${{ runner.os }}-otb-${{ hashFiles('**/main.py') }} + restore-keys: | + ${{ runner.os }}-otb- + - if: ${{ steps.otb-cache.outputs.cache-hit != 'true'}} + name: download OTB-9.0.0-Win64.zip + uses: gamedev-thingy/Download-Extract@done + with: + url: https://www.orfeo-toolbox.org/packages/OTB-9.0.0-Win64.zip + destination: OTB-9.0.0-Win64 + ZIPname: OTB-9.0.0-Win64 + - run: | + 7z a -tzip OTB-9.0.0-Win64.zip OTB-9.0.0-Win64/* + - name: Upload OTB + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: OTB-9.0.0-Win64 + # A file, directory or wildcard pattern that describes what to upload + path: "OTB-9.0.0-Win64.zip" + + build_python_app: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Get pip cache dir + id: pip-cache + run: echo "dir=$(pip cache dir)" >> ${env:GITHUB_OUTPUT} + - name: pip cache + uses: actions/cache@v3 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: install python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' # caching pip dependencies + + - name: building + run: | + pip install -r requirements.txt + pip install nuitka + nuitka main.py + + cp -r "data" "main.dist" + ren "main.dist" "bin" + + 7z a -tzip bin.zip bin/* + + - name: Upload + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: bin + # A file, directory or wildcard pattern that describes what to upload + path: bin.zip" + + + build_electron_app: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + + - name: Setup Node.js environment + uses: actions/setup-node@v4 + with: + # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0. + # node-version: 20.x + # File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions. + architecture: package.json + # Set this option if you want the action to check for the latest available version that satisfies the version spec. + check-latest: true + # Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm. + cache: npm + # Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies. + cache-dependency-path: package-lock.json + - name: Get npm cache directory + id: npm-cache-dir + shell: pwsh + run: echo "dir=$(npm config get cache)" >> ${env:GITHUB_OUTPUT} + - name: npm cache + uses: actions/cache@v3 + id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: building and pack + run: | + npm install + npm run pack + + - name: Upload + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: electron_app + # A file, directory or wildcard pattern that describes what to upload + path: "dist/win-unpacke/*" + + pack_app: + needs: [download_otb, build_parallel, build_electron_app] + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download0artifact@v4 + with: + # Name of the artifact to download. + # If unspecified, all artifacts for the run are downloaded. + # Optional. + name: OTB-9.0.0-Win64 + + # Destination path. Supports basic tilde expansion. + # Optional. Default is $GITHUB_WORKSPACE + # path: + + # A glob pattern to the artifacts that should be downloaded. + # Ignored if name is specified. + # Optional. + # pattern: + + # When multiple artifacts are matched, this changes the behavior of the destination directories. + # If true, the downloaded artifacts will be in the same directory specified by path. + # If false, the downloaded artifacts will be extracted into individual named directories within the specified path. + # Optional. Default is 'false' + # merge-multiple: + + # The GitHub token used to authenticate with the GitHub API. + # This is required when downloading artifacts from a different repository or from a different workflow run. + # Optional. If unspecified, the action will download artifacts from the current repo and the current workflow run. + # github-token: + + # The repository owner and the repository name joined together by "/". + # If github-token is specified, this is the repository that artifacts will be downloaded from. + # Optional. Default is ${{ github.repository }} + # repository: + + # The id of the workflow run where the desired download artifact was uploaded from. + # If github-token is specified, this is the run that artifacts will be downloaded from. + # Optional. Default is ${{ github.run_id }} + # run-id: + + - uses: actions/download0artifact@v4 + with: + # Name of the artifact to download. + # If unspecified, all artifacts for the run are downloaded. + # Optional. + name: OTB-9.0.0-Win64 + + - uses: actions/download0artifact@v4 + with: + # Name of the artifact to download. + # If unspecified, all artifacts for the run are downloaded. + # Optional. + name: electron_app + + - run: | + dir + dir bin + dir electron_app + dir OTB-9.0.0-Win64 +