update build yml file #50
This file contains 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: BuildCExtension | |
on: | |
push: | |
branches: [ master, develop ] | |
jobs: | |
build: | |
name: Build release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
python-version: ['3.10', '3.11', '3.12'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Install requirements and build extension | |
run: | | |
poetry install --with dev | |
python -c "import shutil, glob, os; [shutil.copy(f, '.') for f in glob.glob('mapanalyzerext*') if not os.path.exists(os.path.join('.', os.path.basename(f)))]" | |
- name: Upload the artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# name: ${{ matrix.os }}_python${{ matrix.python-version }} | |
path: ./mapanalyzerext* | |
commit: | |
name: Commit all binaries | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./artifacts/ | |
- name: List downloaded files (debugging) | |
run: ls -R ./artifacts/ | |
- name: Move binaries to correct directory | |
run: | | |
mkdir -p ./map_analyzer/cext/ | |
mv ./artifacts/* ./map_analyzer/cext/ | |
- name: List moved files (debugging) | |
run: ls -R ./map_analyzer/cext/ | |
- name: Configure Git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
- name: Commit all binaries | |
run: | | |
git add ./map_analyzer/cext/* | |
git status | |
git commit -m "Add all binaries for multiple platforms and Python versions" || echo "No changes to commit" | |
git push origin ${{ github.ref }} |