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

Testing git nix workflow #363

Merged
merged 33 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b2ade7e
Testing git nix workflow
timlinux Dec 15, 2023
ea3bd77
Update nix-build.yml
timlinux Dec 15, 2023
c2fe94b
Update nix-build.yml
timlinux Dec 15, 2023
a92fad9
Update nix-build.yml
timlinux Dec 15, 2023
69fd3f5
Update nix-build.yml
timlinux Dec 15, 2023
ddac082
Update nix-build.yml
timlinux Dec 15, 2023
d7bc06d
Update nix-build.yml
timlinux Dec 15, 2023
917f34a
Merge branch 'develop' of github.com:inasafe/inasafe-doc into tim-nix
timlinux Dec 15, 2023
12ce156
Merge branch 'tim-nix' of github.com:inasafe/inasafe-doc into tim-nix
timlinux Dec 15, 2023
633ca08
Testing git nix workflow
timlinux Dec 16, 2023
1a1c129
Strip more stuff out for eng only build
timlinux Dec 16, 2023
a649156
Strip more stuff out for eng only build
timlinux Dec 16, 2023
0461759
Push to gh pages
timlinux Dec 16, 2023
80a695c
Push to gh pages
timlinux Dec 16, 2023
ec824a9
Push to gh pages
timlinux Dec 16, 2023
1c9b19f
Push to gh pages
timlinux Dec 16, 2023
428262b
Push to gh pages
timlinux Dec 16, 2023
d445a80
Push to gh pages
timlinux Dec 16, 2023
ea467e7
Push to gh pages
timlinux Dec 16, 2023
0617f97
Push to gh pages
timlinux Dec 16, 2023
a247b5d
Push to gh pages
timlinux Dec 16, 2023
25ed2b7
Added build and test gh workflows
timlinux Dec 16, 2023
de7fdd8
Added build and test gh workflows
timlinux Dec 16, 2023
f38c5c4
Fix gh pages path
timlinux Dec 16, 2023
e306da2
Fix gh pages push error
timlinux Dec 16, 2023
ce95d9a
Fix gh pages push error
timlinux Dec 16, 2023
37ba22d
Fix gh pages push error
timlinux Dec 16, 2023
6b73680
Trying to push docs with workflow
timlinux Dec 16, 2023
14f8fd4
Trying to push docs with workflow
timlinux Dec 16, 2023
16adffa
Trying to push docs with workflow
timlinux Dec 16, 2023
d4359c5
Updating build for Tharanath
timlinux Jan 3, 2024
bff4912
Update Dockerfile
timlinux Jan 3, 2024
8b0b4f0
Fix workflow
timlinux Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
49 changes: 49 additions & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 📖 Test Documentation
on:
pull_request:
push:
branches:
- main
- docs
- tim-nix
# Paths can be used to only trigger actions when you have edited certain files, such as a file within the /docs directory
paths:
- ".github/workflows/nix-build.yml"
- "docs/**"
# Allow manually running in the actions tab
workflow_dispatch:

jobs:
# Runs when we create or update a PR
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix-shell --run "./english_build.sh"
- run: |
mkdir /tmp/site
mv ./docs/output/html/en /tmp/site/en
cp -r deployment /tmp/site
cd /tmp/site
git init .
git add --all
git config --local user.email "[email protected]"
git config --local user.name "Test"
git commit -a -m "Update docs"
- uses: ad-m/github-push-action@master
with:
# Token for the repo
# Can be passed in using $\{{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# Destination branch to push changes
branch: gh-pages
# Use force push to fully overwrite the destination branch
force: true
# We have to push from the folder where files were generated.
# Same were the new repo was initialized in the previous step
directory: /tmp/site

93 changes: 5 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,17 @@ pip freeze
You should see a list of packages similar to those listed below:

```
pystac==1.9.0
python-dateutil==2.8.2
six==1.16.0
```


## Building the docs

We are now going to use that inasafe-doc directory as source and output directory for the
We are now going to use that inasafe-doc directory as source and output directory for the HTML


```
scripts/pre_translate.sh
scripts/post_translate.sh
```

You can also build the docs for a single language:

```
scripts/post_translate.sh en html
scripts/english_build.sh
```

## Viewing the docs
Expand All @@ -116,83 +107,9 @@ After building the docs, you can run a lightweight web server to view the
generated web pages:

```
httplz docs/output/html/
```


Translating the english InaSAFE Documentation
=============================================

Every language has it's own maintainer, please contact them,
if you want to help. You find a list of current language maintainers at the
end of this document. If your language is not listed, join our community by
sending a mail to <[email protected]> and ask for
help.

HowTo for language maintainers
------------------------------

* get an account on github.com
* install required tools on your computer
* login to github and create a fork of the inasafe-doc repository that other
translators can work with.

Translators now can create their own fork from the forked repository of the
maintainer, commit their translations to their own forked repository and send
pull request to the language maintainer's repository. Once the maintainer
receives a pull request, he should check the changes, accept the pull request
and merge the changes with the official inasafe-doc repository.

Workflow for adding a new language
----------------------------------

* add your locale code in the pre_translate.sh script in the line with 'LOCALE='
* run 'scripts/pre_translate.sh'. There will be a new directory in the i18n
directory for your language, containing the po-files for all source files
* create an empty(!) directory in the resources directory for your language. The
idea is to ONLY put images in exact the same directory structure if you
want an image to be 'translated'. As default the english one will be used
from the 'en' directory, and only if there is an translated one it will be
found and used.
* add your locale code in the post_translate.sh script in the line with
'LOCALE='

HowTo for translators
---------------------

* get an account on github.com
* install required tools on your computer
* login to github and create a fork of the inasafe-doc repository from your
language maintainer.
* git clone your forked inasafe-doc repository to your computer
* run './scripts/pre_translate.sh &lt;language&gt;' locally to build the
translation files
* translate the .po files locally and use an offline editor.
[QtLinguist](https://code.google.com/p/qtlinguistdownload/)
being the highly recommended choice.
* with the english documentation from ./docs/source/ run '
./scripts/post_translate.sh languagecode' locally again to check your
translation
* files translated need to be "synchronized" with the ones in the directory of
the forked repo. Commit your changes to your private forked repository and
create a pull request on github. It means that you send a request to the
owners of the repository you forked (language maintainer) asking him to
accept your translations and move them to the "original repository". For
doing that go on github.com, browse on the directory of your repository and
click pull request (https://help.github.com/articles/using-pull-requests).
* your language maintainer will take care that every significant translation go
into the master repository.
* Generally, as soon as you finish editing one or more .po files, you should
commit as soon as possible the edits to the git repository,
in order to minimize the possibility of conflicts.

The maintainer and translator should update and check the translations
regularly. Therefore you should 'git pull' when you start to work and run the
'scripts/pre_translate.sh &lt;language&gt;' and 'scripts/post_translate.sh
&lt;language&gt;' script after every significant change in the documentation.
This will generate and update the .po files needed for translations. If all
is fine, take care, that the translation go into the repository of your
language maintainer.
httplz docs/output/html/en/
```


[InaSAFEImage]: http://inasafe.org/en/_static/img/logo.png
[website]: http://inasafe.org/
6 changes: 4 additions & 2 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

rm -rf build i18n output source/api-docs source/user-docs/impact_functions_doc.rst
rm -rf .venv
rm -rf .direnv
rm -rf docs/build docs/i18n docs/output source/api-docs source/user-docs/impact_functions_doc.rst
touch default.nix
13 changes: 6 additions & 7 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ in pkgs.mkShell rec {
buildInputs = [
# A Python interpreter including the 'venv' module is required to bootstrap
# the environment.
pythonPackages.python
# This executes some shell code to initialize a venv in $venvDir before
# dropping into the shell
pythonPackages.venvShellHook
# By preference, install packages from nixpkgs first,
# falling back to requirements.txt if that is not possible
pythonPackages.python
pythonPackages.six
pythonPackages.jinja2
pythonPackages.markupsafe
Expand All @@ -24,16 +27,11 @@ in pkgs.mkShell rec {
pythonPackages.twitter

pinnedPkgs.sphinx
pinnedPkgs.transifex-client
pinnedPkgs.argparse
pinnedPkgs.rpl
pinnedPkgs.gettext
# Simple http server to test the built docs
pinnedPkgs.httplz

# This executes some shell code to initialize a venv in $venvDir before
# dropping into the shell
pythonPackages.venvShellHook
];

# Run this command, only after creating the virtual environment
Expand All @@ -42,8 +40,9 @@ in pkgs.mkShell rec {
pip install -r requirements.txt
'';

# Note!! Adding content to shellHook below will prevent requirements.txt
# being installed.
shellHook = ''
export LC_ALL=C
'';
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
Expand Down
10 changes: 10 additions & 0 deletions deployment/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM httpd:2.4.57-alpine3.18

#copy static folders and files
COPY en /usr/local/apache2/htdocs/

#copy apache config
#COPY ./httpd.conf /usr/local/apache2/conf/httpd.conf

#Expose port
EXPOSE 80
4 changes: 4 additions & 0 deletions deployment/image-index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
images:
- name: inasafe-docs
dockerfile: deployment/docker/Dockerfile
buildPath: .
23 changes: 0 additions & 23 deletions docs/i18n/en/LC_MESSAGES/contents.po

This file was deleted.

23 changes: 0 additions & 23 deletions docs/i18n/en/LC_MESSAGES/index.po

This file was deleted.

24 changes: 0 additions & 24 deletions docs/i18n/en/LC_MESSAGES/sphinx.po

This file was deleted.

Loading