chore: Fix threrad safety #1488
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build-imagec | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # - new-image | |
| tags: | |
| - '*' | |
| #pull_request: | |
| # branches: | |
| # - main | |
| jobs: | |
| # | |
| # Linux | |
| # | |
| build-linux: | |
| name: Build on Linux (${{ matrix.with-cuda == 'True' && 'With CUDA' || 'CPU Only' }}) | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| with-cuda: ["True", "False"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build | |
| run: | | |
| sudo rm -rf /usr/local/lib/android/sdk | |
| sudo rm -rf /usr/local/.ghcup | |
| sudo rm -rf /usr/share/swift | |
| sudo docker rmi -f $(docker images -aq) | |
| sudo chmod +x ./build_linux.sh | |
| sudo ./build_linux.sh "${{ github.ref_name }}" "${{ secrets.CONAN_IMAGEC_ARTIFACTORY_PW }}" ${{ matrix.with-cuda }} "${{ github.workspace }}" | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: imagec-x64-linux-${{ matrix.with-cuda == 'True' && 'cuda' || 'cpu' }} | |
| include-hidden-files: true | |
| if-no-files-found: error | |
| path: build/build/output | |
| - name: Upload SBOM to release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: sbom/sbom.cdx.json | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # | |
| # Windows | |
| # | |
| build-windows: | |
| name: Build on Windows (${{ matrix.with-cuda == 'True' && 'With CUDA' || 'CPU Only' }}) | |
| runs-on: windows-2025 | |
| strategy: | |
| matrix: | |
| with-cuda: ["True", "False"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build | |
| run: | | |
| Remove-Item -Recurse -Force $env:ANDROID_SDK_ROOT | |
| $images = docker images -aq | |
| if ($images) { | |
| docker rmi -f $images | |
| } | |
| ./build_win.ps1 "${{ github.ref_name }}" "${{ secrets.CONAN_IMAGEC_ARTIFACTORY_PW }}" ${{ matrix.with-cuda }} "${{ github.workspace }}" | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: imagec-x64-win-${{ matrix.with-cuda == 'True' && 'cuda' || 'cpu' }} | |
| include-hidden-files: true | |
| if-no-files-found: error | |
| path: build/build/output | |
| # | |
| # MacOS | |
| # | |
| build-macos: | |
| name: Build on MacOs (CPU Only) | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build | |
| run: | | |
| chmod +x ./build_macos.sh | |
| ./build_macos.sh "${{ github.ref_name }}" "${{ secrets.CONAN_IMAGEC_ARTIFACTORY_PW }}" "False" "${{ github.workspace }}" | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: imagec-arm64-macos-cpu | |
| include-hidden-files: true | |
| if-no-files-found: error | |
| path: build/build/output | |
| # | |
| # Deploy | |
| # | |
| deploy: | |
| needs: | |
| - build-windows | |
| - build-linux | |
| - build-macos | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Cleanup | |
| run: | | |
| sudo rm -rf /usr/local/lib/android/sdk | |
| sudo rm -rf /usr/local/.ghcup | |
| sudo rm -rf /usr/share/swift | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| name: imagec-x64-linux-cpu | |
| path: imagec-x64-linux-cpu | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| name: imagec-x64-linux-cuda | |
| path: imagec-x64-linux-cuda | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| name: imagec-arm64-macos-cpu | |
| path: imagec-arm64-macos-cpu | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| name: imagec-x64-win-cpu | |
| path: imagec-x64-win-cpu | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| name: imagec-x64-win-cuda | |
| path: imagec-x64-win-cuda | |
| - name: Rename files through architecture | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| chmod +x imagec-x64-linux-cpu/imagec | |
| chmod +x imagec-x64-linux-cpu/imagec.sh | |
| chmod +x imagec-x64-linux-cuda/imagec | |
| chmod +x imagec-x64-linux-cuda/imagec.sh | |
| chmod +x imagec-arm64-macos-cpu/imagec.app/Contents/MacOS/imagec | |
| zip -r imagec-x64-linux-cpu-bundle.zip imagec-x64-linux-cpu | |
| hash_value_linux_cpu=$(sha256sum imagec-x64-linux-cpu/imagec | cut -d ' ' -f 1) | |
| zip -r imagec-x64-linux-cpu-bin.zip imagec-x64-linux-cpu/imagec | |
| rm -rf imagec-x64-linux-cpu | |
| 7z a -mx=6 -mmt=on imagec-x64-linux-cuda-bundle.7z imagec-x64-linux-cuda | |
| hash_value_linux_cuda=$(sha256sum imagec-x64-linux-cuda/imagec | cut -d ' ' -f 1) | |
| zip -r imagec-x64-linux-cuda-bin.zip imagec-x64-linux-cuda/imagec | |
| rm -rf imagec-x64-linux-cuda | |
| zip -r imagec-x64-win-cpu-bundle.zip imagec-x64-win-cpu | |
| hash_value_win_cpu=$(sha256sum imagec-x64-win-cpu/imagec.exe | cut -d ' ' -f 1) | |
| zip -r imagec-x64-win-cpu-bin.zip imagec-x64-win-cpu/imagec.exe | |
| rm -rf imagec-x64-win-cpu | |
| 7z a -mx=6 -mmt=on imagec-x64-win-cuda-bundle.7z imagec-x64-win-cuda | |
| hash_value_win_cuda=$(sha256sum imagec-x64-win-cuda/imagec.exe | cut -d ' ' -f 1) | |
| zip -r imagec-x64-win-cuda-bin.zip imagec-x64-win-cuda/imagec.exe | |
| rm -rf imagec-x64-win-cuda | |
| zip -r imagec-arm64-macos-cpu-bundle.zip imagec-arm64-macos-cpu | |
| hash_value_macos_cpu=$(sha256sum imagec-arm64-macos-cpu/imagec.app/Contents/MacOS/imagec | cut -d ' ' -f 1) | |
| zip -r imagec-arm64-macos-cpu-bin.zip imagec-arm64-macos-cpu/imagec.app | |
| rm -rf imagec-arm64-macos-cpu | |
| timestamp=$(date +"%Y-%m-%d %H:%M:%S") | |
| version="${GITHUB_REF#refs/tags/}" | |
| json_string_linux=$(cat <<-EOF | |
| { | |
| "version": "$version", | |
| "sha256_cpu": "$hash_value_linux_cpu", | |
| "sha256_cuda": "$hash_value_linux_cuda", | |
| "timestamp": "$timestamp" | |
| } | |
| EOF | |
| ) | |
| json_string_win=$(cat <<-EOF | |
| { | |
| "version": "$version", | |
| "sha256_cpu": "$hash_value_win_cpu", | |
| "sha256_cuda": "$hash_value_win_cuda", | |
| "timestamp": "$timestamp" | |
| } | |
| EOF | |
| ) | |
| json_string_macos=$(cat <<-EOF | |
| { | |
| "version": "$version", | |
| "sha256_cpu": "$hash_value_macos_cpu", | |
| "timestamp": "$timestamp" | |
| } | |
| EOF | |
| ) | |
| echo "$json_string_linux" | |
| echo "$json_string_win" | |
| echo "$json_string_macos" | |
| echo "$json_string_linux" > imagec-x64-linux-bundle.json | |
| echo "$json_string_win" > imagec-x64-win-bundle.json | |
| echo "$json_string_macos" > imagec-arm64-macos-bundle.json | |
| - name: Upload Additional Files | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| imagec-x64-linux-cpu-bundle.zip | |
| imagec-x64-win-cpu-bundle.zip | |
| imagec-arm64-macos-cpu-bundle.zip | |
| imagec-x64-linux-cpu-bin.zip | |
| imagec-x64-linux-cuda-bin.zip | |
| imagec-x64-win-cpu-bin.zip | |
| imagec-x64-win-cuda-bin.zip | |
| imagec-arm64-macos-cpu-bin.zip | |
| imagec-x64-win-cuda-bundle.7z | |
| imagec-x64-linux-cuda-bundle.7z | |
| - name: Upload to imagec.org | |
| if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'alpha') | |
| env: | |
| SSH_KEY: ${{ secrets.SSH_KEY_IMAGEC }} | |
| SERVER_NAME : ${{ secrets.SERVER_NAME_IMAGEC }} | |
| run: | | |
| echo "$SSH_KEY" > ssh_key_for_github | |
| chmod 400 ssh_key_for_github | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-linux-cpu-bin.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-linux-cpu-bin.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-linux-cpu-bundle.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-linux-cpu-bundle.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-linux-cuda-bin.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-linux-cuda-bin.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-linux-cuda-bundle.7z github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-linux-cuda-bundle.7z | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-linux-bundle.json github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-linux-bundle.json | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-win-cpu-bin.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-win-cpu-bin.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-win-cpu-bundle.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-win-cpu-bundle.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-win-cuda-bin.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-win-cuda-bin.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-win-cuda-bundle.7z github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-win-cuda-bundle.7z | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-x64-win-bundle.json github@$SERVER_NAME:/var/www/html/downloads/imagec-x64-win-bundle.json | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-arm64-macos-cpu-bin.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-arm64-macos-cpu-bin.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-arm64-macos-cpu-bundle.zip github@$SERVER_NAME:/var/www/html/downloads/imagec-arm64-macos-cpu-bundle.zip | |
| scp -o StrictHostKeyChecking=no -i ssh_key_for_github imagec-arm64-macos-bundle.json github@$SERVER_NAME:/var/www/html/downloads/imagec-arm64-macos-bundle.json | |
| rm -rf ssh_key_for_github |