Skip to content

Commit 2117d26

Browse files
authored
refactor: v3 (GH-158, GH-61) mkdocs-tacc theme, netlify deploys (#246)
## Overview - Support TACC theme properly. - Support live preview server for each PR. - Set version to `3.0.0`. ## Changes - #240 - #241 - #243 - #244 - #245
1 parent fea31fd commit 2117d26

File tree

772 files changed

+1141
-373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

772 files changed

+1141
-373
lines changed

.github/CODEOWNERS

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@
33
# architecture
44
/* @wesleyboar
55
/.github/ @wesleyboar
6-
/user-guide/themes @wesleyboar
76

87
# settings
9-
/user-guide/docs/index.md @wesleyboar
10-
/user-guide/mkdocs.yml @wesleyboar
8+
/user-guide/index.md @wesleyboar
9+
10+
# assets
11+
*.js @wesleyboar
12+
js/ @wesleyboar
13+
*.css @wesleyboar
14+
css/ @wesleyboar
1115

1216
# OpenSees
13-
/user-guide/docs/tools/simulation/opensees.md @silviamazzoni
14-
/user-guide/docs/tools/simulation/opensees/ @silviamazzoni
15-
/user-guide/docs/tools/simulation/openseesOld/ @silviamazzoni
17+
/user-guide/tools/simulation/opensees.md @silviamazzoni
18+
/user-guide/tools/simulation/opensees/ @silviamazzoni
19+
/user-guide/tools/simulation/openseesOld/ @silviamazzoni
1620

1721
# ADCIRC
18-
# /user-guide/docs/tools/simulation/adcirc.md @cdelcastillo21
19-
# /user-guide/docs/tools/simulation/adcirc/ @cdelcastillo21
22+
# /user-guide/tools/simulation/adcirc.md @cdelcastillo21
23+
# /user-guide/tools/simulation/adcirc/ @cdelcastillo21
2024

2125
# Arduino
22-
# /user-guide/docs/usecases/arduino/ @parduino
23-
24-
# static assets
25-
*.js @wesleyboar
26-
js/ @wesleyboar
27-
*.css @wesleyboar
28-
css/ @wesleyboar
26+
# /user-guide/usecases/arduino/ @parduino

.github/workflows/build-pprd.yml

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

.github/workflows/build-preview.yml

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

.github/workflows/build.yml

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: DS User Guide Builds
1+
name: Build and Push
22

33
on:
44
workflow_dispatch:
@@ -11,19 +11,23 @@ on:
1111
push:
1212
branches:
1313
- main
14+
- pprd
15+
- epic/v3
16+
- epic/v3--*
17+
- any/branch-you-want
1418

1519
jobs:
1620
docker:
1721
runs-on: ubuntu-latest
1822
steps:
19-
-
20-
name: Set up Docker Buildx
23+
24+
- name: Set up Docker Buildx
2125
uses: docker/setup-buildx-action@v2
22-
-
23-
name: Checkout repo
26+
27+
- name: Checkout repo
2428
uses: actions/checkout@v3
25-
-
26-
name: Get shortsha and branch name
29+
30+
- name: Get shortsha and branch name
2731
id: vars
2832
run: |
2933
if [ -z "$EVENT_SHA" ]; then SHORT_SHA=${GITHUB_SHA::8}; else SHORT_SHA=${EVENT_SHA::8}; fi
@@ -32,27 +36,44 @@ jobs:
3236
echo ::set-output name=ref_short::${SHORT_REF}
3337
env:
3438
EVENT_SHA: ${{ github.event.client_payload.sha }}
39+
40+
- name: Determine environment tag
41+
id: env_tag
42+
run: |
43+
if [ -n "${{ inputs.tag_custom }}" ]; then
44+
ENV_TAG="${{ inputs.tag_custom }}"
45+
elif [ "${{ github.ref_name }}" = "main" ]; then
46+
ENV_TAG="latest"
47+
elif [ "${{ github.ref_name }}" = "pprd" ]; then
48+
ENV_TAG="pprd"
49+
else
50+
ENV_TAG="${{ steps.vars.outputs.ref_short }}"
51+
fi
52+
echo ::set-output name=env_tag::${ENV_TAG}
53+
3554
- name: Print vars
3655
run: |
37-
echo $SHORT_SHA
38-
echo $SHORT_REF
56+
echo "Short SHA: $SHORT_SHA"
57+
echo "Short Ref: $SHORT_REF"
58+
echo "Environment Tag: $ENV_TAG"
3959
env:
4060
SHORT_SHA: ${{ steps.vars.outputs.sha_short }}
4161
SHORT_REF: ${{ steps.vars.outputs.ref_short }}
42-
-
43-
name: Login to Docker Hub
62+
ENV_TAG: ${{ steps.env_tag.outputs.env_tag }}
63+
64+
- name: Login to Docker Hub
4465
uses: docker/login-action@v2
4566
with:
4667
username: ${{ secrets.DOCKERHUB_USERNAME }}
4768
password: ${{ secrets.DOCKERHUB_TOKEN }}
48-
-
49-
name: Build and push
69+
70+
- name: Build and push
5071
uses: docker/build-push-action@v3
5172
with:
5273
push: true
53-
tags: designsafeci/ds-user-guide:${{ inputs.tag_custom && inputs.tag_custom || 'latest' }},designsafeci/ds-user-guide:${{ steps.vars.outputs.sha_short }},designsafeci/ds-user-guide:${{ steps.vars.outputs.ref_short }}
54-
-
55-
name: Post build status in slack
74+
tags: designsafeci/ds-user-guide:${{ steps.env_tag.outputs.env_tag }},designsafeci/ds-user-guide:${{ steps.vars.outputs.sha_short }},designsafeci/ds-user-guide:${{ steps.vars.outputs.ref_short }}
75+
76+
- name: Post build status in slack
5677
id: slack
5778
uses: slackapi/[email protected]
5879
with:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Humans should not manage requirements.txt (bots do)
2+
name: Validate requirements.txt not changed by human
3+
4+
on:
5+
pull_request:
6+
paths: ['requirements.txt']
7+
types: [opened, synchronize, reopened]
8+
9+
jobs:
10+
reject-requirements-drift:
11+
# To temporarily ignore epic/v3 branch, which introduces requirements.txt
12+
# TODO: Delete this after merging #246
13+
if: "!startsWith(github.head_ref, 'epic/')"
14+
15+
runs-on: ubuntu-latest
16+
17+
# Skip if the last commit was from the bot (prevent unnecessary check)
18+
if: github.event.head_commit.author.name != 'github-actions[bot]'
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0 # full history
25+
26+
- name: Check if requirements.txt was modified unexpectedly
27+
run: |
28+
# For PRs, check against base branch
29+
# For pushes, check last commit
30+
if [ "${{ github.event_name }}" = "pull_request" ]; then
31+
BASE_REF="${{ github.event.pull_request.base.sha }}"
32+
COMPARE_RANGE="$BASE_REF...HEAD"
33+
else
34+
COMPARE_RANGE="HEAD~1..HEAD"
35+
fi
36+
37+
# If requirements.txt modified in that range
38+
if git diff --name-only $COMPARE_RANGE | grep -q "^requirements.txt$"; then
39+
echo "::error::You may NOT edit 'requirements.txt'"
40+
echo "::warning::Undo your changes to requirements.txt, so robot can maintain it."
41+
echo "::notice::To pin dependencies, use 'poetry add <package-name>'."
42+
exit 1
43+
fi
44+
45+
echo "'requirements.txt' unchanged (or only changed by bot)"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Netlify requires requirements.txt (humans do not)
2+
name: Sync requirements.txt with pyproject.toml
3+
4+
on:
5+
pull_request:
6+
paths: ['pyproject.toml']
7+
types: [opened, synchronize, reopened]
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
detect-requirements-delta:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
has_change: ${{ steps.detect.outputs.has_change }}
17+
18+
# Skip if the last commit was from the bot (prevent infinite loops)
19+
if: github.event.head_commit.author.name != 'github-actions[bot]'
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.head_ref || github.ref_name }}
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version-file: 'pyproject.toml'
31+
32+
- name: Install Poetry
33+
run: pip install poetry
34+
35+
- name: Detect whether requirements.txt has change
36+
id: detect
37+
run: |
38+
output=$(make requirements.txt 2>&1)
39+
echo "$output"
40+
41+
# Check whether Make output suggests file is up to date
42+
if echo "$output" | grep -qi "up to date\|up-to-date\|already up to date"; then
43+
echo "has_change=false" >> $GITHUB_OUTPUT
44+
echo "::notice::requirements.txt seems up to date"
45+
else
46+
echo "has_change=true" >> $GITHUB_OUTPUT
47+
fi
48+
49+
commit-requirements-delta:
50+
runs-on: ubuntu-latest
51+
needs: detect-requirements-delta
52+
if: needs.detect-requirements-delta.outputs.has_change == 'true'
53+
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
with:
58+
ref: ${{ github.head_ref || github.ref_name }}
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version-file: 'pyproject.toml'
65+
66+
- name: Install Poetry
67+
run: pip install poetry
68+
69+
- name: Generate requirements.txt
70+
run: make requirements.txt
71+
72+
- name: Configure Git
73+
run: |
74+
git config user.name "github-actions[bot]"
75+
git config user.email "github-actions[bot]@users.noreply.github.com"
76+
77+
- name: Commit requirements.txt if changed
78+
run: |
79+
git add -f requirements.txt
80+
if git diff --staged --quiet; then
81+
echo "No changes to requirements.txt"
82+
else
83+
git commit -m "chore: auto-update requirements.txt [bot]"
84+
git push
85+
fi

.gitignore

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
# Ignore site
2-
user-guide/site/
1+
# build
2+
site/
33

4-
# TACC files
5-
mkdocs.base.yml
6-
poetry.lock
7-
pyproject.toml
8-
user-guide/docs/**/core
9-
user-guide/themes/tacc-readthedocs
10-
11-
# Temporary files
4+
# os
125
.DS_Store
136

14-
# Igonre pyenv
7+
# python
158
.python-version
9+
# python: only for Netlify, which does not support pyproject.toml yet
10+
requirements.txt
1611

17-
# Ignore user configs
12+
# ide
1813
.vs
1914
.vscode

0 commit comments

Comments
 (0)