From 35f3eb2a9a66cc645f7be5389dc7e9ca13bbc04d Mon Sep 17 00:00:00 2001 From: Nick Carton Date: Sat, 30 Nov 2024 18:26:23 +0100 Subject: [PATCH] Move build-setup --- .github/{workflows => }/build-setup.yml | 0 .github/workflows/rust-build.yml.bak | 123 ------------------- .github/workflows/rust-publish.yml.bak | 151 ------------------------ dist-workspace.toml | 2 +- 4 files changed, 1 insertion(+), 275 deletions(-) rename .github/{workflows => }/build-setup.yml (100%) delete mode 100644 .github/workflows/rust-build.yml.bak delete mode 100644 .github/workflows/rust-publish.yml.bak diff --git a/.github/workflows/build-setup.yml b/.github/build-setup.yml similarity index 100% rename from .github/workflows/build-setup.yml rename to .github/build-setup.yml diff --git a/.github/workflows/rust-build.yml.bak b/.github/workflows/rust-build.yml.bak deleted file mode 100644 index 499dc53..0000000 --- a/.github/workflows/rust-build.yml.bak +++ /dev/null @@ -1,123 +0,0 @@ -name: Build - -on: - push: - branches: - - "*" - -env: - RUSTC_WRAPPER: sccache - SCCACHE_GHA_ENABLED: true - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: /home/runner/.cache/sccache - -jobs: - build: - name: Build for ${{ matrix.target }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - # Tier 1 Platforms - - target: x86_64-unknown-linux-gnu - os: ubuntu-latest - artifact_name: bping - - target: x86_64-pc-windows-msvc - os: windows-latest - artifact_name: bping.exe - - target: x86_64-apple-darwin - os: macos-latest - artifact_name: bping - - target: i686-pc-windows-msvc - os: windows-latest - artifact_name: bping.exe - - target: i686-unknown-linux-gnu - os: ubuntu-latest - artifact_name: bping - gcc_package: gcc-multilib - - # Tier 2 Platforms - - target: aarch64-unknown-linux-gnu - os: ubuntu-latest - artifact_name: bping - gcc_package: gcc-aarch64-linux-gnu - linker: aarch64-linux-gnu-gcc - - target: aarch64-apple-darwin - os: macos-latest - artifact_name: bping - - target: arm-unknown-linux-gnueabi - os: ubuntu-latest - artifact_name: bping - gcc_package: gcc-arm-linux-gnueabi - linker: arm-linux-gnueabi-gcc - - target: armv7-unknown-linux-gnueabihf - os: ubuntu-latest - artifact_name: bping - gcc_package: gcc-arm-linux-gnueabihf - linker: arm-linux-gnueabihf-gcc - - target: x86_64-unknown-linux-musl - os: ubuntu-latest - artifact_name: bping - gcc_package: musl-tools - - steps: - - uses: actions/checkout@v4 - - - name: Install build dependencies - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y curl build-essential pkg-config libssl-dev - if [ ! -z "${{ matrix.gcc_package }}" ]; then - sudo apt-get install -y ${{ matrix.gcc_package }} - fi - - - name: Configure Cargo for cross-compilation - if: matrix.linker != '' - run: | - mkdir -p ~/.cargo - echo "[target.${{ matrix.target }}]" >> ~/.cargo/config.toml - echo "linker = \"${{ matrix.linker }}\"" >> ~/.cargo/config.toml - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - target: ${{ matrix.target }} - override: true - - - name: Configure sccache - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.6 - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: "v1-rust" - shared-key: "${{ matrix.target }}-build" - cache-targets: "true" - cache-on-failure: "true" - cache-all-crates: "true" - save-if: ${{ github.ref == 'refs/heads/master' }} - workspaces: | - . -> target - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --target ${{ matrix.target }} - - - name: Show sccache stats - run: sccache --show-stats - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.target }}-binary - path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }} diff --git a/.github/workflows/rust-publish.yml.bak b/.github/workflows/rust-publish.yml.bak deleted file mode 100644 index d749440..0000000 --- a/.github/workflows/rust-publish.yml.bak +++ /dev/null @@ -1,151 +0,0 @@ -name: Publish - -on: - push: - tags: - - "*" - -env: - RUSTC_WRAPPER: sccache - SCCACHE_GHA_ENABLED: true - SCCACHE_CACHE_SIZE: 2G - SCCACHE_DIR: /home/runner/.cache/sccache - -jobs: - publish: - name: Publish for ${{ matrix.target }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - # Tier 1 Platforms - - target: x86_64-unknown-linux-gnu - os: ubuntu-latest - asset_name: bping-x86_64-linux-gnu - - target: x86_64-pc-windows-msvc - os: windows-latest - asset_name: bping-x86_64-windows-msvc.exe - - target: x86_64-apple-darwin - os: macos-latest - asset_name: bping-x86_64-darwin - - target: i686-pc-windows-msvc - os: windows-latest - asset_name: bping-i686-windows-msvc.exe - - target: i686-unknown-linux-gnu - os: ubuntu-latest - asset_name: bping-i686-linux-gnu - gcc_package: gcc-multilib - - # Tier 2 Platforms - - target: aarch64-unknown-linux-gnu - os: ubuntu-latest - asset_name: bping-aarch64-linux-gnu - gcc_package: gcc-aarch64-linux-gnu - linker: aarch64-linux-gnu-gcc - - target: aarch64-apple-darwin - os: macos-latest - asset_name: bping-aarch64-darwin - - target: arm-unknown-linux-gnueabi - os: ubuntu-latest - asset_name: bping-arm-linux-gnueabi - gcc_package: gcc-arm-linux-gnueabi - linker: arm-linux-gnueabi-gcc - - target: armv7-unknown-linux-gnueabihf - os: ubuntu-latest - asset_name: bping-armv7-linux-gnueabihf - gcc_package: gcc-arm-linux-gnueabihf - linker: arm-linux-gnueabihf-gcc - - target: x86_64-unknown-linux-musl - os: ubuntu-latest - asset_name: bping-x86_64-linux-musl - gcc_package: musl-tools - - steps: - - uses: actions/checkout@v4 - - - name: Install build dependencies - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y curl build-essential pkg-config libssl-dev - if [ ! -z "${{ matrix.gcc_package }}" ]; then - sudo apt-get install -y ${{ matrix.gcc_package }} - fi - - - name: Configure Cargo for cross-compilation - if: matrix.linker != '' - run: | - mkdir -p ~/.cargo - echo "[target.${{ matrix.target }}]" >> ~/.cargo/config.toml - echo "linker = \"${{ matrix.linker }}\"" >> ~/.cargo/config.toml - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - target: ${{ matrix.target }} - override: true - - - name: Configure sccache - run: | - echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV - echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.6 - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: "v1-rust" - shared-key: "${{ matrix.target }}-release" - cache-targets: "true" - cache-on-failure: "true" - cache-all-crates: "true" - save-if: true # Always save cache for tagged releases - workspaces: | - . -> target - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --target ${{ matrix.target }} - - - name: Show sccache stats - run: sccache --show-stats - - - name: Strip binary - if: runner.os != 'Windows' - run: | - if [ "${{ matrix.target }}" != "aarch64-apple-darwin" ]; then - case "${{ matrix.target }}" in - "aarch64-unknown-linux-gnu") - aarch64-linux-gnu-strip target/${{ matrix.target }}/release/bping - ;; - "arm-unknown-linux-gnueabi") - arm-linux-gnueabi-strip target/${{ matrix.target }}/release/bping - ;; - "armv7-unknown-linux-gnueabihf") - arm-linux-gnueabihf-strip target/${{ matrix.target }}/release/bping - ;; - *) - strip target/${{ matrix.target }}/release/bping - ;; - esac - fi - - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v1-release - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/${{ matrix.target }}/release/bping${{ runner.os == 'Windows' && '.exe' || '' }} - asset_name: ${{ matrix.asset_name }} - tag: ${{ github.ref }} - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.target }}-release-binary - path: target/${{ matrix.target }}/release/bping${{ runner.os == 'Windows' && '.exe' || '' }} diff --git a/dist-workspace.toml b/dist-workspace.toml index 58743a6..e085023 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -25,4 +25,4 @@ install-path = "CARGO_HOME" publish-jobs = ["homebrew"] # Whether to install an updater program install-updater = true -github-build-setup = "build-setup.yml" +github-build-setup = "../build-setup.yml"