-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from hs3city/switch-finance-workflow-to-nix
Switch finance workflow to Nix
- Loading branch information
Showing
7 changed files
with
200 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,23 +3,22 @@ name: "Update financial dashboard" | |
on: | ||
push: | ||
paths: | ||
- 'automation/finanse/finanse.csv' | ||
- '.github/workflows/finance.yaml' | ||
- "automation/finanse/*" | ||
- ".github/workflows/finance.yaml" | ||
|
||
jobs: | ||
dashboard: | ||
runs-on: ubuntu-latest | ||
name: Update financial dashboard | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
- name: Update dashboard | ||
run: | | ||
cd automation/finanse | ||
pip install -r requirements.txt | ||
python dashboard.py | ||
nix build | ||
cp result ../../layouts/shortcodes/finanse.html | ||
nix flake check | ||
git add ../../layouts/shortcodes/finanse.html | ||
- name: Commit Changes | ||
uses: stefanzweifel/[email protected] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ hugo.linux | |
hugo.darwin | ||
|
||
node_modules | ||
|
||
automation/finanse/result |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
description = "Construct development shell from requirements.txt"; | ||
inputs = { | ||
|
||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05-small"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
pyproject-nix.url = "github:nix-community/pyproject.nix"; | ||
pyproject-nix.inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
|
||
outputs = | ||
{ | ||
self, | ||
nixpkgs, | ||
flake-utils, | ||
pyproject-nix, | ||
}: | ||
flake-utils.lib.eachDefaultSystem ( | ||
system: | ||
let | ||
project = pyproject-nix.lib.project.loadRequirementsTxt { projectRoot = ./.; }; | ||
|
||
pkgs = import nixpkgs { inherit system; }; | ||
python = pkgs.python3; | ||
|
||
pythonEnv = | ||
#assert project.validators.validateVersionConstraints { inherit python; } == { }; ( | ||
pkgs.python3.withPackages (project.renderers.withPackages { inherit python; }) | ||
#); | ||
; | ||
|
||
in | ||
with pkgs; | ||
{ | ||
packages.dashboard = pkgs.stdenv.mkDerivation { | ||
name = "dashboard"; | ||
src = ./.; | ||
buildPhase = "${pythonEnv}/bin/python ./dashboard.py --source_path=./. --dest_path=./."; | ||
installPhase = "cp ./finanse.html $out"; | ||
}; | ||
defaultPackage = self.packages.${system}.dashboard; | ||
devShells.default = mkShell { buildInputs = [ pythonEnv ]; }; | ||
} | ||
); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pandas==1.3.4 | ||
plotly==5.3.1 | ||
beautifulsoup4==4.9.3 | ||
pandas~=1.3.4 | ||
plotly~=5.3.1 | ||
beautifulsoup4~=4.9.3 |
Large diffs are not rendered by default.
Oops, something went wrong.