Deploy #14
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: Deploy | |
| on: | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| # - i686-unknown-linux-gnu | |
| # - x86_64-apple-darwin | |
| # - aarch64-apple-darwin | |
| - x86_64-pc-windows-msvc | |
| - x86_64-pc-windows-gnu | |
| # - i686-pc-windows-msvc | |
| - aarch64-unknown-linux-gnu | |
| # - arm-unknown-linux-gnueabihf | |
| include: | |
| # ubuntu-24.04 (x86_64) | |
| - target: x86_64-unknown-linux-gnu | |
| image: ubuntu-24.04 | |
| - target: i686-unknown-linux-gnu | |
| image: ubuntu-24.04 | |
| setup: > | |
| sudo dpkg --add-architecture i386 && | |
| sudo apt update && | |
| sudo apt install libssl-dev:i386 gcc-multilib && | |
| echo 'OPENSSL_INCLUDE_DIR=/usr/include' >> $GITHUB_ENV && | |
| echo 'OPENSSL_LIB_DIR=/usr/lib/i386-linux-gnu' >> $GITHUB_ENV | |
| # macos-13 (x86_64) | |
| - target: x86_64-apple-darwin | |
| image: macos-13 | |
| # macos-15 (aarch64) | |
| - target: aarch64-apple-darwin | |
| image: macos-15 | |
| # windows-2022 (x86_64) | |
| - target: x86_64-pc-windows-msvc | |
| image: windows-2022 | |
| - target: x86_64-pc-windows-gnu | |
| image: windows-2022 | |
| - target: i686-pc-windows-msvc | |
| image: windows-2022 | |
| # ubuntu-24.04-arm (aarch64) | |
| - target: aarch64-unknown-linux-gnu | |
| image: ubuntu-24.04-arm | |
| - target: arm-unknown-linux-gnueabihf | |
| image: ubuntu-24.04-arm | |
| skip_test: true | |
| setup: > | |
| sudo dpkg --add-architecture armhf && | |
| sudo apt update && | |
| sudo apt install libssl-dev:armhf gcc-arm-linux-gnueabihf && | |
| echo 'OPENSSL_INCLUDE_DIR=/usr/include' >> $GITHUB_ENV && | |
| echo 'OPENSSL_LIB_DIR=/usr/lib/arm-linux-gnueabihf' >> $GITHUB_ENV && | |
| echo 'CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc' >> $GITHUB_ENV | |
| runs-on: ${{ matrix.image }} | |
| name: Build ${{ matrix.target }} on ${{ matrix.image }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup | |
| if: matrix.setup != null | |
| run: ${{ matrix.setup }} | |
| - name: Setup rust | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Test (debug) | |
| if: matrix.skip_test == null | |
| run: cargo test --target ${{ matrix.target }} --workspace --exclude portablemc-py -- --include-ignored | |
| - name: Build (release) | |
| run: cargo build --target ${{ matrix.target }} --release --workspace --exclude portablemc-py | |
| - name: Debug path | |
| run: ls ./target/${{ matrix.target }}/release | |
| - name: Collect artifacts (linux) | |
| if: contains(matrix.target, 'linux') | |
| run: > | |
| mkdir -p ~/portablemc/dev && | |
| cp -r ./portablemc-ffi/include/ ~/portablemc/dev/ && | |
| cp ./target/${{ matrix.target }}/release/portablemc ~/portablemc/ && | |
| cp ./target/${{ matrix.target }}/release/libportablemc_ffi.a ~/portablemc/dev/libportablemc.a && | |
| cp ./target/${{ matrix.target }}/release/libportablemc_ffi.so ~/portablemc/dev/libportablemc.so | |
| - name: Collect artifacts (apple) | |
| if: contains(matrix.target, 'apple') | |
| run: > | |
| mkdir -p ~/portablemc/dev && | |
| cp -r ./portablemc-ffi/include/ ~/portablemc/ && | |
| cp ./target/${{ matrix.target }}/release/portablemc ~/portablemc/ && | |
| cp ./target/${{ matrix.target }}/release/libportablemc_ffi.a ~/portablemc/dev/libportablemc.a && | |
| cp ./target/${{ matrix.target }}/release/libportablemc_ffi.dylib ~/portablemc/dev/libportablemc.so | |
| - name: Collect artifacts (windows) | |
| if: contains(matrix.target, 'windows') | |
| run: > | |
| mkdir ~/portablemc ; | |
| mkdir ~/portablemc/dev ; | |
| cp ./portablemc-ffi/include/ ~/portablemc/ ; | |
| cp ./target/release/${{ matrix.target }}/portablemc.exe ~/portablemc/ ; | |
| cp ./target/release/${{ matrix.target }}/portablemc.pdb ~/portablemc/ ; | |
| cp ./target/release/${{ matrix.target }}/portablemc_ffi.lib ~/portablemc/dev/portablemc.lib ; | |
| cp ./target/release/${{ matrix.target }}/portablemc_ffi.dll ~/portablemc/dev/portablemc.dll ; | |
| cp ./target/release/${{ matrix.target }}/portablemc_ffi.dll.exp ~/portablemc/dev/portablemc.dll.exp ; | |
| cp ./target/release/${{ matrix.target }}/portablemc_ffi.dll.lib ~/portablemc/dev/portablemc.dll.lib ; | |
| cp ./target/release/${{ matrix.target }}/portablemc_ffi.pdb ~/portablemc/dev/portablemc.pdb ; | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-${{ matrix.target }} | |
| path: ~/portablemc/ | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| name: Publish | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Dry-run publish API | |
| run: cargo publish --no-verify --dry-run -p portablemc | |
| - name: Dry-run publish CLI | |
| run: cargo publish --no-verify --dry-run -p portablemc-cli |