Skip to content

Commit 363f6c0

Browse files
authored
Merge pull request #3 from scientificcomputing/finsberg/updates
Restructure repo and add workflow for reproducing results
2 parents eb9eaff + 2327f4f commit 363f6c0

25 files changed

Lines changed: 935 additions & 380 deletions

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
data/*
33
code/results/*
44
code/figures/*
5+
_build
56

67

78
### Python ###

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/build_docs.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: Github Pages
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
23

34
on:
5+
push:
6+
branches: ["main"]
47
pull_request:
58
branches: ["main"]
69

@@ -16,22 +19,54 @@ jobs:
1619
PUBLISH_DIR: ./_build/html
1720

1821
steps:
19-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2023

2124
- name: Setup Python
2225
uses: actions/setup-python@v4
2326
with:
2427
python-version: "3.10"
2528

29+
- name: Cache
30+
id: cache
31+
uses: actions/cache@v3
32+
with:
33+
path: |
34+
~/.cache/pip
35+
~/_build
36+
key: cache_v1
37+
restore-keys: |
38+
cache_v1
39+
2640
- name: Install dependencies
2741
run: python3 -m pip install -r requirements-docs.txt
2842

43+
2944
- name: Build docs
3045
run: jupyter book build .
31-
32-
- name: Upload documentation as artifact
33-
uses: actions/upload-artifact@v3
46+
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v2
3449
with:
35-
name: documentation
3650
path: ${{ env.PUBLISH_DIR }}
37-
if-no-files-found: error
51+
52+
# Single deploy job since we're just deploying
53+
deploy:
54+
if: github.ref == 'refs/heads/main'
55+
needs: build
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
60+
runs-on: ubuntu-latest
61+
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v4
65+
66+
- name: Setup Pages
67+
uses: actions/configure-pages@v3
68+
69+
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v2

.github/workflows/deploy.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/docker-image.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,29 @@ jobs:
2525

2626
steps:
2727
- name: Checkout repository
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929

3030
- name: Set up QEMU
31-
uses: docker/setup-qemu-action@v2
31+
uses: docker/setup-qemu-action@v3
3232

3333
- name: Set up Docker Buildx
34-
uses: docker/setup-buildx-action@v2
34+
uses: docker/setup-buildx-action@v3
3535

3636
- name: Log in to the Container registry
37-
uses: docker/login-action@v2
37+
uses: docker/login-action@v3
3838
with:
3939
registry: ${{ env.REGISTRY }}
4040
username: ${{ github.actor }}
4141
password: ${{ secrets.GITHUB_TOKEN }}
4242

4343
- name: Extract metadata (tags, labels) for Docker
4444
id: meta
45-
uses: docker/metadata-action@v4
45+
uses: docker/metadata-action@v5
4646
with:
4747
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4848

4949
- name: Build and push Docker image
50-
uses: docker/build-push-action@v4
50+
uses: docker/build-push-action@v5
5151
with:
5252
context: .
5353
push: true

.github/workflows/pre-commit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pre-commit
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
10+
jobs:
11+
check-code:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
# This action sets the current path to the root of your github repo
15+
- uses: actions/checkout@v4
16+
17+
- name: Install pre-commit
18+
run: python3 -m pip install pre-commit
19+
20+
- name: Run hooks
21+
run: pre-commit run --all
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Reproduce results
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
workflow_call:
13+
14+
15+
jobs:
16+
run:
17+
runs-on: ubuntu-22.04
18+
env:
19+
# Directory that will be published on github pages
20+
DATAPATH: ./artifacts/data/data.json
21+
FIGDIR: ./artifacts/figures
22+
RESULTDIR: ./artifacts/results
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: "3.10"
31+
32+
- name: Cache
33+
id: cache
34+
uses: actions/cache@v3
35+
with:
36+
path: |
37+
~/.cache/pip
38+
key: cache_v1
39+
restore-keys: |
40+
cache_v1
41+
42+
- name: Install dependencies
43+
run: python3 -m pip install -r requirements.txt
44+
45+
- name: Run pre-processing
46+
run: python3 code/pre_processing.py --datapath=${{ env.DATAPATH }}
47+
48+
- name: Run simulation
49+
run: python3 code/run_all.py --resultdir=${{ env.RESULTDIR }}
50+
51+
- name: Postprocess
52+
run: python3 code/postprocess.py --resultdir=${{ env.RESULTDIR }} --datapath=${{ env.DATAPATH }} --figdir=${{ env.FIGDIR }}
53+
54+
- name: Upload artifact
55+
if: always()
56+
uses: actions/upload-artifact@v3
57+
with:
58+
path: ./artifacts
59+
if-no-files-found: error

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
_build
12
code/results
2-
data/data.txt
3+
data/data.json
34
code/figures
5+
.DS_Store
46
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
57
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode
68

.pre-commit-config.yaml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.3.0
3+
rev: v4.5.0
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
88
- id: check-docstring-first
99
- id: debug-statements
1010
- id: requirements-txt-fixer
11+
- id: check-added-large-files
12+
- id: check-toml
1113

12-
- repo: https://github.com/asottile/reorder_python_imports
13-
rev: v3.8.3
14+
- repo: https://github.com/asottile/add-trailing-comma
15+
rev: v3.1.0
1416
hooks:
15-
- id: reorder-python-imports
17+
- id: add-trailing-comma
1618

1719
- repo: https://github.com/psf/black
18-
rev: 22.10.0
20+
rev: 23.10.1
1921
hooks:
2022
- id: black
2123

22-
- repo: https://github.com/pre-commit/pre-commit-hooks
23-
rev: v2.0.0
24+
- repo: https://github.com/charliermarsh/ruff-pre-commit
25+
# Ruff version.
26+
rev: 'v0.1.4'
2427
hooks:
25-
- id: flake8
28+
- id: ruff
2629

27-
- repo: https://github.com/asottile/add-trailing-comma
28-
rev: v2.3.0
29-
hooks:
30-
- id: add-trailing-comma
3130

3231
- repo: https://github.com/pre-commit/mirrors-mypy
33-
rev: v0.982
32+
rev: v1.6.1
3433
hooks:
3534
- id: mypy
3635

37-
- repo: https://github.com/asottile/pyupgrade
38-
rev: v3.1.0
36+
- repo: https://github.com/streetsidesoftware/cspell-cli
37+
rev: v7.3.2
3938
hooks:
40-
- id: pyupgrade
41-
args: [--py38-plus]
39+
- id: cspell
40+
files: docs/(.+).md|README.md

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
This repository contains supplementary code for the paper
55
> Finsberg, H., Dokken, J. 2022.
6-
> Title of paper, Journal of blabla, volume, page, url
6+
> Title of paper, Journal of ..., volume, page, url
77
88

99
## Abstract
1010
Provide the abstract of the paper
1111

1212
## Getting started
1313

14-
We provide a pre-build Docker image which can be used to run the the code in this repository. First thing you need to do is in ensure that you have [docker installed](https://docs.docker.com/get-docker/).
14+
We provide a pre-build Docker image which can be used to run the the code in this repository. First thing you need to do is to ensure that you have [docker installed](https://docs.docker.com/get-docker/).
1515

1616
To start an interactive docker container you can execute the following command
1717

0 commit comments

Comments
 (0)