Skip to content

Commit

Permalink
Merge pull request #115 from nicolasauler/local-env
Browse files Browse the repository at this point in the history
feat: upgrading htmx, picocss, rust deps and rust version, flake lock
  • Loading branch information
nicolasauler authored Jul 7, 2024
2 parents d5c8f0e + 3fe89bc commit a4b18e2
Show file tree
Hide file tree
Showing 25 changed files with 560 additions and 1,034 deletions.
63 changes: 37 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
# See: https://circleci.com/docs/configuration-reference
version: 2.1

orbs:
codecov: codecov/[email protected]

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/configuration-reference/#jobs
jobs:
build-and-test:
docker:
- image: cimg/rust:1.78.0
- image: cimg/rust:1.79.0
environment:
# Fail the build if there are warnings
RUSTFLAGS: '-D warnings'
RUSTFLAGS: "-D warnings"
CARGO_INCREMENTAL: 0
# RUSTC_WRAPPER: "sccache"
steps:
- checkout
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
# If you have committed your Cargo.lock file to version control
# delete this step.
- run:
name: Calculate dependencies
command: cargo generate-lockfile
- restore_cache:
keys:
- v1-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
Expand All @@ -35,12 +35,18 @@ jobs:
- target/debug/deps
key: v1-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Run all tests
command: cargo test
name: Install nextest
command: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- run:
name: Build and archive tests
command: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst
- run:
name: Run tests
command: cargo nextest run --no-fail-fast --archive-file nextest-archive.tar.zst

security:
docker:
- image: cimg/rust:1.78.0
- image: cimg/rust:1.79.0
steps:
- checkout
- run:
Expand All @@ -66,7 +72,7 @@ jobs:

format:
docker:
- image: cimg/rust:1.78.0
- image: cimg/rust:1.79.0
steps:
- checkout
- run:
Expand All @@ -83,7 +89,7 @@ jobs:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/rust:1.78.0
- image: cimg/rust:1.79.0
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
Expand All @@ -96,13 +102,13 @@ jobs:
command: rustup component add clippy
- run:
name: Linting
command: cargo clippy -- -D warnings
command: cargo clippy --locked --all-targets -- -D warnings -D dead-code

doc:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/rust:1.78.0
- image: cimg/rust:1.79.0
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
Expand All @@ -121,7 +127,7 @@ jobs:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/rust:1.78.0
- image: cimg/rust:1.79.0
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
Expand All @@ -138,16 +144,19 @@ jobs:
- run:
name: Install codecov tool
command: cargo install cargo-llvm-cov
- run:
name: Install nextest
command: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- run:
name: Running code coverage
command: rustup run nightly cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
command: rustup run nightly cargo llvm-cov nextest --locked --all-features --lcov --output-path lcov.info
- codecov/upload:
file: './lcov.info'
file: "./lcov.info"
#token: $CODECOV_TOKEN already default

shuttle-deploy:
docker:
- image: cimg/rust:1.78.0
- image: cimg/rust:1.79.0
steps:
- checkout
- run:
Expand All @@ -163,7 +172,6 @@ jobs:
name: Deploy to Shuttle
command: cargo shuttle deploy


# Orchestrate jobs using workflows
# See: https://circleci.com/docs/configuration-reference/#workflows
workflows:
Expand Down Expand Up @@ -194,16 +202,19 @@ workflows:
filters:
branches:
only: main
# - coverage:
# requires:
# - doc
# filters:
# tags:
# only: /.*/
- coverage:
requires:
- build-and-test
- security
- format
- lint
filters:
tags:
only: /.*/
- shuttle-deploy:
requires:
- doc
# - coverage
- coverage
filters:
branches:
only: main
6 changes: 6 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[profile.default]
# Print out output for failing tests as soon as they fail, and also at the end
# of the run (for easy scrollability).
failure-output = "immediate-final"
# Do not cancel the test run on the first failure.
fail-fast = false
13 changes: 13 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ref: https://docs.codecov.com/docs/codecovyml-reference
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true

# Test files aren't important for coverage
ignore:
- "tests"
42 changes: 23 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: detect-private-key
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: detect-private-key
- repo: https://github.com/crate-ci/typos
rev: v1.23.1
hooks:
- id: typos
- repo: local
hooks:
- id: rust-formatting
name: Rust formatting
description: Run cargo fmt on files included in the commit. rustfmt should be installed before-hand.
entry: cargo fmt --all --
pass_filenames: true
types: [file, rust]
language: system
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit. clippy should be installed before-hand.
entry: cargo clippy --all -- -D warnings
pass_filenames: false
types: [file, rust]
language: system
- id: rust-formatting
name: Rust formatting
description: Run cargo fmt on files included in the commit. rustfmt should be installed before-hand.
entry: cargo fmt --all --
pass_filenames: true
types: [file, rust]
language: system
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit. clippy should be installed before-hand.
entry: cargo clippy --all -- -D warnings -D dead-code
pass_filenames: false
types: [file, rust]
language: system
Loading

0 comments on commit a4b18e2

Please sign in to comment.