diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 1f1f1350..0edb2ae7 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -1,5 +1,8 @@ name: soar nightly - +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + on: push: tags: @@ -7,7 +10,9 @@ on: workflow_dispatch: permissions: + attestations: write contents: write + id-token: write jobs: @@ -29,18 +34,22 @@ jobs: fail-fast: false matrix: build: - - { - NAME: x86_64-linux, - TARGET: x86_64-unknown-linux-musl, - } - { NAME: aarch64-linux, TARGET: aarch64-unknown-linux-musl, } + - { + NAME: loongarch64-linux, + TARGET: loongarch64-unknown-linux-musl + } - { NAME: riscv64-linux, TARGET: riscv64gc-unknown-linux-musl } + - { + NAME: x86_64-linux, + TARGET: x86_64-unknown-linux-musl, + } steps: - name: Checkout uses: actions/checkout@v4 @@ -54,40 +63,45 @@ jobs: - name: Install dependencies shell: bash run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - --allow-unauthenticated musl-tools b3sum + sudo apt update -y + sudo apt install b3sum findutils file -y - name: Install Rust toolchain uses: dtolnay/rust-toolchain@nightly with: targets: ${{ matrix.build.TARGET }} - - name: Install cross-compilation tools - uses: taiki-e/setup-cross-toolchain-action@v1 - with: - target: ${{ matrix.build.TARGET }} + - name: Install Cross + shell: bash + run: | + cargo install cross --git "https://github.com/cross-rs/cross" --jobs="$(($(nproc)+1))" + hash -r &>/dev/null + command -v cross &>/dev/null || { echo "cross command not found" >&2; exit 1; } - name: Build - run: SOAR_NIGHTLY=1 RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --locked --target ${{ matrix.build.TARGET }} + env: + RUSTFLAGS: "-C target-feature=+crt-static \ + -C link-self-contained=yes \ + -C link-arg=-Wl,--build-id=none" + SOAR_NIGHTLY: "1" + run: cross +nightly build --release --locked --target "${{ matrix.build.TARGET }}" --jobs="$(($(nproc)+1))" --verbose - name: Prepare release assets + env: + ARTIFACT: "release/soar-${{ matrix.build.NAME }}" + ARCHIVE: "soar-${{ matrix.build.NAME }}.tar.gz" shell: bash run: | mkdir -p release - cp {LICENSE,README.md,CHANGELOG.md} release/ - cp "target/${{ matrix.build.TARGET }}/release/soar" release/ - - - name: Create release artifacts - shell: bash - run: | - cp release/soar soar-${{ matrix.build.NAME }} - b3sum soar-${{ matrix.build.NAME }} \ - > soar-${{ matrix.build.NAME }}.b3sum - tar -czvf soar-${{ matrix.build.NAME }}.tar.gz \ - release/ - b3sum soar-${{ matrix.build.NAME }}.tar.gz \ - > soar-${{ matrix.build.NAME }}.tar.gz.b3sum + cp {LICENSE,README.md} release/ + cp "target/${{ matrix.build.TARGET }}/release/soar" "${ARTIFACT}" + b3sum "${ARTIFACT}" > "${ARTIFACT}.b3sum" + cp "${ARTIFACT}" . + cp "${ARTIFACT}.b3sum" . + tar -czvf "${ARCHIVE}" release/ + b3sum "${ARCHIVE}" > "${ARCHIVE}.b3sum" + bash -c 'realpath "${ARTIFACT}" ; realpath "${ARCHIVE}"' | xargs -I "{}" bash -c \ + 'printf "\nFile: $(basename {})\n Type: $(file -b {})\n B3sum: $(b3sum {} | cut -d" " -f1)\n SHA256sum: $(sha256sum {} | cut -d" " -f1)\n Size: $(du -bh {} | cut -f1)\n"' - name: Publish to GitHub (nightly) uses: svenstaro/upload-release-action@v2 @@ -99,3 +113,11 @@ jobs: tag: nightly release_name: "${{ steps.version.outputs.version }}" prerelease: true + + - name: Attest Build Provenance + uses: actions/attest-build-provenance@v2.4.0 + with: + subject-name: "soar-nightly-${{ matrix.build.NAME }}" + subject-path: | + soar-${{ matrix.build.NAME }}* + show-summary: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0a550de8..608b7cad 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,12 +1,18 @@ name: soar release - +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + on: release: types: [published] - + workflow_dispatch: + permissions: + attestations: write contents: write - + id-token: write + jobs: publish-binaries: name: Publish binaries @@ -15,18 +21,22 @@ jobs: fail-fast: false matrix: build: - - { - NAME: x86_64-linux, - TARGET: x86_64-unknown-linux-musl, - } - { NAME: aarch64-linux, TARGET: aarch64-unknown-linux-musl, } + - { + NAME: loongarch64-linux, + TARGET: loongarch64-unknown-linux-musl + } - { NAME: riscv64-linux, TARGET: riscv64gc-unknown-linux-musl } + - { + NAME: x86_64-linux, + TARGET: x86_64-unknown-linux-musl, + } steps: - name: Checkout uses: actions/checkout@v4 @@ -38,40 +48,44 @@ jobs: - name: Install dependencies shell: bash run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - --allow-unauthenticated musl-tools b3sum + sudo apt update -y + sudo apt install b3sum findutils file -y - name: Install Rust toolchain uses: dtolnay/rust-toolchain@nightly with: targets: ${{ matrix.build.TARGET }} - - name: Install cross-compilation tools - uses: taiki-e/setup-cross-toolchain-action@v1 - with: - target: ${{ matrix.build.TARGET }} + - name: Install Cross + shell: bash + run: | + cargo install cross --git "https://github.com/cross-rs/cross" --jobs="$(($(nproc)+1))" + hash -r &>/dev/null + command -v cross &>/dev/null || { echo "cross command not found" >&2; exit 1; } - name: Build - run: RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --locked --target ${{ matrix.build.TARGET }} + env: + RUSTFLAGS: "-C target-feature=+crt-static \ + -C link-self-contained=yes \ + -C link-arg=-Wl,--build-id=none" + run: cross +nightly build --release --locked --target "${{ matrix.build.TARGET }}" --jobs="$(($(nproc)+1))" --verbose - name: Prepare release assets + env: + ARTIFACT: "release/soar-${{ matrix.build.NAME }}" + ARCHIVE: "soar-${{ matrix.build.NAME }}.tar.gz" shell: bash run: | mkdir -p release - cp {LICENSE,README.md,CHANGELOG.md} release/ - cp "target/${{ matrix.build.TARGET }}/release/soar" release/ - - - name: Create release artifacts - shell: bash - run: | - cp release/soar soar-${{ matrix.build.NAME }} - b3sum soar-${{ matrix.build.NAME }} \ - > soar-${{ matrix.build.NAME }}.b3sum - tar -czvf soar-${{ matrix.build.NAME }}.tar.gz \ - release/ - b3sum soar-${{ matrix.build.NAME }}.tar.gz \ - > soar-${{ matrix.build.NAME }}.tar.gz.b3sum + cp {LICENSE,README.md} release/ + cp "target/${{ matrix.build.TARGET }}/release/soar" "${ARTIFACT}" + b3sum "${ARTIFACT}" > "${ARTIFACT}.b3sum" + cp "${ARTIFACT}" . + cp "${ARTIFACT}.b3sum" . + tar -czvf "${ARCHIVE}" release/ + b3sum "${ARCHIVE}" > "${ARCHIVE}.b3sum" + bash -c 'realpath "${ARTIFACT}" ; realpath "${ARCHIVE}"' | xargs -I "{}" bash -c \ + 'printf "\nFile: $(basename {})\n Type: $(file -b {})\n B3sum: $(b3sum {} | cut -d" " -f1)\n SHA256sum: $(sha256sum {} | cut -d" " -f1)\n Size: $(du -bh {} | cut -f1)\n"' - name: Publish to GitHub if: ${{ !contains(github.ref, '-') }} @@ -96,3 +110,11 @@ jobs: tag: ${{ github.ref }} release_name: "Pre-release v${{ env.RELEASE_VERSION }}" prerelease: true + + - name: Attest Build Provenance + uses: actions/attest-build-provenance@v2.4.0 + with: + subject-name: "soar-v${{ env.RELEASE_VERSION }}-${{ matrix.build.NAME }}" + subject-path: | + soar-${{ matrix.build.NAME }}* + show-summary: true diff --git a/Cargo.toml b/Cargo.toml index 60577106..763675a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ categories = ["command-line-utilities"] [profile.release] strip = true -opt-level = "z" +opt-level = 3 lto = true codegen-units = 1 panic = "abort" diff --git a/README.md b/README.md index e457a56e..f4daabc1 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@
@@ -99,21 +99,17 @@ wget -qO- "https://raw.githubusercontent.com/pkgforge/soar/main/install.sh" | sh > - You can [self host](https://soar.qaidvoid.dev/configuration#custom-repository-support) your own repos if you need soar to run on other [supported hosts](https://docs.pkgforge.dev/sbuild/specification/20.x_exec#host). > - Or you can also [sponsor us](https://github.com/pkgforge/soar#-sponsors) with Build Servers for CICD & Testing. -### đ Tier 1 Hosts -_â --> Enabled by Default_ -| đ¤ Host | đĻ Repos | âšī¸ Comment | -|------|----------|---------| -| **`aarch64-Linux`** | [**bincache**â ](https://docs.pkgforge.dev/repositories/bincache), [**pkgcache**â ](https://docs.pkgforge.dev/repositories/pkgcache), [**pkgforge-cargo**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [**pkgforge-go**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-go), [cargo-bins](https://docs.pkgforge.dev/repositories/external/cargo-bins), [appimage-github-io](https://docs.pkgforge.dev/repositories/external/appimage-github-io), [appimagehub](https://docs.pkgforge.dev/repositories/external/appimagehub) | Almost as many packages as `x86_64-Linux`, fully supported | -| **`x86_64-Linux`** | [**bincache**â ](https://docs.pkgforge.dev/repositories/bincache), [**pkgcache**â ](https://docs.pkgforge.dev/repositories/pkgcache), [**pkgforge-cargo**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [**pkgforge-go**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-go), [cargo-bins](https://docs.pkgforge.dev/repositories/external/cargo-bins), [ivan-hc-am](https://docs.pkgforge.dev/repositories/external/ivan-hc-am), [appimage-github-io](https://docs.pkgforge.dev/repositories/external/appimage-github-io), [appimagehub](https://docs.pkgforge.dev/repositories/external/appimagehub) | Primary target & most supported | +### đ Default Hosts -### đĨ Tier 2 Hosts - -| đ¤ Host | đĻ Repos | âšī¸ Comment | -|------|----------|---------| -| **`loongarch64-Linux`** | [**pkgforge-cargo**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [**pkgforge-go**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-go) | Experimental & Least supported | -| **`riscv64-Linux`** | [**bincache**â ](https://docs.pkgforge.dev/repositories/bincache), [**pkgforge-cargo**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [**pkgforge-go**â ](https://docs.pkgforge.dev/repositories/external/pkgforge-go) | Experimental, with [gradual progress](https://github.com/pkgforge/soarpkgs/issues/198) | +> **Note:** _â --> Enabled by Default_ +| đ Tier | đ¤ Host | đĻ Repos | âšī¸ Status | +|---------|---------|---------------------------|-------------------| +| **Tier 1** | **`aarch64-Linux`** | [bincacheâ ](https://docs.pkgforge.dev/repositories/bincache), [pkgcacheâ ](https://docs.pkgforge.dev/repositories/pkgcache), [pkgforge-cargoâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [pkgforge-goâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-go), [cargo-bins](https://docs.pkgforge.dev/repositories/external/cargo-bins), [appimage-github-io](https://docs.pkgforge.dev/repositories/external/appimage-github-io), [appimagehub](https://docs.pkgforge.dev/repositories/external/appimagehub) | Almost as many packages as `x86_64-Linux`, fully supported | +| **Tier 1** | **`x86_64-Linux`** | [bincacheâ ](https://docs.pkgforge.dev/repositories/bincache), [pkgcacheâ ](https://docs.pkgforge.dev/repositories/pkgcache), [pkgforge-cargoâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [pkgforge-goâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-go), [cargo-bins](https://docs.pkgforge.dev/repositories/external/cargo-bins), [ivan-hc-am](https://docs.pkgforge.dev/repositories/external/ivan-hc-am), [appimage-github-io](https://docs.pkgforge.dev/repositories/external/appimage-github-io), [appimagehub](https://docs.pkgforge.dev/repositories/external/appimagehub) | Primary target & most supported | +| **Tier 2** | **`loongarch64-Linux`** | [pkgforge-cargoâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [pkgforge-goâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-go) | Experimental & least supported | +| **Tier 2** | **`riscv64-Linux`** | [bincacheâ ](https://docs.pkgforge.dev/repositories/bincache), [pkgcacheâ ](https://docs.pkgforge.dev/repositories/pkgcache), [pkgforge-cargoâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-cargo), [pkgforge-goâ ](https://docs.pkgforge.dev/repositories/external/pkgforge-go) | Experimental, with [gradual progress](https://github.com/pkgforge/soarpkgs/issues/198) | ## âĸī¸ Caveats diff --git a/install.sh b/install.sh index 3d309924..bb4d73e2 100755 --- a/install.sh +++ b/install.sh @@ -209,29 +209,48 @@ main() { # Detect architecture ARCH=$(uname -m) case "$ARCH" in - x86_64) - ARCH="x86_64" - ;; aarch64) ARCH="aarch64" ;; + loongarch64) + ARCH="loongarch64" + ;; + riscv64) + ARCH="riscv64" + ;; + x86_64) + ARCH="x86_64" + ;; *) printf "${RED}Error: Unsupported architecture: ${YELLOW}$ARCH${RESET}\n" >&2 exit 1 ;; esac + # Detect OS + OS=$(uname -s) + case "$OS" in + Linux) + OS="linux" + ;; + *) + printf "${RED}Error: Unsupported operating system: ${YELLOW}$OS${RESET}\n" >&2 + printf "${RED}Only Linux is currently supported${RESET}\n" >&2 + exit 1 + ;; + esac + # Get latest release URL printf "Downloading Soar..." case "$SOAR_VERSION" in *nightly*) - RELEASE_URL="https://github.com/pkgforge/soar/releases/download/nightly/soar-$ARCH-linux" + RELEASE_URL="https://github.com/pkgforge/soar/releases/download/nightly/soar-$ARCH-$OS" ;; *latest*) - RELEASE_URL="https://github.com/pkgforge/soar/releases/latest/download/soar-$ARCH-linux" + RELEASE_URL="https://github.com/pkgforge/soar/releases/latest/download/soar-$ARCH-$OS" ;; *) - RELEASE_URL="https://github.com/pkgforge/soar/releases/download/v$SOAR_VERSION/soar-$ARCH-linux" + RELEASE_URL="https://github.com/pkgforge/soar/releases/download/v$SOAR_VERSION/soar-$ARCH-$OS" ;; esac printf " <== $RELEASE_URL\n"