Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better CI configuration #314

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 38 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -112,16 +112,18 @@ 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:
runs-on:
- ubuntu-latest
# ARM
- macos-14
# X86
# X86_64
- macos-13
- windows-latest
steps:
Expand All @@ -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 }}
Expand All @@ -162,6 +172,7 @@ jobs:
name: Build final distribution
runs-on: ubuntu-latest
needs:
- lint
- build-wheel-sdist
- build-standalone-dist
steps:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -246,7 +257,6 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
skip-existing: true

release:
Expand All @@ -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/*
Loading