Skip to content

Commit 898e54d

Browse files
authored
Merge pull request #1 from EnergySystemsModellingLab/add_example_code
Add example code
2 parents f3651bd + 4640b3c commit 898e54d

27 files changed

Lines changed: 1524 additions & 1 deletion

.codespell_ignore.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
crate

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
indent_style = space
8+
indent_size = 4
9+
max_line_length = 100
10+
11+
[*.md]
12+
indent_size = 2
13+
14+
[*.yaml]
15+
indent_size = 2
16+
17+
[*.yml]
18+
indent_size = 2
19+
20+
[Makefile]
21+
indent_style = tab

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "cargo"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"

.github/workflows/auto-merge.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Dependabot and Pre-commit auto-merge
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write # Needed if in a private repository
9+
10+
jobs:
11+
auto-merge:
12+
runs-on: ubuntu-latest
13+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]' }}
14+
steps:
15+
- name: Enable auto-merge for Dependabot PRs
16+
run: gh pr merge --auto --merge "$PR_URL"
17+
env:
18+
PR_URL: ${{github.event.pull_request.html_url}}
19+
# GitHub provides this variable in the CI env. You don't
20+
# need to add anything to the secrets vault.
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Cargo Build & Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build_and_test:
13+
name: Build and test
14+
runs-on: ${{ matrix.os }}
15+
env:
16+
# Make warnings fatal
17+
RUSTFLAGS: -D warnings
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [windows-latest, ubuntu-latest]
22+
toolchain:
23+
- stable
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Cargo Cache
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/.cargo
31+
target
32+
key: ${{ matrix.os }}-cargo-${{ hashFiles('Cargo.toml') }}
33+
restore-keys: |
34+
${{ matrix.os }}-cargo-${{ hashFiles('Cargo.toml') }}
35+
${{ matrix.os }}-cargo
36+
- uses: dtolnay/rust-toolchain@master
37+
with:
38+
toolchain: ${{ matrix.toolchain }}
39+
- run: cargo build --verbose
40+
- run: cargo test --verbose

.github/workflows/check-links.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check links in Markdown files
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
schedule:
7+
- cron: "0 0 * * 1" # midnight every Monday
8+
9+
jobs:
10+
check-links:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: gaurav-nelson/github-action-markdown-link-check@v1
15+
with:
16+
use-quiet-mode: "yes"
17+
use-verbose-mode: "yes"

.github/workflows/pre-commit.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Run pre-commit hooks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: [ubuntu-latest]
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: dtolnay/rust-toolchain@stable
14+
- uses: pre-commit/action@v3.0.1
15+
- uses: pre-commit-ci/lite-action@v1.0.2
16+
if: always()

.markdownlint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
MD013:
3+
# Maximum number of characters
4+
line_length: 100

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-merge-conflict
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- repo: https://github.com/igorshubovych/markdownlint-cli
9+
rev: v0.38.0
10+
hooks:
11+
- id: markdownlint-fix
12+
- repo: https://github.com/pre-commit/mirrors-prettier
13+
rev: "v3.1.0"
14+
hooks:
15+
- id: prettier
16+
types_or: [yaml, json]
17+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
18+
rev: v2.13.0
19+
hooks:
20+
- id: pretty-format-toml
21+
args: [--autofix, --indent, "4", --no-sort]
22+
- id: pretty-format-rust
23+
- repo: https://github.com/doublify/pre-commit-rust
24+
rev: v1.0
25+
hooks:
26+
- id: clippy
27+
# Warnings can be suppressed by adding "-A clippy::some_warning" to args
28+
args: [--fix, --allow-dirty, --allow-staged, --, -D, clippy::all, -A, clippy::precedence]
29+
- repo: https://github.com/codespell-project/codespell
30+
rev: v2.2.6
31+
hooks:
32+
- id: codespell
33+
args: [--ignore-words, .codespell_ignore.txt]

0 commit comments

Comments
 (0)