docs: add gitgoggles as a contributor for code (#1894) #4576
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
| # Main CI workflow to validate that files are formatted correctly, pass tests, | |
| # and pass lints. | |
| # | |
| # CI workflow was based on a lot of work from other people: | |
| # - https://github.com/heim-rs/heim/blob/master/.github/workflows/ci.yml | |
| # - https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml | |
| # - https://www.reillywood.com/blog/rust-faster-ci/ | |
| # - https://matklad.github.io/2021/09/04/fast-rust-builds.html | |
| # | |
| # Supported platforms run the following tasks: | |
| # - Format | |
| # - Test (built/test in separate steps) | |
| # - Clippy (apparently faster to do it after the build/test) | |
| # | |
| # Unsupported platforms run the following tasks: | |
| # - Clippy | |
| name: ci | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| RUST_BACKTRACE: 1 | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_PROFILE_DEV_DEBUG: 0 | |
| CARGO_HUSKY_DONT_INSTALL_HOOKS: true | |
| COMPLETION_DIR: "target/tmp/bottom/completion/" | |
| MANPAGE_DIR: "target/tmp/bottom/manpage/" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'ClementTsang/bottom' }} | |
| jobs: | |
| # Check if things should be skipped. | |
| pre-job: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
| steps: | |
| - name: Check if this action should be skipped | |
| id: skip_check | |
| uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
| with: | |
| skip_after_successful_duplicate: "true" | |
| paths: '[".cargo/**", ".github/workflows/ci.yml", ".github/ci", "sample_configs/**", "src/**", "tests/**", "build.rs", "Cargo.lock", "Cargo.toml", "clippy.toml", "rustfmt.toml", "Cross.toml"]' | |
| do_not_skip: '["workflow_dispatch", "push"]' | |
| # Runs rustfmt + tests + clippy on the main supported platforms. | |
| # | |
| # TODO: In the future, when ARM runners are available on github, switch ARM targets off of cross. | |
| supported: | |
| needs: pre-job | |
| if: ${{ needs.pre-job.outputs.should_skip != 'true' }} | |
| runs-on: ${{ matrix.info.os }} | |
| timeout-minutes: 12 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| info: | |
| - { | |
| os: "ubuntu-latest", | |
| target: "x86_64-unknown-linux-gnu", | |
| cross: false, | |
| } | |
| - { | |
| os: "ubuntu-latest", | |
| target: "aarch64-unknown-linux-gnu", | |
| cross: true, | |
| } | |
| - { os: "macos-15", target: "x86_64-apple-darwin", cross: false } | |
| - { os: "macos-15", target: "aarch64-apple-darwin", cross: false } | |
| - { | |
| os: "windows-2022", | |
| target: "x86_64-pc-windows-msvc", | |
| cross: false, | |
| } | |
| features: ["--all-features", "--no-default-features"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - name: Read Rust version | |
| shell: bash | |
| run: | | |
| VER=$(cat .github/ci/rust_version.txt) | |
| echo "RUST_VERSION=$VER" >> $GITHUB_ENV | |
| echo "$VER" | |
| - name: Set up Rust toolchain | |
| uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| components: rustfmt, clippy | |
| target: ${{ matrix.info.target }} | |
| - name: Enable Rust cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1 | |
| if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork | |
| with: | |
| key: ${{ matrix.info.target }} | |
| cache-all-crates: true | |
| - name: Check cargo fmt | |
| run: cargo fmt --all -- --check | |
| # TODO: add junit output using nextest for codecov (https://docs.codecov.com/docs/test-analytics) | |
| - name: Run tests | |
| uses: ClementTsang/cargo-action@2438cc5f3ba4e971289fffca2a00dedea6911f14 # v0.0.7 | |
| with: | |
| command: test | |
| args: --no-fail-fast --locked ${{ matrix.features }} --target=${{ matrix.info.target }} -- --nocapture --quiet | |
| use-cross: ${{ matrix.info.cross }} | |
| cross-version: 0.2.5 | |
| env: | |
| RUST_BACKTRACE: full | |
| - name: Run clippy | |
| uses: ClementTsang/cargo-action@2438cc5f3ba4e971289fffca2a00dedea6911f14 # v0.0.7 | |
| with: | |
| command: clippy | |
| args: ${{ matrix.features }} --all-targets --workspace --target=${{ matrix.info.target }} -- -D warnings | |
| use-cross: ${{ matrix.info.cross }} | |
| cross-version: 0.2.5 | |
| env: | |
| RUST_BACKTRACE: full | |
| # Try running cargo build on all other platforms. | |
| # | |
| # TODO: Maybe some of these should be allowed to fail? If so, I guess we can add back the "unofficial" MSRV, | |
| # I would also put android there. | |
| unsupported-check: | |
| needs: pre-job | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| info: | |
| # x86 or x86-64 | |
| - { | |
| os: "ubuntu-latest", | |
| target: "i686-unknown-linux-gnu", | |
| cross: true, | |
| } | |
| - { | |
| os: "ubuntu-latest", | |
| target: "x86_64-unknown-linux-musl", | |
| cross: false, | |
| } | |
| - { | |
| os: "ubuntu-latest", | |
| target: "i686-unknown-linux-musl", | |
| cross: true, | |
| } | |
| - { os: "windows-2022", target: "i686-pc-windows-msvc", cross: false } | |
| - { | |
| os: "windows-2022", | |
| target: "x86_64-pc-windows-gnu", | |
| cross: false, | |
| } | |
| # Beta | |
| - { | |
| os: "ubuntu-latest", | |
| target: "x86_64-unknown-linux-gnu", | |
| cross: false, | |
| rust: "beta", | |
| } | |
| - { | |
| os: "macos-15", | |
| target: "aarch64-apple-darwin", | |
| cross: false, | |
| rust: "beta", | |
| } | |
| - { | |
| os: "windows-2022", | |
| target: "x86_64-pc-windows-msvc", | |
| cross: false, | |
| rust: "beta", | |
| } | |
| # armv7 | |
| - { | |
| os: "ubuntu-latest", | |
| target: "armv7-unknown-linux-gnueabihf", | |
| cross: true, | |
| } | |
| # armv6 | |
| - { | |
| os: "ubuntu-latest", | |
| target: "arm-unknown-linux-gnueabihf", | |
| cross: true, | |
| } | |
| # PowerPC 64 LE | |
| - { | |
| os: "ubuntu-latest", | |
| target: "powerpc64le-unknown-linux-gnu", | |
| cross: true, | |
| } | |
| # Risc-V 64gc | |
| # Note: seems like this breaks with tests? | |
| - { | |
| os: "ubuntu-latest", | |
| target: "riscv64gc-unknown-linux-gnu", | |
| cross: true, | |
| } | |
| # Android ARM64 | |
| - { | |
| os: "ubuntu-latest", | |
| target: "aarch64-linux-android", | |
| cross: true, | |
| cross-version: "git:df3309709a4a26b3dc3b1567239c3f38b9da0425", # latest version that I've found works so far | |
| no-default-features: true, | |
| no-clippy: true, | |
| } | |
| # Windows ARM | |
| - { | |
| os: "windows-11-arm", | |
| target: "aarch64-pc-windows-msvc", | |
| cross: false, | |
| } | |
| runs-on: ${{ matrix.info.os }} | |
| if: ${{ needs.pre-job.outputs.should_skip != 'true' }} | |
| timeout-minutes: 12 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - name: Read Rust version | |
| shell: bash | |
| run: | | |
| VER=$(cat .github/ci/rust_version.txt) | |
| echo "RUST_VERSION=$VER" >> $GITHUB_ENV | |
| echo "$VER" | |
| - name: Set up Rust toolchain | |
| uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
| with: | |
| toolchain: ${{ matrix.info.rust || env.RUST_VERSION }} | |
| target: ${{ matrix.info.target }} | |
| components: "clippy" | |
| - name: Enable Rust cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1 | |
| if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork | |
| with: | |
| key: ${{ matrix.info.target }} | |
| cache-all-crates: true | |
| - name: Clippy (default features) | |
| uses: ClementTsang/cargo-action@2438cc5f3ba4e971289fffca2a00dedea6911f14 # v0.0.7 | |
| if: ${{ matrix.info.no-default-features != true }} | |
| with: | |
| command: clippy | |
| args: --all-targets --workspace --target=${{ matrix.info.target }} --locked | |
| use-cross: ${{ matrix.info.cross }} | |
| cross-version: ${{ matrix.info.cross-version || '0.2.5' }} | |
| - name: Clippy (no features enabled) | |
| uses: ClementTsang/cargo-action@2438cc5f3ba4e971289fffca2a00dedea6911f14 # v0.0.7 | |
| if: ${{ matrix.info.no-default-features == true }} | |
| with: | |
| command: clippy | |
| args: --all-targets --workspace --target=${{ matrix.info.target }} --locked --no-default-features | |
| use-cross: ${{ matrix.info.cross }} | |
| cross-version: ${{ matrix.info.cross-version || '0.2.5' }} | |
| unsupported-check-freebsd: | |
| needs: pre-job | |
| if: ${{ needs.pre-job.outputs.should_skip != 'true' }} | |
| runs-on: "ubuntu-latest" | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| info: | |
| # Seems like cross's FreeBSD image is a bit broken? I get build errors, | |
| # may be related to this issue: https://github.com/cross-rs/cross/issues/1291 | |
| # | |
| # Alas, that's why we do it with VMs. | |
| - { | |
| type: "freebsd", | |
| os_release: "15.0", | |
| target: "x86_64-unknown-freebsd", | |
| } | |
| - { | |
| type: "freebsd", | |
| os_release: "14.3", | |
| target: "x86_64-unknown-freebsd", | |
| } | |
| - { | |
| type: "freebsd", | |
| os_release: "13.5", | |
| target: "x86_64-unknown-freebsd", | |
| } | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| fetch-depth: 1 | |
| - name: Enable Rust cache | |
| uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1 | |
| if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork | |
| with: | |
| key: ${{ matrix.info.target }}-${{ matrix.info.os_release }} | |
| cache-all-crates: true | |
| - name: Tests + Clippy (FreeBSD) | |
| if: ${{ matrix.info.type == 'freebsd' }} | |
| uses: vmactions/freebsd-vm@487ce35b96fae3e60d45b521735f5aa436ecfade # v1.2.4 | |
| with: | |
| release: "${{ matrix.info.os_release }}" | |
| envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS" | |
| usesh: true | |
| prepare: | | |
| pkg install -y curl bash | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh | |
| sh rustup.sh --default-toolchain stable -y | |
| run: | | |
| . "$HOME/.cargo/env" | |
| # Note this only tests the default features, but I think that's fine. | |
| cargo test --no-fail-fast --locked -- --nocapture --quiet | |
| cargo clippy --all-targets --workspace -- -D warnings | |
| completion: | |
| name: "CI Pass Check" | |
| needs: [supported, unsupported-check, unsupported-check-freebsd] | |
| if: ${{ needs.supported.result != 'skipped' || needs.unsupported-check.result != 'skipped' || needs.unsupported-check-freebsd.result != 'skipped' }} | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - name: CI Passed | |
| if: ${{ (needs.supported.result == 'success' || needs.supported.result == 'skipped') && (needs.unsupported-check.result == 'success' || needs.unsupported-check.result == 'skipped') && (needs.unsupported-check-freebsd.result == 'success' || needs.unsupported-check-freebsd.result == 'skipped') }} | |
| run: | | |
| echo "CI workflow completed successfully."; | |
| - name: CI Failed | |
| if: ${{ needs.supported.result == 'failure' || needs.unsupported-check.result == 'failure' || needs.unsupported-check-freebsd.result == 'failure' }} | |
| run: | | |
| echo "CI workflow failed."; | |
| exit 1; | |
| - name: CI Cancelled | |
| if: ${{ needs.supported.result == 'cancelled' || needs.unsupported-check.result == 'cancelled' || needs.unsupported-check-freebsd.result == 'cancelled' }} | |
| run: | | |
| echo "CI workflow was cancelled."; | |
| exit 1; |