diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0e499306..fc81554d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,20 +38,15 @@ jobs: - name: Gusto unit-tests run: | . /home/firedrake/firedrake/bin/activate - python $(which firedrake-clean) + which firedrake-clean python -m pytest -n 12 -v unit-tests - name: Gusto integration-tests run: | . /home/firedrake/firedrake/bin/activate - python $(which firedrake-clean) + firedrake-clean python -m pytest -n 12 -v integration-tests - name: Gusto examples run: | . /home/firedrake/firedrake/bin/activate - python $(which firedrake-clean) + firedrake-clean python -m pytest -n 12 -v examples - - name: Lint - if: ${{ always() }} - run: | - . /home/firedrake/firedrake/bin/activate - make lint diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..e6bec0821 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,57 @@ +name: Check docs build cleanly + +on: + # Run on pushes to master + push: + branches: + - master + # And all pull requests + pull_request: + +concurrency: + # Cancels jobs running if new commits are pushed + group: > + ${{ github.workflow }}- + ${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build_docs: + name: Run doc build + # The type of runner that the job will run on + runs-on: ubuntu-latest + # The docker container to use. + container: + image: firedrakeproject/firedrake-docdeps:latest + options: --user root + volumes: + - ${{ github.workspace }}:/home/firedrake/output + # Steps represent a sequence of tasks that will be executed as + # part of the jobs + steps: + - uses: actions/checkout@v3 + - name: Install checkedout Gusto + run: | + . /home/firedrake/firedrake/bin/activate + python -m pip install -e . + - name: Install Read the Docs theme + run: | + . /home/firedrake/firedrake/bin/activate + python -m pip install sphinx_rtd_theme + - name: Check documentation links + if: ${{ github.ref == 'refs/heads/master' }} + run: | + . /home/firedrake/firedrake/bin/activate + cd docs + make linkcheck + - name: Build docs + run: | + . /home/firedrake/firedrake/bin/activate + cd docs + make html + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + name: github-pages + path: /__w/gusto/gusto/docs/build/html + retention-days: 1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..8c29106e4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,40 @@ +name: Run lint + +on: + # Push to master or PR + push: + branches: + - master + pull_request: + +jobs: + linter: + name: "Run linter" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Setup flake8 annotations + uses: rbialon/flake8-annotations@v1 + - name: Install linter + run: | + pip install flake8 pylint + - name: Lint codebase + run: | + make lint GITHUB_ACTIONS_FORMATTING=1 + actionlint: + name: "Lint Github actions YAML files" + # There's a way to add error formatting so GH actions adds messages to code, + # but I can't work out the right number of quotes to get it to work + # https://github.com/rhysd/actionlint/blob/main/docs/usage.md + # #example-error-annotation-on-github-actions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check workflow files + uses: docker://rhysd/actionlint:latest + with: + args: -color diff --git a/Makefile b/Makefile index f077972cb..4ffd2902f 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,22 @@ +# Adds file annotations to Github Actions (only useful on CI) +GITHUB_ACTIONS_FORMATTING=0 +ifeq ($(GITHUB_ACTIONS_FORMATTING), 1) + FLAKE8_FORMAT=--format='::error file=%(path)s,line=%(row)d,col=%(col)d,title=%(code)s::%(path)s:%(row)d:%(col)d: %(code)s %(text)s' +else + FLAKE8_FORMAT= +endif + lint: @echo " Linting gusto codebase" - @python3 -m flake8 gusto + @python3 -m flake8 $(FLAKE8_FORMAT) gusto @echo " Linting gusto examples" - @python3 -m flake8 examples + @python3 -m flake8 $(FLAKE8_FORMAT) examples @echo " Linting gusto unit-tests" - @python3 -m flake8 unit-tests + @python3 -m flake8 $(FLAKE8_FORMAT) unit-tests @echo " Linting gusto integration-tests" - @python3 -m flake8 integration-tests + @python3 -m flake8 $(FLAKE8_FORMAT) integration-tests @echo " Linting gusto plotting scripts" - @python3 -m flake8 plotting + @python3 -m flake8 $(FLAKE8_FORMAT) plotting test: @echo " Running all tests" @@ -24,4 +32,4 @@ integration_test: example: @echo " Running all examples" - @python3 -m pytest examples $(PYTEST_ARGS) \ No newline at end of file + @python3 -m pytest examples $(PYTEST_ARGS) diff --git a/docs/source/conf.py b/docs/source/conf.py index 642702049..28a7e16a4 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -254,5 +254,5 @@ 'pyop2': ('https://op2.github.io/PyOP2', None), 'ufl': ('https://fenics.readthedocs.io/projects/ufl/en/latest/', None), 'h5py': ('http://docs.h5py.org/en/latest/', None), - 'python':('https://docs.python.org/2.7/', None), + 'python':('https://docs.python.org/', None), }