Reformat Python code so it would pass linting checks in moz-central. #1429
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
name: Build and Deploy Documentation | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-md-books: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up repository and install Rust | |
run: | | |
echo `env` | |
echo 'rust.targets=linux-x86-64' > local.properties | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
source $HOME/.cargo/env | |
- name: Build Dependencies | |
env: | |
NSS_DIR: ${{ github.workspace }}/libs/desktop/linux-x86-64/nss | |
NSS_STATIC: 1 | |
run: | | |
git clone https://chromium.googlesource.com/external/gyp.git tools/gyp | |
cd tools/gyp | |
sudo python setup.py install | |
cd ../.. | |
sudo apt-get install ninja-build zlib1g-dev tclsh python3 | |
./libs/verify-desktop-environment.sh | |
- name: Build mdbook | |
env: | |
NSS_DIR: ${{ github.workspace }}/libs/desktop/linux-x86-64/nss | |
NSS_STATIC: 1 | |
run: | | |
cargo install mdbook mdbook-mermaid mdbook-open-on-gh | |
./tools/build-book.sh | |
- name: Upload docs artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs-ubuntu-latest | |
path: "build/docs" | |
build-swift-docs: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.3" | |
- name: Install Jazzy | |
run: gem install jazzy | |
- name: Install xcpretty | |
run: | | |
sudo gem install xcpretty | |
- name: Build Dependencies | |
env: | |
NSS_DIR: ${{ github.workspace }}/libs/desktop/darwin-aarch64/nss | |
NSS_STATIC: 1 | |
run: | | |
# Install virtual environment and setuptools + six | |
python3 -m venv venv | |
source venv/bin/activate | |
python3 -m pip install --upgrade pip setuptools six | |
# Clone the gyp repository | |
git clone https://chromium.googlesource.com/external/gyp.git tools/gyp | |
# Navigate to gyp directory and install it | |
cd tools/gyp | |
python3 setup.py install | |
cd ../.. | |
# Install the required dependencies on macOS (replace tcl with tcl-tk) | |
brew install ninja zlib tcl-tk python | |
# Ensure the environment for desktop is correctly set up | |
# NSS for desktop has to be setup to build megazord | |
./libs/verify-desktop-environment.sh | |
- name: Build Swift docs | |
env: | |
NSS_DIR: ${{ github.workspace }}/libs/desktop/darwin-aarch64/nss | |
NSS_STATIC: 1 | |
run: | | |
cd ./automation/swift-components-docs | |
./build.sh | |
- name: Upload docs artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs-macos-latest | |
path: "automation/swift-components-docs/docs" | |
build-kotlin-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
- name: Manual Android SDK Setup | |
env: | |
ANDROID_HOME: ${{ runner.temp }}/android-sdk | |
run: | | |
mkdir -p $ANDROID_HOME | |
# Download command-line tools | |
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip | |
unzip commandlinetools-linux-9477386_latest.zip -d $ANDROID_HOME/cmdline-tools | |
mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest | |
# Add environment variables | |
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV | |
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH | |
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH | |
# Accept licenses | |
set +e | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses || true | |
set -e | |
# Install SDK platforms and build tools | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=${ANDROID_HOME} "platforms;android-35" "build-tools;35.0.0" | |
# Verify installation | |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=${ANDROID_HOME} --list | grep "build-tools;35.0.0" | |
- name: Install Command-line tools | |
run: | | |
sdkmanager --install "cmdline-tools;latest" | |
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV | |
echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV | |
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH | |
- name: Install Android NDK | |
run: | | |
sdkmanager --install "ndk;27.0.12077973" | |
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/27.0.12077973" >> $GITHUB_ENV | |
echo "$ANDROID_NDK_HOME" >> $GITHUB_PATH | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Build Dependencies | |
env: | |
NSS_DIR: ${{ github.workspace }}/libs/desktop/linux-x86-64/nss | |
NSS_STATIC: 1 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libclang-dev tcl ninja-build | |
python3 -m venv venv | |
source venv/bin/activate | |
python3 -m pip install --upgrade pip setuptools six | |
# Clone the gyp repository | |
git clone https://chromium.googlesource.com/external/gyp.git tools/gyp | |
# Navigate to gyp directory and install it | |
cd tools/gyp | |
python3 setup.py install | |
cd ../.. | |
# Ensure the environment for desktop is correctly set up | |
# NSS for desktop has to be setup to build megazord | |
./libs/verify-desktop-environment.sh | |
- name: Build Kotlin docs | |
env: | |
NSS_DIR: ${{ github.workspace }}/libs/desktop/linux-x86-64/nss | |
NSS_STATIC: 1 | |
run: | | |
cd ./automation/kotlin-components-docs | |
chmod +x ./generate_docs.sh | |
./generate_docs.sh | |
- name: Upload docs artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kotlin-docs | |
path: "automation/kotlin-components-docs/build/dokka" | |
deploy-docs: | |
needs: [build-md-books, build-swift-docs, build-kotlin-docs] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
- name: Prepare documentation | |
run: | | |
mkdir -p gh-pages | |
mv docs-ubuntu-latest/* gh-pages/ | |
mkdir -p gh-pages/swift | |
mv docs-macos-latest/* gh-pages/swift/ | |
mkdir -p gh-pages/kotlin | |
mv kotlin-docs/* gh-pages/kotlin/ | |
- name: Deploy to GitHub Pages | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git checkout --orphan gh-pages | |
git rm -rf . | |
mv gh-pages/* . | |
git add . | |
git commit -m "Deploy documentation" | |
git push origin gh-pages --force |