-
Notifications
You must be signed in to change notification settings - Fork 79
155 lines (129 loc) · 5.24 KB
/
build-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: docs
on:
push:
branches:
- master
schedule:
- cron: "00 12 * * 0" # Every Sunday noon (preserve the cache folders)
workflow_dispatch:
env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.8.2"
jobs:
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
# Update full Python version
- name: Full Python version
run: |
echo "PYTHON_VERSION=$(python -c "import platform; print(platform.python_version())")"
- name: Download extra data from private repository
uses: actions/checkout@v4
with:
repository: xoolive/traffic_data
token: ${{ secrets.PRIVATE_TOKEN }}
persist-credentials: false
path: ./traffic_data
- name: Create LFS file list (private repository)
working-directory: ./traffic_data
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
shell: bash
- name: Restore LFS cache (private repository)
uses: actions/cache@v4
id: lfs-cache
with:
path: ./traffic_data/.git/lfs
key: lfs-${{ hashFiles('./traffic_data/.lfs-assets-id') }}-v1
- name: Git LFS Pull (private repository)
working-directory: ./traffic_data
run: |
git remote set-url origin https://xoolive:${{ secrets.PRIVATE_TOKEN }}@github.com/xoolive/traffic_data.git
git lfs pull
unzip ENV_PostOPS_AIRAC_2111_04NOV2021_With_Airspace_Closure.zip -d airac_2111
shell: bash
# virtualenv cache should depends on OS, Python version and `poetry.lock` (and optionally workflow files).
- name: Cache Packages
uses: actions/cache@v4
with:
path: |
~/.local
.venv
key: poetry-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1.4.1
with:
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Display Python version
run: poetry run python -c "import sys; print(sys.version)"
- name: Cache folder for traffic
uses: actions/cache@v4
id: cache-folder
with:
path: |
~/.cache/traffic/
~/.cache/opensky/
~/.cache/cartes/
key: traffic-${{ hashFiles('poetry.lock') }}
- name: Cache folder for documentation
uses: actions/cache@v4
id: docs-folder
with:
path: |
docs/_build/
key: docs-${{ hashFiles('poetry.lock') }}
- name: Ubuntu system dependencies
run: |
sudo apt update
sudo apt install -y libgdal-dev libgeos-dev libproj-dev proj-bin proj-data libarchive-dev npm fonts-ubuntu
# Weird issue with libarchive-dev
sudo ln -s -f /usr/lib/x86_64-linux-gnu/libarchive.a /usr/lib/x86_64-linux-gnu/liblibarchive.a
- name: npm dependencies
run: |
npm install vega-lite vega-cli canvas # necessary dependency for altair-save
- name: Dynamic versioning
run: poetry self add "poetry-dynamic-versioning[plugin]" || true
- name: Install dependencies
run: |
poetry install -E full
# This should not be necessary... but sometimes it is
# https://traffic-viz.github.io/troubleshooting/installation.html
# SHAPELY_VERSION=$(poetry run python -c "import shapely; print(shapely.__version__)")
# poetry run pip uninstall -y shapely
# poetry run pip install --no-binary shapely shapely==${SHAPELY_VERSION}
- name: Build pages
env:
LD_LIBRARY_PATH: /usr/local/lib
OPENSKY_USERNAME: ${{ secrets.OPENSKY_USERNAME }}
OPENSKY_PASSWORD: ${{ secrets.OPENSKY_PASSWORD }}
# PKCS12_PASSWORD: ${{ secrets.PKCS12_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRAFFIC_NOPLUGIN: ""
TRAFFIC_CACHE_NO_EXPIRE: ""
run: |
# This downloads the cache for cartes atlas
poetry run python -c "from cartes.atlas import default, world_atlas"
# This downloads files to have in cache first
poetry run traffic cache --fill
export TRAFFIC_CONFIG=$(poetry run python -c "from traffic import config_file; print(config_file)")
sed -i "/tqdm_style =/ s,auto,silent," $TRAFFIC_CONFIG
sed -i "/nm_path =/ s,=$,= $PWD/traffic_data/airac_2111," $TRAFFIC_CONFIG
# sed -i "/pkcs12_filename =/ s,=.*$,= $PWD/traffic_data/CC0000007011_501_openssl.p12," $TRAFFIC_CONFIG
# sed -i "/pkcs12_password =/ s,=$,= $PKCS12_PASSWORD," $TRAFFIC_CONFIG
# Run the documentation
cd docs && CARTES_CACHE=./cache poetry run make html
- name: Deploy pages
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: traffic-viz/traffic-viz.github.io
publish_branch: master
publish_dir: docs/_build/html