Skip to content

Commit

Permalink
CI (#4)
Browse files Browse the repository at this point in the history
* CI

* remove old output

* fix some (but not all) licenses

* fix fmt

* cleanup

* fmt

* disable bench

* fix all licenses

* rustfmt config
  • Loading branch information
javdl authored Jan 7, 2025
1 parent 99d6b39 commit 0d1a339
Show file tree
Hide file tree
Showing 53 changed files with 197 additions and 6,627 deletions.
Binary file removed .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only
POLYGON_API_KEY=
FINANCIALMODELINGPREP_API_KEY=
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only
use flake
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only

# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
Expand Down
124 changes: 76 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only

name: CI

on:
Expand All @@ -18,6 +22,8 @@ jobs:
nix_path: nixpkgs=channel:nixos-24.11
extra_nix_config: |
experimental-features = nix-command flakes
connect-timeout = 60
stalled-download-timeout = 300
- uses: cachix/cachix-action@v13
with:
Expand All @@ -27,8 +33,8 @@ jobs:
- name: Run unit tests with coverage
run: |
nix \
--extra-experimental-features "nix-command flakes" \
develop \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "cargo install cargo-tarpaulin && cargo tarpaulin --out lcov --output-dir coverage"
- name: Upload coverage to Codecov
Expand All @@ -40,10 +46,24 @@ jobs:

- name: Run unit tests
run: |
nix \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "cargo test"
# Retry logic for nix develop
max_attempts=3
attempt=1
while [ $attempt -le $max_attempts ]; do
if nix \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "cargo test"; then
break
fi
echo "Attempt $attempt failed. Waiting before retry..."
sleep 30
attempt=$((attempt + 1))
done
if [ $attempt -gt $max_attempts ]; then
echo "All attempts failed"
exit 1
fi
check:
name: 'Static Analysis: cargo check'
Expand All @@ -59,6 +79,8 @@ jobs:
nix_path: nixpkgs=channel:nixos-24.11
extra_nix_config: |
experimental-features = nix-command flakes
connect-timeout = 60
stalled-download-timeout = 300
- uses: cachix/cachix-action@v13
with:
Expand Down Expand Up @@ -177,6 +199,8 @@ jobs:
nix_path: nixpkgs=channel:nixos-24.11
extra_nix_config: |
experimental-features = nix-command flakes
connect-timeout = 60
stalled-download-timeout = 300
- uses: cachix/cachix-action@v13
with:
Expand All @@ -190,48 +214,48 @@ jobs:
develop \
--command bash -c "reuse lint"
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- uses: Swatinem/rust-cache@v2

- name: Run cargo bench
# note that we explictly have to mention which benches to run, because
# otherwise
run:
cargo +nightly bench
--bench shuffle
--bench encrypt
-- --output-format bencher | tee output.txt

- name: Download previous benchmark data
uses: actions/cache@v3
with:
path: ./cache
key: cargo-bench

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: cargo-bench
tool: 'cargo'
output-file-path: ./output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
external-data-json-path: ./cache/benchmark-data.json
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: false
# benchmark:
# name: Benchmark
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Install stable toolchain
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly
# override: true

# - uses: Swatinem/rust-cache@v2

# - name: Run cargo bench
# # note that we explictly have to mention which benches to run, because
# # otherwise
# run:
# cargo +nightly bench
# --bench shuffle
# --bench encrypt
# -- --output-format bencher | tee output.txt

# - name: Download previous benchmark data
# uses: actions/cache@v3
# with:
# path: ./cache
# key: cargo-bench

# - name: Store benchmark result
# uses: benchmark-action/github-action-benchmark@v1
# with:
# name: cargo-bench
# tool: 'cargo'
# output-file-path: ./output.txt
# github-token: ${{ secrets.GITHUB_TOKEN }}
# external-data-json-path: ./cache/benchmark-data.json
# alert-threshold: '150%'
# comment-on-alert: true
# fail-on-alert: false

nix_flake_info:
name: Register Nix Flake Information
Expand All @@ -247,6 +271,8 @@ jobs:
nix_path: nixpkgs=channel:nixos-24.11
extra_nix_config: |
experimental-features = nix-command flakes
connect-timeout = 60
stalled-download-timeout = 300
- uses: cachix/cachix-action@v13
with:
Expand Down Expand Up @@ -285,6 +311,8 @@ jobs:
nix_path: nixpkgs=channel:nixos-24.11
extra_nix_config: |
experimental-features = nix-command flakes
connect-timeout = 60
stalled-download-timeout = 300
- uses: cachix/cachix-action@v13
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/daily-run.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only

name: Daily Data Collection

on:
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only

# Generated by Cargo
# will have compiled files and executables
debug/
Expand Down Expand Up @@ -27,3 +31,6 @@ tmp/
.direnv/
.direnv
.direnv/*

output/*
.DS_Store
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
"**/*tsconfig.json": true,
".cache": true,
"retool.config.json": true
},
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
}
}
3 changes: 3 additions & 0 deletions .vscode/settings.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>

SPDX-License-Identifier: AGPL-3.0-only
3 changes: 3 additions & 0 deletions Cargo.lock.license

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only

[package]
name = "top200-rs"
version = "0.1.0"
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
SPDX-License-Identifier: AGPL-3.0-only
-->

[![CI](https://github.com/javdl/top200-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/javdl/top200-rs/actions/workflows/ci.yml)[![Daily Data Collection](https://github.com/javdl/top200-rs/actions/workflows/daily-run.yml/badge.svg)](https://github.com/javdl/top200-rs/actions/workflows/daily-run.yml)

# top200-rs
Expand All @@ -8,8 +14,13 @@

## License

To set license and copyright information, run:

```sh
reuse annotate --copyright="Joost van der Laan <[email protected]>" --license="AGPL-3.0-only" --skip-unrecognised src/*
reuse annotate --copyright="Joost van der Laan <[email protected]>" --license="AGPL-3.0-only" --skip-unrecognised *

# or to check if all files are annotated correctly
reuse lint
```

## Changelog
Expand Down
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only

# Codecov repository config file
# https://docs.codecov.com/docs/codecov-yaml#repository-yaml

Expand Down
4 changes: 4 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2025 Joost van der Laan <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only

non_us_tickers = [
"MC.PA", # LVMH
"ITX.MC", # Inditex
Expand Down
Loading

0 comments on commit 0d1a339

Please sign in to comment.