diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..b8f75950 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "daily" + time: "04:00" # UTC + labels: + - "dependencies" + commit-message: + prefix: "bump" + open-pull-requests-limit: 10 + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: + - "dependencies" + commit-message: + prefix: "chore(ci)" diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..a35a0703 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,70 @@ +name: Deploy Docs + +on: + push: + branches: + - main + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-D warnings" + RUSTDOCFLAGS: --html-in-header header.html + + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build-and-deploy: + if: github.repository == 'prefix-dev/rattler_installs_packages' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + + - name: Setup Pages + uses: actions/configure-pages@v3 + + # This does the following: + # - Replaces the docs icon with one that clearly denotes it's not the released package on crates.io + # - Adds a meta tag that forces Google not to index any page on the site. + - name: Pre-docs-build + run: | + echo "" > header.html + + - name: Build Documentation + run: cargo doc --workspace --no-deps --all-features --lib + + # This adds the following: + # - A top level redirect to the rattler_installs_packages crate documentation + # - A robots.txt file to forbid any crawling of the site (to defer to the docs.rs site on search engines). + # - A .nojekyll file to disable Jekyll GitHub Pages builds. + - name: Finalize documentation + run: | + echo "" > target/doc/index.html + echo "User-Agent: *\nDisallow: /" > target/doc/robots.txt + touch target/doc/.nojekyll + + # https://github.com/actions/upload-pages-artifact#file-permissions + - run: chmod -c -R +rX target/doc/ + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: 'target/doc' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/rust-compile.yml b/.github/workflows/rust-compile.yml new file mode 100644 index 00000000..5e46cdf8 --- /dev/null +++ b/.github/workflows/rust-compile.yml @@ -0,0 +1,126 @@ +on: + push: + branches: ["main"] + pull_request: + +name: Rust + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + RUST_LOG: info + RUST_BACKTRACE: 1 + RUSTFLAGS: "-D warnings" + CARGO_TERM_COLOR: always + DEFAULT_FEATURES: + +jobs: + check-rustdoc-links: + name: Check intra-doc links + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - run: | + for package in $(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | .name'); do + cargo rustdoc -p "$package" --all-features -- -D warnings -W unreachable-pub + done + + format_and_lint: + name: Format and Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy, rustfmt + - name: Run rustfmt + uses: actions-rust-lang/rustfmt@v1 + - name: Run clippy + run: cargo clippy + + build: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + needs: [ format_and_lint ] + strategy: + fail-fast: false + matrix: + include: + - { name: "Linux-x86_64", target: x86_64-unknown-linux-musl, os: ubuntu-latest } + # - { name: "Linux-aarch64", target: aarch64-unknown-linux-musl, os: ubuntu-latest, skip-tests: true } + # - { name: "Linux-arm", target: arm-unknown-linux-musleabi, os: ubuntu-latest, use-cross: true } + + # - { name: "Linux-mips", target: mips-unknown-linux-musl, os: ubuntu-latest, use-cross: true, skip-tests: true } + # - { name: "Linux-mipsel", target: mipsel-unknown-linux-musl, os: ubuntu-latest, use-cross: true, skip-tests: true } + # - { name: "Linux-mips64", target: mips64-unknown-linux-muslabi64, os: ubuntu-latest, use-cross: true, skip-tests: true } + # - { name: "Linux-mips64el", target: mips64el-unknown-linux-muslabi64, os: ubuntu-latest, use-cross: true, skip-tests: true } + + # - { name: "Linux-powerpc", target: powerpc-unknown-linux-gnu, os: ubuntu-latest, use-cross: true, skip-tests: true } + # - { name: "Linux-powerpc64", target: powerpc64-unknown-linux-gnu, os: ubuntu-latest, use-cross: true, skip-tests: true } + # - { name: "Linux-powerpc64le", target: powerpc-unknown-linux-gnu, os: ubuntu-latest, use-cross: true, skip-tests: true } + + # - { name: "Linux-s390x", target: s390x-unknown-linux-gnu, os: ubuntu-latest, use-cross: true, skip-tests: true } + + - { name: "macOS-x86_64", target: x86_64-apple-darwin, os: macOS-latest } + # - { name: "macOS-aarch64", target: aarch64-apple-darwin, os: macOS-latest, skip-tests: true } + + - { name: "Windows-x86_64", target: x86_64-pc-windows-msvc, os: windows-latest } + # - { name: "Windows-aarch64", target: aarch64-pc-windows-msvc, os: windows-latest, skip-tests: true } + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + target: ${{ matrix.target }} + components: rustfmt + cache: false + + - uses: taiki-e/setup-cross-toolchain-action@v1 + with: + target: ${{ matrix.target }} + + - uses: Swatinem/rust-cache@v2 + + - name: Show version information (Rust, cargo, GCC) + shell: bash + run: | + gcc --version || true + rustup -V + rustup toolchain list + cargo -V + rustc -V + + - name: Use rustls on musl targets. + id: build-options + if: contains(matrix.target, '-musl') + run: | + echo "CARGO_BUILD_OPTIONS=${CARGO_BUILD_OPTIONS} --no-default-features --features rustls-tls" >> $GITHUB_OUTPUT + + - name: Build + run: > + cargo build + --all-targets + --features ${{ env.DEFAULT_FEATURES }} + ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} + + - name: Disable testing the tools crate if cross compiling + id: test-options + if: ${{ !matrix.skip-tests }} + run: | + echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS} --exclude tools" >> $GITHUB_OUTPUT + + - name: Run tests + if: ${{ !matrix.skip-tests }} + run: > + cargo test + --workspace + --features ${{ env.DEFAULT_FEATURES }} + ${{ steps.build-options.outputs.CARGO_BUILD_OPTIONS}} + ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} + -- + --nocapture diff --git a/Cargo.toml b/Cargo.toml index a848b85b..be70d385 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,24 @@ [workspace] resolver = "2" members = ["crates/*"] + +[profile.dev.package.insta] +opt-level = 3 + +[profile.dev.package.similar] +opt-level = 3 + +[workspace.package] +version = "0.1.0" +categories = ["conda"] +homepage = "https://github.com/mamba-org/rattler" +repository = "https://github.com/mamba-org/rattler" +license = "BSD-3-Clause" +edition = "2021" +readme = "README.md" +rust-version = "1.70" + +[workspace.metadata.release] +allow-branch = ["main"] +consolidate-commits = true +tag-prefix = "" diff --git a/crates/rattler_installs_packages/Cargo.toml b/crates/rattler_installs_packages/Cargo.toml index ec885c42..f779fd81 100644 --- a/crates/rattler_installs_packages/Cargo.toml +++ b/crates/rattler_installs_packages/Cargo.toml @@ -1,10 +1,15 @@ [package] name = "rattler_installs_packages" -version = "0.1.0" -edition = "2021" -rust-version = "1.70" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +version.workspace = true +edition.workspace = true +authors = ["Bas Zalmstra "] +description = "Datastructures and algorithms to interact with Python packaging ecosystem" +categories.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true +readme.workspace = true +rust-version.workspace = true [dependencies] async-trait = "0.1.71" diff --git a/crates/rip/Cargo.toml b/crates/rip/Cargo.toml index e5bff1f7..7882108a 100644 --- a/crates/rip/Cargo.toml +++ b/crates/rip/Cargo.toml @@ -1,7 +1,14 @@ [package] name = "rip" -version = "0.1.0" -edition = "2021" +version.workspace = true +edition.workspace = true +authors = ["Bas Zalmstra "] +description = "Binary to verify and play around with rattler_installs_packages" +categories.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true +readme.workspace = true default-run = "rip" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -9,8 +16,6 @@ default-run = "rip" [[bin]] name = "index" - - [dependencies] clap = { version = "4.3.23", features = ["derive"] } console = { version = "0.15.7", features = ["windows-console-colors"] } @@ -32,3 +37,7 @@ serde = "1.0.188" serde_with = "3.0.0" serde_json = "1.0.107" rusqlite = { version = "0.29.0", features = ["bundled"] } + +[package.metadata.release] +# Dont publish the binary +release = false