name: Build IfcOpenShell WASM / Pyodide on: workflow_dispatch: jobs: build_ifcopenshell: runs-on: ubuntu-22.04 steps: - name: Checkout Repository uses: actions/checkout@v6 with: submodules: recursive path: IfcOpenShell - name: Checkout Build Repository uses: actions/checkout@v6 with: repository: IfcOpenShell/build-outputs path: ifcopenshell_build ref: wasm lfs: true token: ${{ secrets.BUILD_REPO_TOKEN }} - name: Unpack Dependencies run: | cd ifcopenshell_build python ../IfcOpenShell/nix/cache_dependencies.py unpack - name: ccache uses: hendrikmuhs/ccache-action@v1.2.23 with: key: ubuntu-22.04-${{ runner.arch }} - name: Build run: | ./IfcOpenShell/pyodide/build_pyodide.sh FILE=`echo dist/ifcopenshell-*.whl` NEW_FILE=`echo $FILE | sed "s/-/+${GITHUB_SHA:0:7}-/2"` mv $FILE $NEW_FILE - name: Upload Build Logs if: always() uses: actions/upload-artifact@v7 with: name: build-logs-pyodide path: | ifcopenshell_build/*/*/logs/*.log retention-days: 30 - name: Run wheel tests run: | cp -r IfcOpenShell/pyodide/test test # venv set up in build_pyodide.sh. source .venv/bin/activate uv pip install pytest-pyodide PYODIDE_ROOT_DIST=`pyodide config get pyodide_root`/dist # `pytest-pyodide` requires pyodide in 'pyodide' directory in cwd, when running `pytest`. cp -r $PYODIDE_ROOT_DIST test/pyodide cp dist/ifcopenshell-*.whl test/pyodide cd test pytest --capture=no - name: Pack Dependencies run: | cd ifcopenshell_build python ../IfcOpenShell/nix/cache_dependencies.py pack - name: Commit and Push Changes to Build Repository run: | cd ifcopenshell_build git config user.name "IfcOpenBot" git config user.email "ifcopenbot@ifcopenshell.org" git add */*/install/cache-*.tar.gz git commit -m "Update build artifacts [skip ci]" || echo "No changes to commit" git push || echo "Push failed" - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v6 with: aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: Upload .zip archives to S3 run: | aws s3 cp dist s3://ifcopenshell-builds/ --recursive --exclude "*" --include "*.whl"