diff --git a/.forgejo/workflows/test.yaml b/.forgejo/workflows/test.yaml index 5fe9a35..5a768bf 100644 --- a/.forgejo/workflows/test.yaml +++ b/.forgejo/workflows/test.yaml @@ -2,30 +2,27 @@ name: Test on: push: - branches: - - main pull_request: - branches: - - main schedule: - cron: '0 0 1 * *' # Monthly - env: SLIGRO_USERNAME: ${{ secrets.SLIGRO_USERNAME }} SLIGRO_PASSWORD: ${{ secrets.SLIGRO_PASSWORD }} +defaults: + run: + shell: nix develop --command {0} + jobs: - pytest: - runs-on: docker - container: - image: alpine:latest + test: + runs-on: nix steps: - - run: apk add nodejs py3-pip ruff - uses: actions/checkout@v4 - - run: pip install -r requirements.txt --break-system-packages + + - name: Populate /nix/store + run: echo done - run: pytest - - run: ruff check diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..67f87df --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1752480373, + "narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..07daac7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,53 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { system = system; }; + pyprojecttoml = nixpkgs.lib.importTOML ./pyproject.toml; + + supermarktconnector = pkgs.python3Packages.buildPythonPackage { + pname = "supermarktconnector"; + version = "0.8.1-2"; + format = "setuptools"; + src = pkgs.fetchFromGitHub { + owner = "bartmachielsen"; + repo = "SupermarktConnector"; + rev = "393c8698a34393f233a0bef45022954bfabe4247"; + hash = "sha256-OuCcwh58HdEsA2h6WGEgKDcyw4RH4NzHlVr7kY3DEHE="; + }; + }; + + in rec { + + packages.default = pkgs.python3Packages.buildPythonPackage { + pname = pyprojecttoml.project.name; + version = pyprojecttoml.project.version; + pyproject = true; + src = self; + dependencies = with pkgs.python3Packages; [ pyquery pytest requests ] + ++ [supermarktconnector]; + nativeBuildInputs = with pkgs.python3Packages; [ setuptools ]; + nativeCheckInputs = with pkgs.python3Packages; [ pytest ] + ++ [ pkgs.ruff ]; + dontCheck = true; # Makes network requests. + checkPhase = '' + runHook preCheck + ruff check + runHook postCheck + ''; + }; + + packages.editable = pkgs.python3Packages.mkPythonEditablePackage { + inherit (packages.default) name version dependencies; + root = "$PWD/src"; + passthru = { inherit (packages.default) nativeCheckInputs; }; + }; + + } + ); +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..83a87eb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[project] +name = "revbank-inflatinator" +version = "0.0.1" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 68df88e..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pyquery -pytest -requests -supermarktconnector