From d2c7e0c9186d6aac145f79bf5433466464e8786c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar=20Rubio?= Date: Mon, 11 Nov 2024 17:19:30 +0100 Subject: [PATCH] Better CI configuration (#314) --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04d076a..39e52f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,10 +87,10 @@ jobs: - uses: actions/upload-artifact@v4 with: path: docs/_build/html/* + name: docs build-wheel-sdist: needs: - - lint - test - test-docs name: Build package @@ -112,8 +112,10 @@ jobs: build-standalone-dist: name: Build standalone - needs: build-wheel-sdist - runs-on: ubuntu-latest + needs: + - test + - test-docs + runs-on: ${{ matrix.runs-on }} strategy: fail-fast: false matrix: @@ -121,7 +123,7 @@ jobs: - ubuntu-latest # ARM - macos-14 - # X86 + # X86_64 - macos-13 - windows-latest steps: @@ -130,21 +132,29 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" - - name: Install dependencies - run: | - pip install -U pyinstaller - sudo apt install upx + - name: Install PyInstaller + run: pip install -U pyinstaller + - name: Install UPX + if: matrix.runs-on == 'windows-latest' + shell: bash + run: choco install -y upx + - name: Install UPX + if: matrix.runs-on == 'ubuntu-latest' + run: sudo apt-get install -y upx-ucl - name: Install package run: pip install . - name: Build standalone distribution shell: bash run: sh scripts/build.sh - name: Compress with UPX + if: matrix.runs-on != 'macos-13' && matrix.runs-on != 'macos-14' + run: upx -f --best -9 dist/* + - if: matrix.runs-on == 'windows-latest' run: | - upx --best -9 dist/md2po - upx --best -9 dist/po2md - upx --best -9 dist/md2po2md - upx --best -9 dist/mdpo2html + mv dist/md2po.exe dist/md2po + mv dist/po2md.exe dist/po2md + mv dist/md2po2md.exe dist/md2po2md + mv dist/mdpo2html.exe dist/mdpo2html - name: Prepare upload run: | mv dist/md2po dist/md2po-${{ matrix.runs-on }} @@ -162,6 +172,7 @@ jobs: name: Build final distribution runs-on: ubuntu-latest needs: + - lint - build-wheel-sdist - build-standalone-dist steps: @@ -179,7 +190,7 @@ jobs: uses: actions/download-artifact@v4 with: name: macos-13-build - path: ./build/mac-x64 + path: ./build/mac-x86_64 - name: Download Linux artifact uses: actions/download-artifact@v4 with: @@ -198,20 +209,20 @@ jobs: mv md2po2md-ubuntu-latest md2po2md mv mdpo2html-ubuntu-latest mdpo2html cd ../.. - tar -czf dist/mdpo-linux-x64.tar.gz -C build/linux \ + tar -czf dist/mdpo-linux-x86_64.tar.gz -C build/linux \ md2po po2md md2po2md mdpo2html - name: Create MacOS tarballs run: | cd build - mv mac-x64/md2po-macos-13 mac-x64/md2po + mv mac-x86_64/md2po-macos-13 mac-x86_64/md2po mv mac-arm64/md2po-macos-14 mac-arm64/md2po - mv mac-x64/po2md-macos-13 mac-x64/po2md + mv mac-x86_64/po2md-macos-13 mac-x86_64/po2md mv mac-arm64/po2md-macos-14 mac-arm64/po2md - mv mac-x64/md2po2md-macos-13 mac-x64/md2po2md + mv mac-x86_64/md2po2md-macos-13 mac-x86_64/md2po2md mv mac-arm64/md2po2md-macos-14 mac-arm64/md2po2md - mv mac-x64/mdpo2html-macos-13 mac-x64/mdpo2html + mv mac-x86_64/mdpo2html-macos-13 mac-x86_64/mdpo2html mv mac-arm64/mdpo2html-macos-14 mac-arm64/mdpo2html - tar -czf ../dist/mdpo-mac-x64.tar.gz -C mac-x64 \ + tar -czf ../dist/mdpo-mac-x86_64.tar.gz -C mac-x86_64 \ md2po po2md md2po2md mdpo2html tar -czf ../dist/mdpo-mac-arm64.tar.gz -C mac-arm64 \ md2po po2md md2po2md mdpo2html @@ -222,7 +233,7 @@ jobs: mv po2md-windows-latest po2md.exe mv md2po2md-windows-latest md2po2md.exe mv mdpo2html-windows-latest mdpo2html.exe - 7z a -tzip ../../dist/mdpo-windows-x64.zip \ + 7z a -tzip ../../dist/mdpo-windows-x86_64.zip \ md2po.exe po2md.exe md2po2md.exe mdpo2html.exe - name: Remove build directories run: rm -rf build @@ -246,7 +257,6 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ skip-existing: true release: @@ -269,22 +279,18 @@ jobs: TAG_BODY="${TAG_BODY//$'\n'/'%0A'}" TAG_BODY="${TAG_BODY//$'\r'/'%0D'}" echo "body=$TAG_BODY" >> $GITHUB_OUTPUT + - uses: actions/download-artifact@v4 + name: Download builds + with: + name: dist + path: ./dist - name: Create Release uses: softprops/action-gh-release@v2 - id: create-release with: name: ${{ steps.tag.outputs.title }} tag_name: ${{ steps.tag.outputs.title }} body: ${{ steps.tag.outputs.body }} draft: false prerelease: false - - uses: actions/download-artifact@v4 - name: Download builds - with: - name: dist - path: ./dist - - uses: shogo82148/actions-upload-release-asset@v1 - name: Upload release assets - with: - upload_url: ${{ steps.create-release.outputs.upload_url }} - asset_path: dist/* + files: | + dist/*