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

switch to nix flakes #1508

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
39 changes: 39 additions & 0 deletions .github/workflows/flake-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Nix flake checker determines the health of the flake.lock files.
# See https://determinate.systems/posts/flake-checker for some
# explanation. This checks that the branches that are relied on for
# packages are maintained and have recent commits. If they aren't
# maintained then the checker will notify us and we can update the
# lock or flake files.
---
name: Test Flakes
on: [push, pull_request]
jobs:
test-flakes:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
name: pfhub
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: nix-community
- name: Check Nix flake inputs (./flake.lock)
uses: DeterminateSystems/flake-checker-action@v5
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Build Nix package
run: |
nix flake lock --update-input pfhub
nix build
- name: Check Nix flake inputs (./_data/python-pfhub/flake.lock)
uses: DeterminateSystems/flake-checker-action@v5
with:
flake-lock-path: _data/python-pfhub/flake.lock
- name: Build Nix package
run: |
cd _data/python-pfhub
nix build
6 changes: 3 additions & 3 deletions .github/workflows/surge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
- run: echo "REPO=$(cat repo)" >> $GITHUB_ENV
- run: echo "HEAD_REF=$(cat head_ref)" >> $GITHUB_ENV

- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v3
with:
repository: ${{ env.REPO }}
ref: ${{ env.HEAD_REF }}

- uses: cachix/install-nix-action@v14.1
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable

Expand All @@ -50,7 +50,7 @@ jobs:
SURGE_LOGIN: "${{ secrets.SURGE_LOGIN }}"
SURGE_TOKEN: "${{ secrets.SURGE_TOKEN }}"
run: |
nix-shell shell-surge.nix --command " \
nix develop --command bash -c " \
if [[ ${{ env.NAME }} == 'pullrequest' ]]; then \
rm -rf ./_site && \
jekyll build && \
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/test-jekyll.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Test Jekyll
on: [push, pull_request]
jobs:
pfhub-nix-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
name: pfhub
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: nix-community
- run: echo "UID=${UID}" >> $GITHUB_ENV
- uses: actions/cache/restore@v3
with:
path: /run/user/${{ env.UID }}/http_cache.sqlite
key: ${{ runner.os}}-http_cache.sqlite
# Following required because of
# https://github.com/NixOS/nix/issues/3978#issuecomment-1585001299
- run: nix flake lock --update-input pfhub
- run: nix develop --command bash -c "make simulations"
- run: nix develop --command bash -c "find . -name '*.ipynb' -type f -not -path '*/.ipynb_checkpoints/*' -exec touch {} \;"
- run: nix develop --command bash -c "make notebooks"
- run: nix develop --command bash -c "rm -rf ./_site"
- run: nix develop --command bash -c "jekyll build -d ./_site/pfhub"
- uses: actions/cache/save@v3
if: always()
with:
path: /run/user/${{ env.UID }}/http_cache.sqlite
key: ${{ runner.os}}-http_cache.sqlite
16 changes: 8 additions & 8 deletions .github/workflows/test-pfhub-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
run:
working-directory: ./_data/python-pfhub
steps:
- uses: actions/checkout@v2.3.4
- uses: cachix/install-nix-action@v14.1
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
name: pfhub
Expand All @@ -20,12 +20,12 @@ jobs:
with:
path: /run/user/${{ env.UID }}/http_cache.sqlite
key: ${{ runner.os}}-http_cache.sqlite
- run: nix-shell --pure --command "py.test --nbval-lax --cov-fail-under=100"
- run: nix-shell --pure --command "black --check setup.py pfhub"
- run: nix-shell --pure --command "pylint setup.py pfhub"
- run: nix-shell --pure --command "flake8 setup.py pfhub"
- run: nix-shell --pure --command "cd ../../results; make notebooks"
- run: nix-shell --pure --command "py.test --nbval-lax ../../results/benchmark*.ipynb"
- run: nix develop --command bash -c "py.test --nbval-lax --cov-fail-under=100"
- run: nix develop --command bash -c "black --check setup.py pfhub"
- run: nix develop --command bash -c "pylint setup.py pfhub"
- run: nix develop --command bash -c "flake8 setup.py pfhub"
- run: nix develop --command bash -c "cd ../../results; make notebooks"
- run: nix develop --command bash -c "py.test --nbval-lax ../../results/benchmark*.ipynb"
- uses: actions/cache/save@v3
if: always()
with:
Expand Down
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

25 changes: 18 additions & 7 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,32 @@ Pull the Docker Instance from Dockerhub

Run the container

$ docker run -i -t -p 4000:4000 wd15/pfhub:latest
$ docker run -i -t -p 8888:8888 wd15/pfhub:latest

and then
### View the notebooks

# nix-shell
# cd pfhub
# jekyll serve --host 0.0.0.0
# jupyter-notebook --ip 0.0.0.0 --no-browser

to view the website at http://127.0.0.1:4000/pfhub/ on the host.
and view the running Jupyter file browser at http://127.0.0.1:8888 on
the host.

### View the website

# cd pfhub
# jekyll serve --host 0.0.0.0 --port 8888

to view the website at http://127.0.0.1:8888/pfhub/ on the host.

## Build the Docker instance

Clone this repository and run
The Docker instance is built using Nix. See (./NIX.md) to get started.
Once you're familiar with Nix, clone this repository and then

$ nix build .#docker
$ docker load < result

$ docker build -t wd15/pfhub:latest .
in the base directory.

## Push the Docker instance

Expand Down
57 changes: 0 additions & 57 deletions Dockerfile

This file was deleted.

Loading
Loading