ci: add GH_REPO to release process #115
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: Build | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| builder_image: meldron/psonoci_builder | |
| strategy: | |
| matrix: | |
| build: [ linux, linux-armv7, linux-aarch64, macos, win-gnu, win-msvc ] | |
| include: | |
| - build: linux | |
| os: ubuntu-24.04 | |
| target: x86_64-unknown-linux-musl | |
| target_type: unix | |
| use_cross: true | |
| - build: linux-armv7 | |
| os: ubuntu-24.04 | |
| target: armv7-unknown-linux-gnueabihf | |
| target_type: unix | |
| use_cross: true | |
| - build: linux-armv7-musl | |
| os: ubuntu-24.04 | |
| target: armv7-unknown-linux-musleabihf | |
| target_type: unix | |
| use_cross: true | |
| - build: linux-aarch64 | |
| os: ubuntu-24.04 | |
| target: aarch64-unknown-linux-musl | |
| target_type: unix | |
| use_cross: true | |
| - build: macos | |
| os: macos-latest | |
| target: x86_64-apple-darwin | |
| target_type: unix | |
| use_cross: false | |
| - build: macos-aarch64 | |
| os: macos-latest | |
| target: aarch64-apple-darwin | |
| target_type: unix | |
| use_cross: false | |
| - build: win-gnu | |
| os: ubuntu-24.04 | |
| target: x86_64-pc-windows-gnu | |
| target_type: windows | |
| use_cross: true | |
| - build: win-msvc | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| target_type: windows | |
| use_cross: false | |
| steps: | |
| - name: Get the version | |
| id: get_version | |
| shell: bash | |
| run: echo "SHA8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV | |
| - uses: actions/checkout@v5 | |
| # Keep this pinned to the repository toolchain in rust-toolchain.toml. | |
| - uses: dtolnay/rust-toolchain@1.94.1 | |
| with: | |
| targets: ${{ matrix.target }} | |
| components: rustfmt | |
| - name: Install cross | |
| if: matrix.use_cross | |
| uses: taiki-e/install-action@cross | |
| - name: Pull docker image used by cross | |
| if: matrix.use_cross && matrix.target_type == 'unix' | |
| run: docker pull $builder_image:${{ matrix.target }} | |
| # the base image for armv7-unknown-linux-gnueabihf is broken (ca certs invalid), use a prebuilt image for now | |
| # - name: Build docker image used by cross | |
| # if: matrix.os == 'ubuntu-24.04' && matrix.target_type == 'unix' | |
| # run: docker build build_files --cache-from $builder_image:${{ matrix.target }} --file build_files/Dockerfile-${{ matrix.target }} --tag $builder_image:${{ matrix.target }} | |
| - name: cargo fmt | |
| run: cargo fmt --all -- --check | |
| # - name: cargo test | |
| # run: | | |
| # if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| # cross test --release --target ${{ matrix.target }} | |
| # else | |
| # cargo test --release --target ${{ matrix.target }} | |
| # fi | |
| - name: cargo build | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| cargo build --release --target ${{ matrix.target }} | |
| fi | |
| - name: upload unix artifact | |
| uses: actions/upload-artifact@v6 | |
| if: matrix.target_type == 'unix' | |
| with: | |
| name: psonoci-${{ env.SHA8 }}-${{ matrix.target }} | |
| path: target/${{ matrix.target }}/release/psonoci | |
| - name: upload windows artifact | |
| uses: actions/upload-artifact@v6 | |
| if: matrix.target_type == 'windows' | |
| with: | |
| name: psonoci-${{ env.SHA8 }}-${{ matrix.target }} | |
| path: target/${{ matrix.target }}/release/psonoci.exe |