Release #8
This file contains hidden or 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: Release | |
| on: | |
| schedule: | |
| # 9 AM UTC on every Monday | |
| - cron: "0 9 * * Mon" | |
| workflow_dispatch: | |
| inputs: | |
| pre-release: | |
| type: boolean | |
| description: Mark "Pre-Release" | |
| required: false | |
| default: true | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_ARGS: --no-default-features --features stdlib,importlib,encodings,sqlite,ssl | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.platform.runner }} | |
| # Disable this scheduled job when running on a fork. | |
| if: ${{ github.repository == 'RustPython/RustPython' || github.event_name != 'schedule' }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| # - runner: ubuntu-latest | |
| # target: i686-unknown-linux-gnu | |
| # - runner: ubuntu-latest | |
| # target: aarch64-unknown-linux-gnu | |
| # - runner: ubuntu-latest | |
| # target: armv7-unknown-linux-gnueabi | |
| # - runner: ubuntu-latest | |
| # target: s390x-unknown-linux-gnu | |
| # - runner: ubuntu-latest | |
| # target: powerpc64le-unknown-linux-gnu | |
| - runner: macos-latest | |
| target: aarch64-apple-darwin | |
| # - runner: macos-latest | |
| # target: x86_64-apple-darwin | |
| - runner: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| # - runner: windows-latest | |
| # target: i686-pc-windows-msvc | |
| # - runner: windows-latest | |
| # target: aarch64-pc-windows-msvc | |
| fail-fast: false | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: cargo-bins/cargo-binstall@main | |
| - name: Set up Environment | |
| shell: bash | |
| run: rustup target add ${{ matrix.platform.target }} | |
| - name: Set up Windows Environment | |
| shell: bash | |
| run: | | |
| git config --global core.longpaths true | |
| cargo install --target-dir=target -v cargo-vcpkg | |
| cargo vcpkg -v build | |
| if: runner.os == 'Windows' | |
| - name: Set up MacOS Environment | |
| run: brew install autoconf automake libtool | |
| if: runner.os == 'macOS' | |
| - name: Build RustPython | |
| run: cargo build --release --target=${{ matrix.platform.target }} --verbose --features=threading ${{ env.CARGO_ARGS }} | |
| if: runner.os == 'macOS' | |
| - name: Build RustPython | |
| run: cargo build --release --target=${{ matrix.platform.target }} --verbose --features=threading ${{ env.CARGO_ARGS }},jit | |
| if: runner.os != 'macOS' | |
| - name: Rename Binary | |
| run: cp target/${{ matrix.platform.target }}/release/rustpython target/rustpython-release-${{ runner.os }}-${{ matrix.platform.target }} | |
| if: runner.os != 'Windows' | |
| - name: Rename Binary | |
| run: cp target/${{ matrix.platform.target }}/release/rustpython.exe target/rustpython-release-${{ runner.os }}-${{ matrix.platform.target }}.exe | |
| if: runner.os == 'Windows' | |
| - name: Upload Binary Artifacts | |
| uses: actions/[email protected] | |
| with: | |
| name: rustpython-release-${{ runner.os }}-${{ matrix.platform.target }} | |
| path: target/rustpython-release-${{ runner.os }}-${{ matrix.platform.target }}* | |
| build-wasm: | |
| runs-on: ubuntu-latest | |
| # Disable this scheduled job when running on a fork. | |
| if: ${{ github.repository == 'RustPython/RustPython' || github.event_name != 'schedule' }} | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-wasip1 | |
| - name: Build RustPython | |
| run: cargo build --target wasm32-wasip1 --no-default-features --features freeze-stdlib,stdlib --release | |
| - name: Rename Binary | |
| run: cp target/wasm32-wasip1/release/rustpython.wasm target/rustpython-release-wasm32-wasip1.wasm | |
| - name: Upload Binary Artifacts | |
| uses: actions/[email protected] | |
| with: | |
| name: rustpython-release-wasm32-wasip1 | |
| path: target/rustpython-release-wasm32-wasip1.wasm | |
| - name: install wasm-pack | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| - uses: actions/setup-node@v6 | |
| - uses: mwilliamson/setup-wabt-action@v3 | |
| with: { wabt-version: "1.0.30" } | |
| - name: build demo | |
| run: | | |
| npm install | |
| npm run dist | |
| env: | |
| NODE_OPTIONS: "--openssl-legacy-provider" | |
| working-directory: ./wasm/demo | |
| - name: build notebook demo | |
| run: | | |
| npm install | |
| npm run dist | |
| mv dist ../demo/dist/notebook | |
| env: | |
| NODE_OPTIONS: "--openssl-legacy-provider" | |
| working-directory: ./wasm/notebook | |
| - name: Deploy demo to Github Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| deploy_key: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} | |
| publish_dir: ./wasm/demo/dist | |
| external_repository: RustPython/demo | |
| publish_branch: master | |
| release: | |
| runs-on: ubuntu-latest | |
| # Disable this scheduled job when running on a fork. | |
| if: ${{ github.repository == 'RustPython/RustPython' || github.event_name != 'schedule' }} | |
| needs: [build, build-wasm] | |
| steps: | |
| - uses: actions/[email protected] | |
| - name: Download Binary Artifacts | |
| uses: actions/[email protected] | |
| with: | |
| path: bin | |
| pattern: rustpython-* | |
| merge-multiple: true | |
| - name: Create Lib Archive | |
| run: | | |
| zip -r bin/rustpython-lib.zip Lib/ | |
| - name: List Binaries | |
| run: | | |
| ls -lah bin/ | |
| file bin/* | |
| - name: Create Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref_name }} | |
| run: ${{ github.run_number }} | |
| run: | | |
| if [[ "${{ github.event.inputs.pre-release }}" == "false" ]]; then | |
| RELEASE_TYPE_NAME=Release | |
| PRERELEASE_ARG= | |
| else | |
| RELEASE_TYPE_NAME=Pre-Release | |
| PRERELEASE_ARG=--prerelease | |
| fi | |
| today=$(date '+%Y-%m-%d') | |
| gh release create "$today-$tag-$run" \ | |
| --repo="$GITHUB_REPOSITORY" \ | |
| --title="RustPython $RELEASE_TYPE_NAME $today-$tag #$run" \ | |
| --target="$tag" \ | |
| --notes "⚠️ **Important**: To run RustPython, you must download both the binary for your platform AND the \`rustpython-lib.zip\` archive. Extract the Lib directory from the archive to the same location as the binary, or set the \`RUSTPYTHONPATH\` environment variable to point to the Lib directory." \ | |
| --generate-notes \ | |
| $PRERELEASE_ARG \ | |
| bin/rustpython-release-* |