From 76770f5514c687c7fbe0a6c6dd8f6fbb79a5a21f Mon Sep 17 00:00:00 2001 From: Rahman Yusuf Date: Fri, 7 Jun 2024 13:00:20 +0700 Subject: [PATCH] Test architecture arm/v6 (part 3) --- .github/workflows/build.yml | 303 ++++++++++++++++++------------------ Dockerfile.optional | 3 +- 2 files changed, 152 insertions(+), 154 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6acbeb0a..85ba480d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,9 +88,6 @@ jobs: context: . file: Dockerfile.optional platforms: | - linux/amd64 - linux/arm64 - linux/arm/v7 linux/arm/v6 # push: true tags: | @@ -98,154 +95,154 @@ jobs: mansuf/mangadex-downloader:${{ github.ref_name }}-optional mansuf/mangadex-downloader:v2.10.3-optional - windows-build: - name: Build app & docs (Windows) - runs-on: windows-latest - strategy: - matrix: - python-version: [ '3.8', '3.9', '3.10' ] - - steps: - # Make sure cancels CI when tags is released - - name: Cancel previous runs - if: startsWith(github.ref, 'refs/tags/') && github.repository == 'mansuf/mangadex-downloader' - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - all_but_latest: true - - - name: Clone repo - uses: actions/checkout@v3 - - - name: Setup python (x64) - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - - - name: Setup python (x86) - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: x86 - - - name: Install required libraries - run: | - py -${{ matrix.python-version }}-64 -m pip install -U pip - py -${{ matrix.python-version }}-64 -m pip install -U wheel pyinstaller setuptools - py -${{ matrix.python-version }}-64 -m pip install -U .[optional] - - py -${{ matrix.python-version }}-32 -m pip install -U pip - py -${{ matrix.python-version }}-32 -m pip install -U wheel pyinstaller setuptools - py -${{ matrix.python-version }}-32 -m pip install -U .[optional] - - - name: Test imports - run: | - # I..... have no idea for this - mangadex-dl --version - - - name: Get python version - run: | - $PythonVersion = (python --version) - Write-Output "python_version=${PythonVersion}" | Out-File -FilePath $env:GITHUB_ENV -Append - - # Build mangadex-downloader with PyInstaller - # only allow python 3.10 - - - name: Setup python (x86) - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: x86 - - - name: Compile script - if: ${{ contains(env.python_version, '3.10') }} - run: | - py -${{ matrix.python-version }}-64 -m PyInstaller "mangadex-dl_x64.spec" --distpath "./dist_x64" - py -${{ matrix.python-version }}-32 -m PyInstaller "mangadex-dl_x86.spec" --distpath "./dist_x86" - - - name: Run compiled script - if: ${{ contains(env.python_version, '3.10') }} - run: | - & ".\dist_x64\mangadex-dl_x64\mangadex-dl_x64.exe" --version - & ".\dist_x86\mangadex-dl_x86\mangadex-dl_x86.exe" --version - - - name: Cleanup build - if: contains(env.python_version, '3.10') - run: | - # x86 executable - copy "LICENSE" "dist_x86\mangadex-dl_x86" - copy "README.md" "dist_x86\mangadex-dl_x86" - copy "docs\changelog.md" "dist_x86\mangadex-dl_x86" - echo "${{ github.ref_name }}" | Out-File -FilePath "dist_x86\mangadex-dl_x86\version.txt" -NoNewLine - echo "mangadex-dl.exe --update" | Out-File -FilePath "dist_x86\mangadex-dl_x86\update.bat" - echo "start cmd" | Out-File -FilePath "dist_x86\mangadex-dl_x86\start cmd.bat" - Rename-Item -Path "dist_x86\mangadex-dl_x86\mangadex-dl_x86.exe" -NewName "mangadex-dl.exe" - Rename-Item -Path "dist_x86\mangadex-dl_x86" -NewName "mangadex-dl" - Compress-Archive -Path "dist_x86\mangadex-dl" -DestinationPath "mangadex-dl_x86_${{ github.ref_name }}.zip" - - # x64 executable - copy "LICENSE" "dist_x64\mangadex-dl_x64" - copy "README.md" "dist_x64\mangadex-dl_x64" - copy "docs\changelog.md" "dist_x64\mangadex-dl_x64" - echo "${{ github.ref_name }}" | Out-File -FilePath "dist_x64\mangadex-dl_x64\version.txt" -NoNewLine - echo "mangadex-dl.exe --update" | Out-File -FilePath "dist_x64\mangadex-dl_x64\update.bat" - echo "start cmd" | Out-File -FilePath "dist_x64\mangadex-dl_x64\start cmd.bat" - Rename-Item -Path "dist_x64\mangadex-dl_x64\mangadex-dl_x64.exe" -NewName "mangadex-dl.exe" - Rename-Item -Path "dist_x64\mangadex-dl_x64" -NewName "mangadex-dl" - Compress-Archive -Path "dist_x64\mangadex-dl" -DestinationPath "mangadex-dl_x64_${{ github.ref_name }}.zip" - - - name: Upload artifact (x64) - if: contains(env.python_version, '3.10') - uses: actions/upload-artifact@v3 - with: - name: mangadex-dl_x64 - path: dist_x64/mangadex-dl/ - - - name: Upload artifact (x86) - if: contains(env.python_version, '3.10') - uses: actions/upload-artifact@v3 - with: - name: mangadex-dl_x86 - path: dist_x86/mangadex-dl/ - - - name: Get File hash - if: contains(env.python_version, '3.10') - run: | - $File_x86 = "mangadex-dl_x86_${{ github.ref_name }}.zip" - $File_x64 = "mangadex-dl_x64_${{ github.ref_name }}.zip" - - $Hash_x86 = (Get-FileHash -Algorithm SHA256 ${File_x86}).Hash.ToLower() - $Hash_x64 = (Get-FileHash -Algorithm SHA256 ${File_x64}).Hash.ToLower() - - echo "mangadex_dl_x64_hash=${Hash_x64}" | Out-File -FilePath $env:GITHUB_ENV -Append - echo "mangadex_dl_x86_hash=${Hash_x86}" | Out-File -FilePath $env:GITHUB_ENV -Append - - echo "${File_x64} Hash = ${Hash_x64}" - echo "${File_x86} Hash = ${Hash_x86}" - - - name: Create Release - if: startsWith(github.ref, 'refs/tags/') && contains(env.python_version, '3.10') && github.repository == 'mansuf/mangadex-downloader' - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ env.GIRHUB_REF_NAME }} - name: mangadex-downloader ${{ github.ref_name }} - body: | - ------ - - ## Files hash - - | Name | SHA-256 | - | ---- | ------- | - | mangadex-dl_x64_${{ github.ref_name }}.zip | ${{ env.mangadex_dl_x64_hash }} | - | mangadex-dl_x86_${{ github.ref_name }}.zip | ${{ env.mangadex_dl_x86_hash }} | - - These binaries are for Windows only. - files: | - mangadex-dl_x64_${{ github.ref_name }}.zip - mangadex-dl_x86_${{ github.ref_name }}.zip - draft: true - prerelease: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # windows-build: + # name: Build app & docs (Windows) + # runs-on: windows-latest + # strategy: + # matrix: + # python-version: [ '3.8', '3.9', '3.10' ] + + # steps: + # # Make sure cancels CI when tags is released + # - name: Cancel previous runs + # if: startsWith(github.ref, 'refs/tags/') && github.repository == 'mansuf/mangadex-downloader' + # uses: styfle/cancel-workflow-action@0.9.1 + # with: + # access_token: ${{ github.token }} + # all_but_latest: true + + # - name: Clone repo + # uses: actions/checkout@v3 + + # - name: Setup python (x64) + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # architecture: x64 + + # - name: Setup python (x86) + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # architecture: x86 + + # - name: Install required libraries + # run: | + # py -${{ matrix.python-version }}-64 -m pip install -U pip + # py -${{ matrix.python-version }}-64 -m pip install -U wheel pyinstaller setuptools + # py -${{ matrix.python-version }}-64 -m pip install -U .[optional] + + # py -${{ matrix.python-version }}-32 -m pip install -U pip + # py -${{ matrix.python-version }}-32 -m pip install -U wheel pyinstaller setuptools + # py -${{ matrix.python-version }}-32 -m pip install -U .[optional] + + # - name: Test imports + # run: | + # # I..... have no idea for this + # mangadex-dl --version + + # - name: Get python version + # run: | + # $PythonVersion = (python --version) + # Write-Output "python_version=${PythonVersion}" | Out-File -FilePath $env:GITHUB_ENV -Append + + # # Build mangadex-downloader with PyInstaller + # # only allow python 3.10 + + # - name: Setup python (x86) + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python-version }} + # architecture: x86 + + # - name: Compile script + # if: ${{ contains(env.python_version, '3.10') }} + # run: | + # py -${{ matrix.python-version }}-64 -m PyInstaller "mangadex-dl_x64.spec" --distpath "./dist_x64" + # py -${{ matrix.python-version }}-32 -m PyInstaller "mangadex-dl_x86.spec" --distpath "./dist_x86" + + # - name: Run compiled script + # if: ${{ contains(env.python_version, '3.10') }} + # run: | + # & ".\dist_x64\mangadex-dl_x64\mangadex-dl_x64.exe" --version + # & ".\dist_x86\mangadex-dl_x86\mangadex-dl_x86.exe" --version + + # - name: Cleanup build + # if: contains(env.python_version, '3.10') + # run: | + # # x86 executable + # copy "LICENSE" "dist_x86\mangadex-dl_x86" + # copy "README.md" "dist_x86\mangadex-dl_x86" + # copy "docs\changelog.md" "dist_x86\mangadex-dl_x86" + # echo "${{ github.ref_name }}" | Out-File -FilePath "dist_x86\mangadex-dl_x86\version.txt" -NoNewLine + # echo "mangadex-dl.exe --update" | Out-File -FilePath "dist_x86\mangadex-dl_x86\update.bat" + # echo "start cmd" | Out-File -FilePath "dist_x86\mangadex-dl_x86\start cmd.bat" + # Rename-Item -Path "dist_x86\mangadex-dl_x86\mangadex-dl_x86.exe" -NewName "mangadex-dl.exe" + # Rename-Item -Path "dist_x86\mangadex-dl_x86" -NewName "mangadex-dl" + # Compress-Archive -Path "dist_x86\mangadex-dl" -DestinationPath "mangadex-dl_x86_${{ github.ref_name }}.zip" + + # # x64 executable + # copy "LICENSE" "dist_x64\mangadex-dl_x64" + # copy "README.md" "dist_x64\mangadex-dl_x64" + # copy "docs\changelog.md" "dist_x64\mangadex-dl_x64" + # echo "${{ github.ref_name }}" | Out-File -FilePath "dist_x64\mangadex-dl_x64\version.txt" -NoNewLine + # echo "mangadex-dl.exe --update" | Out-File -FilePath "dist_x64\mangadex-dl_x64\update.bat" + # echo "start cmd" | Out-File -FilePath "dist_x64\mangadex-dl_x64\start cmd.bat" + # Rename-Item -Path "dist_x64\mangadex-dl_x64\mangadex-dl_x64.exe" -NewName "mangadex-dl.exe" + # Rename-Item -Path "dist_x64\mangadex-dl_x64" -NewName "mangadex-dl" + # Compress-Archive -Path "dist_x64\mangadex-dl" -DestinationPath "mangadex-dl_x64_${{ github.ref_name }}.zip" + + # - name: Upload artifact (x64) + # if: contains(env.python_version, '3.10') + # uses: actions/upload-artifact@v3 + # with: + # name: mangadex-dl_x64 + # path: dist_x64/mangadex-dl/ + + # - name: Upload artifact (x86) + # if: contains(env.python_version, '3.10') + # uses: actions/upload-artifact@v3 + # with: + # name: mangadex-dl_x86 + # path: dist_x86/mangadex-dl/ + + # - name: Get File hash + # if: contains(env.python_version, '3.10') + # run: | + # $File_x86 = "mangadex-dl_x86_${{ github.ref_name }}.zip" + # $File_x64 = "mangadex-dl_x64_${{ github.ref_name }}.zip" + + # $Hash_x86 = (Get-FileHash -Algorithm SHA256 ${File_x86}).Hash.ToLower() + # $Hash_x64 = (Get-FileHash -Algorithm SHA256 ${File_x64}).Hash.ToLower() + + # echo "mangadex_dl_x64_hash=${Hash_x64}" | Out-File -FilePath $env:GITHUB_ENV -Append + # echo "mangadex_dl_x86_hash=${Hash_x86}" | Out-File -FilePath $env:GITHUB_ENV -Append + + # echo "${File_x64} Hash = ${Hash_x64}" + # echo "${File_x86} Hash = ${Hash_x86}" + + # - name: Create Release + # if: startsWith(github.ref, 'refs/tags/') && contains(env.python_version, '3.10') && github.repository == 'mansuf/mangadex-downloader' + # uses: softprops/action-gh-release@v1 + # with: + # tag_name: ${{ env.GIRHUB_REF_NAME }} + # name: mangadex-downloader ${{ github.ref_name }} + # body: | + # ------ + + # ## Files hash + + # | Name | SHA-256 | + # | ---- | ------- | + # | mangadex-dl_x64_${{ github.ref_name }}.zip | ${{ env.mangadex_dl_x64_hash }} | + # | mangadex-dl_x86_${{ github.ref_name }}.zip | ${{ env.mangadex_dl_x86_hash }} | + + # These binaries are for Windows only. + # files: | + # mangadex-dl_x64_${{ github.ref_name }}.zip + # mangadex-dl_x86_${{ github.ref_name }}.zip + # draft: true + # prerelease: false + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile.optional b/Dockerfile.optional index ed03a9dc..bf623c18 100644 --- a/Dockerfile.optional +++ b/Dockerfile.optional @@ -4,9 +4,10 @@ COPY . /app WORKDIR /app # Workaround for arm/v6 +RUN lscpu RUN export "ARCHITECTURE=$(lscpu | grep Architecture | sed -e 's/Architecture:\s//g')" RUN echo $ARCHITECTURE -RUN if [[ $ARCHITECTURE == "arm/v6" ]]; then echo "arm/v6 architecture"; fi +RUN if [ $ARCHITECTURE = "arm/v6" ]; then echo "arm/v6 architecture"; fi # Setup rust RUN apt update && apt install wget