Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devenv #38

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="

use devenv
24 changes: 16 additions & 8 deletions .github/workflows/ratings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,29 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4.1.1

- name: Install Nix
uses: cachix/install-nix-action@v18
uses: cachix/install-nix-action@v26

- name: Use Cachix
uses: cachix/cachix-action@v12
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
name: devenv

- name: Install devenv.sh
run: nix profile install --accept-flake-config tarball+https://install.devenv.sh/latest

- name: Build the devenv shell and run any pre-commit hooks
run: devenv ci

- name: Run tests
run: cd src && nix develop .#test -c pytest
run: devenv shell run_tests

- name: Run update_reviews.py
run: cd src && nix develop .#reviews -c python update_reviews.py
- name: Run update_reviews
run: devenv shell update_reviews

- name: Add & Commit
uses: EndBug/add-and-commit@v7.1.0
uses: EndBug/add-and-commit@v9.1.4
with:
message: update data.yaml via update_reviews.py
30 changes: 20 additions & 10 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,36 @@ jobs:
update_readme_and_map:
runs-on: ubuntu-latest



steps:
- name: Checkout
uses: actions/checkout@v2.4.0
uses: actions/checkout@v4.1.1

- name: Install Nix
uses: cachix/install-nix-action@v18
uses: cachix/install-nix-action@v26

- name: Use Cachix
uses: cachix/cachix-action@v12
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
name: devenv

- name: Install devenv.sh
run: nix profile install --accept-flake-config tarball+https://install.devenv.sh/latest

- name: Build the devenv shell and run any pre-commit hooks
run: devenv ci

- name: Run tests
run: cd src && nix develop .#test -c pytest
run: devenv shell run_tests

- name: Run create_readme.py
run: cd src && nix develop .#readmeAndMap -c python create_readme.py
- name: Run create_readme
run: devenv shell create_readme

- name: Run create_map_data.py
run: cd src && nix develop .#readmeAndMap -c python create_map_data.py
- name: Run create_map_data
run: devenv shell create_map_data

- name: Add & Commit
uses: EndBug/add-and-commit@v7.1.0
uses: EndBug/add-and-commit@v9.1.4
with:
message: update readme.md via create_readme.py
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
src/env/
src/.idea/
*.pyc

# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml

156 changes: 156 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1709750969,
"narHash": "sha256-LDTZ2aRlnXSwYZnUnv6cJ3WQp8LmDYKMtouv2gTQmAA=",
"owner": "cachix",
"repo": "devenv",
"rev": "e53e5cc77bb6e1073b136ec98a0a9cfbb582c7a8",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1709780214,
"narHash": "sha256-p4iDKdveHMhfGAlpxmkCtfQO3WRzmlD11aIcThwPqhk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f945939fd679284d736112d3d5410eb867f3b31c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1704874635,
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1708018599,
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"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
}
42 changes: 42 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ pkgs, ... }:

{
packages = [
pkgs.chromedriver
# pkgs.chromium
];

languages.python = {
enable = true;
venv = {
enable = true;
requirements = ''
requests
oyaml
selenium
pytest
pyyaml
jinja2
'';
};
};

scripts = {
create_readme.exec = ''
pushd src > /dev/null
python create_readme.py
popd > /dev/null
'';
create_map_data.exec = ''
pushd src > /dev/null
python create_map_data.py
popd > /dev/null
'';
update_reviews.exec = ''
pushd src > /dev/null
python update_reviews.py
popd > /dev/null
'';
test.exec = "pytest src/test_all.py";
};
}
3 changes: 3 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
26 changes: 0 additions & 26 deletions src/flake.lock

This file was deleted.

50 changes: 0 additions & 50 deletions src/flake.nix

This file was deleted.

Loading