Skip to content

Commit

Permalink
paralelize lite and full for windows and use one call for release
Browse files Browse the repository at this point in the history
  • Loading branch information
NevermindNilas committed Aug 22, 2024
1 parent d6547cf commit 18db156
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 45 deletions.
123 changes: 79 additions & 44 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ on:
workflow_dispatch:

jobs:
build:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
date: ${{ steps.date.outputs.date }}
steps:
- name: Get the date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TAS }}
with:
tag_name: TAS_${{ steps.date.outputs.date }}
release_name: TAS_${{ steps.date.outputs.date }}
draft: true

build_full:
needs: create_release
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
Expand All @@ -15,12 +36,6 @@ jobs:
asset-content-type: application/x-7z-compressed
asset-extension: .7z
asset-suffix: "_Full_Windows"
- os: windows-latest
python-version: "3.12.4"
build-script: build-lite.py
asset-content-type: application/x-7z-compressed
asset-extension: .7z
asset-suffix: "_Lite_Windows"
- os: ubuntu-latest
python-version: "3.12.4"
build-script: build-linux.py
Expand Down Expand Up @@ -60,13 +75,6 @@ jobs:
with:
cuda: "12.4.0"

- name: Verify CUDA Installation (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
echo "Installed cuda version is: ${{ steps.cuda-toolkit.outputs.cuda }}"
echo "Cuda install location: ${{ steps.cuda-toolkit.outputs.CUDA_PATH }}"
nvcc -V
- name: Print working directory and disk space (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
Expand All @@ -83,53 +91,80 @@ jobs:
echo "Available disk space on all drives:"
Get-PSDrive -PSProvider FileSystem | Select-Object -Property Name, @{Name="Used(GB)";Expression={[math]::round($_.Used/1GB,2)}}, @{Name="Free(GB)";Expression={[math]::round($_.Free/1GB,2)}}, @{Name="Total(GB)";Expression={[math]::round($_.Used/1GB,2) + [math]::round($_.Free/1GB,2)}}
- name: Run full build script ( Windows - Full )
if: contains(matrix.asset-suffix, '_Full')
- name: Run full build script
run: python ${{ matrix.build-script }} --output dist-full

- name: Run lite build script ( Windows - Lite )
if: contains(matrix.asset-suffix, '_Lite')
run: python ${{ matrix.build-script }} --output dist-lite
- name: Compress full directory (Windows)
if: matrix.os == 'windows-latest'
run: |
cd ${{ github.workspace }}/dist-full/main/
7z a -t7z -m0=lzma2 -mx=9 -ms=1536m -md=273m ../../TAS_${{ needs.create_release.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }} *
- name: Get the date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
- name: Compress full directory (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cd ${{ github.workspace }}/dist/main/
7z a -t7z -m0=lzma2 -mx=9 -ms=1536m -md=273m ../../TAS_${{ needs.create_release.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }} *
- name: Create Release
id: create_release
uses: actions/create-release@v1
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TAS }}
with:
tag_name: TAS_${{ steps.date.outputs.date }}
release_name: TAS_${{ steps.date.outputs.date }}
draft: true
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: TAS_${{ needs.create_release.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }}
asset_name: TAS_${{ needs.create_release.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }}
asset_content_type: ${{ matrix.asset-content-type }}

- name: Compress full directory ( Windows - Full )
if: matrix.os == 'windows-latest' && contains(matrix.asset-suffix, '_Full')
run: |
cd ${{ github.workspace }}/dist-full/main/
7z a -t7z -m0=lzma2 -mx=9 -ms=1536m -md=273m ../../TAS_${{ steps.date.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }} *
build_lite:
needs: create_release
strategy:
matrix:
os: [windows-latest]
include:
- os: windows-latest
python-version: "3.12.4"
build-script: build-lite.py
asset-content-type: application/x-7z-compressed
asset-extension: .7z
asset-suffix: "_Lite_Windows"
fail-fast: true
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Compress lite directory ( Windows - Lite )
if: matrix.os == 'windows-latest' && contains(matrix.asset-suffix, '_Lite')
- name: Print working directory and disk space (Windows)
run: |
cd ${{ github.workspace }}/dist-lite/main/
7z a -t7z -m0=lzma2 -mx=9 -ms=1536m -md=273m ../../TAS_${{ steps.date.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }} *
echo "Current working directory:"
pwd
echo "Available disk space on all drives:"
Get-PSDrive -PSProvider FileSystem | Select-Object -Property Name, @{Name="Used(GB)";Expression={[math]::round($_.Used/1GB,2)}}, @{Name="Free(GB)";Expression={[math]::round($_.Free/1GB,2)}}, @{Name="Total(GB)";Expression={[math]::round($_.Used/1GB,2) + [math]::round($_.Free/1GB,2)}}
- name: Compress full directory ( Ubuntu )
if: matrix.os == 'ubuntu-latest'
- name: Run lite build script
run: python ${{ matrix.build-script }} --output dist-lite

- name: Compress lite directory
run: |
cd ${{ github.workspace }}/dist-full/main/
7z a -t7z -m0=lzma2 -mx=9 -ms=1536m -md=273m ../../TAS_${{ steps.date.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }} *
cd ${{ github.workspace }}/dist-lite/main/
7z a -t7z -m0=lzma2 -mx=9 -ms=1536m -md=273m ../../TAS_${{ needs.create_release.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }} *
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TAS }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: TAS_${{ steps.date.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }}
asset_name: TAS_${{ steps.date.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }}
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: TAS_${{ needs.create_release.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }}
asset_name: TAS_${{ needs.create_release.outputs.date }}${{ matrix.asset-suffix }}${{ matrix.asset-extension }}
asset_content_type: ${{ matrix.asset-content-type }}
1 change: 0 additions & 1 deletion build-linux.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import subprocess
import os
import shutil
from importlib.metadata import distribution

base_dir = os.path.dirname(os.path.abspath(__file__))
distPath = os.path.join(base_dir, "dist")
Expand Down

0 comments on commit 18db156

Please sign in to comment.