diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 0c5909c..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM debian:bullseye -ENV LC_ALL C.UTF-8 -RUN apt-get update && apt-get install -y apt-utils gcc curl less nano mc whiptail locales man-db wget procps sudo apt-file pkg-config - -# User -RUN useradd --create-home --uid 1000 --shell /bin/bash user -RUN echo 'user ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/a -USER user -WORKDIR /home/user - -# Rust -RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain none -RUN . "$HOME/.cargo/env"; rustup toolchain install nightly --allow-downgrade diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index f76aaaa..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,39 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/rust -{ - "name": "Rust", - "build": { - "dockerfile": "Dockerfile" - }, - "runArgs": [ - "--cap-add=SYS_PTRACE", - "--security-opt", - "seccomp=unconfined" - ], - - // Set *default* container specific settings.json values on container create. - "settings": { - "lldb.executable": "/usr/bin/lldb", - // VS Code don't watch files under ./target - "files.watcherExclude": { - "**/target/**": true - }, - "rust-analyzer.checkOnSave.command": "clippy" - }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "vadimcn.vscode-lldb", - "rust-lang.rust-analyzer", - "tamasfe.even-better-toml" - ], - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "rustc --version", - - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "user" -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d171fdf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,95 @@ +name: CI + +on: + push: + branches: + - main + - feature/** + pull_request: + workflow_dispatch: + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5.3.0 + with: + cancel_others: "true" + + check: + name: Lint and Check + if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} + timeout-minutes: 10 + needs: pre_job + runs-on: ubuntu-latest + strategy: + fail-fast: false + + env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + CARGO_PROFILE_DEV_STRIP: "debuginfo" + CARGO_PROFILE_TEST_STRIP: "debuginfo" + CARGO_PROFILE_RELEASE_STRIP: "debuginfo" + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt, clippy + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Run cargo clippy + run: cargo clippy --all-targets --features python -- -D warnings + + - name: Run cargo check + run: cargo check --all-targets --features python + + - name: Run cargo check (no default features) + run: cargo check --all-targets --no-default-features + + test: + name: Test Suite + if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }} + timeout-minutes: 10 + needs: pre_job + runs-on: ubuntu-latest + strategy: + fail-fast: false + + env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + CARGO_PROFILE_DEV_STRIP: "debuginfo" + CARGO_PROFILE_TEST_STRIP: "debuginfo" + CARGO_PROFILE_RELEASE_STRIP: "debuginfo" + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install nightly toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: ${{ matrix.rust_release == 'latest-nightly' }} + + - name: Install cargo-nextest (linux) + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + + - name: Run cargo nextest on all targets + run: cargo nextest run --no-fail-fast --all-targets + + - name: Run doctests + run: cargo test --no-fail-fast --doc diff --git a/.github/workflows/conventional_commits.yml b/.github/workflows/conventional_commits.yml new file mode 100644 index 0000000..4bd1fe0 --- /dev/null +++ b/.github/workflows/conventional_commits.yml @@ -0,0 +1,20 @@ +name: Conventional Commits + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + main: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable"