forked from apache/airflow-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Undockerize local & CI site builds (apache#634)
- Loading branch information
Showing
6 changed files
with
210 additions
and
868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,11 +36,18 @@ jobs: | |
uses: actions/setup-python@41b7212b1668f5de9d65e9c82aa777e6bbedb3a8 # v2.1.4 | ||
with: | ||
python-version: '3.6' | ||
- name: 🐳 Build Docker image | ||
run: ./site.sh build-image | ||
- name: 🟢 Install node depedencies | ||
- name: ❤️ Install Node 16 | ||
uses: actions/[email protected] # v3.3.0 | ||
with: | ||
node-version: 16 | ||
- name: 📚 Install Hugo | ||
uses: peaceiris/[email protected] # v2.4.13 | ||
with: | ||
hugo-version: '0.91.2' | ||
extended: true | ||
- name: 🟢 Install node dependencies | ||
run: ./site.sh install-node-deps | ||
- name: 🐍 Install Python depedencies | ||
- name: 🐍 Install Python dependencies | ||
run: pip install -r requirements.txt | ||
- name: 🔎 Lint | ||
uses: apache/airflow-pre-commit-action@0764670bf370aab253130d534e1eda7ff497dc60 # v2.0.0 | ||
|
@@ -61,7 +68,7 @@ jobs: | |
path: './dist' | ||
if-no-files-found: error | ||
retention-days: 14 | ||
- name: 👷🏻 Copy .asf.yaml to /dist/ | ||
- name: 👷 Copy .asf.yaml to /dist/ | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
# The asf.yaml file must be in the branch from which the files are published. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,9 @@ be done by the site.sh script | |
The following applications must be installed to use the project: | ||
|
||
* git | ||
* docker | ||
* docker (for the shell language linter) | ||
* Node 16 | ||
* Hugo | ||
|
||
It is also worth adding SSH keys for the `github.com` server to trusted ones. It is necessary to clone repositories. You can do this using following command: | ||
```bash | ||
|
@@ -91,6 +93,37 @@ git config --global user.email '<[email protected]>' | |
git config --global user.name '<you name>' | ||
``` | ||
|
||
To install Node 16, first install the [Node version manager](https://github.com/nvm-sh/nvm), `nvm`. Then, install Node 16 with these commands: | ||
|
||
```bash | ||
nvm install 16 | ||
nvm use 16 | ||
``` | ||
|
||
To install hugo on Debian, run the following command: | ||
```bash | ||
sudo apt install hugo -y | ||
``` | ||
|
||
**macOS installation** | ||
|
||
To install git on macOS, install the XCode Command Line Tools with the following command: | ||
```bash | ||
xcode-select --install | ||
``` | ||
|
||
Then, install [Homebrew](https://brew.sh). Once that has completed, you can install Hugo: | ||
```bash | ||
brew install hugo | ||
``` | ||
|
||
To install Node 16, first install the [Node version manager](https://github.com/nvm-sh/nvm), `nvm`. Then, install Node 16 with these commands: | ||
|
||
```bash | ||
nvm install 16 | ||
nvm use 16 | ||
``` | ||
|
||
### Static checks | ||
|
||
The project uses many static checks using fantastic [pre-commit](https://pre-commit.com/). Every change is checked on CI and if it does not pass the tests it cannot be accepted. If you want to check locally then you should install Python3.6 or newer together with pip and run following command to install pre-commit: | ||
|
@@ -127,23 +160,18 @@ git submodule update --init --recursive | |
|
||
### Use `site.sh` script | ||
|
||
In order to run an environment for the project, make sure that you have Docker installed. Then, use the `site.sh` | ||
script to work with the website in a Docker container. | ||
In order to manage your local environment for the project, use the `site.sh` script. | ||
|
||
`site.sh` provides the following commands. | ||
|
||
build-site Prepare dist directory with landing pages and documentation | ||
preview-landing-pages Starts the web server with preview of the website | ||
build-landing-pages Builds a landing pages | ||
prepare-theme Prepares and copies files needed for the proper functioning of the sphinx theme. | ||
shell Start shell | ||
build-image Build a Docker image with a environment | ||
install-node-deps Download all the Node dependencies | ||
check-site-links Checks if the links are correct in the website | ||
lint-css Lint CSS files | ||
lint-js Lint Javascript files | ||
cleanup Delete the virtual environment in Docker | ||
stop Stop the environment | ||
help Display usage | ||
|
||
### How to add a new blogpost | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python | ||
|
||
import json | ||
import sys | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.