Skip to content

Commit 6b74b8f

Browse files
committed
fix(ci): Resolve installation hangs and update deployment logic
This commit addresses several issues across the `notebook-test` and `docs` CI/CD workflows to improve reliability, efficiency, and compatibility with different environments (Gitea, GitHub Actions, local `act`). Key changes: 1. **Resolves `apt-get` Hangs and `pip` Errors:** * Adds `DEBIAN_FRONTEND=noninteractive` to all `apt-get install` commands. This prevents the workflows from hanging on interactive prompts from packages like `tzdata`. * Uses `pip install --ignore-installed` when upgrading `pip`, `setuptools`, and `wheel`. This fixes the `uninstall-no-record-file` error by preventing `pip` from attempting to uninstall packages managed by the system's package manager. * Consolidates multiple `apt-get` steps in `notebook-test.yml` into a single, more efficient step. 2. **Updates Gitea Documentation Deployment:** * The deployment path for Gitea is updated to `/pages/docs/${{ github.event.repository.name }}` to align with the new server configuration, which serves docs from a subfolder. * Adds a step to extract the `artifact.tar` created by `actions/upload-pages-artifact` before deploying the contents. 3. **Improves Local `act` Runner Compatibility:** * The `docs` workflow now skips the `upload-pages-artifact` and `deploy-pages` steps when running locally via `act` (`if: ${{ !env.ACT }}`). This prevents failures caused by the absence of GitHub-specific environment variables like `ACTIONS_RUNTIME_TOKEN`.
1 parent 2190402 commit 6b74b8f

2 files changed

Lines changed: 37 additions & 43 deletions

File tree

.github/workflows/docs.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ jobs:
3131
# Use CPU-only PyTorch to save disk space
3232
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
3333
TORCH_CPU_ONLY: "true"
34-
34+
3535
steps:
3636
- name: Checkout repository
3737
uses: actions/checkout@v4
3838

3939
# Install Act dependencies FIRST (before any apt-get commands)
40-
- name: Install Act dependencies
41-
if: ${{ env.ACT }}
42-
run: |
40+
- name: Install Act dependencies
41+
if: ${{ env.ACT }}
42+
run: |
4343
# Ensure apt-get is available and install sudo for 'act' environments
4444
if ! command -v apt-get &> /dev/null; then
4545
echo "apt-get not found, cannot proceed"
@@ -53,8 +53,8 @@ jobs:
5353
run: |
5454
sudo apt-get update
5555
# Install lsb-release, Node.js, and ca-certificates all at once
56-
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y lsb-release nodejs ca-certificates
57-
56+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lsb-release nodejs ca-certificates
57+
5858
# Trust your mounted certificate (from the act command)
5959
sudo update-ca-certificates
6060
@@ -78,6 +78,7 @@ jobs:
7878
run: sphinx-build -b html docs/source docs/build
7979

8080
- name: Upload artifact
81+
if: ${{ !env.ACT }}
8182
uses: actions/upload-pages-artifact@v3
8283
with:
8384
path: ./docs/build
@@ -92,21 +93,22 @@ jobs:
9293
runs-on: ubuntu-latest
9394
env:
9495
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
95-
96+
9697
steps:
97-
- name: Install Act dependencies
98-
if: ${{ env.ACT }}
99-
run: |
98+
- name: Install Act dependencies
99+
if: ${{ env.ACT }}
100+
run: |
100101
apt-get update && apt-get install -y sudo
101102
102103
- name: Install Runner Dependencies & Configure CA
103104
run: |
104105
sudo apt-get update
105-
sudo apt-get install -y nodejs ca-certificates
106+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs ca-certificates
106107
sudo update-ca-certificates
107-
108+
108109
- name: Deploy to GitHub Pages
109110
id: deployment
111+
if: ${{ !env.ACT }}
110112
uses: actions/deploy-pages@v4
111113

112114
# Deploy job for Gitea
@@ -118,15 +120,15 @@ jobs:
118120
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
119121

120122
steps:
121-
- name: Install Act dependencies
122-
if: ${{ env.ACT }}
123-
run: |
123+
- name: Install Act dependencies
124+
if: ${{ env.ACT }}
125+
run: |
124126
apt-get update && apt-get install -y sudo
125127
126128
- name: Install Runner Dependencies & Configure CA
127129
run: |
128130
sudo apt-get update
129-
sudo apt-get install -y nodejs ca-certificates
131+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs ca-certificates
130132
sudo update-ca-certificates
131133
132134
- name: Download artifact
@@ -138,6 +140,12 @@ jobs:
138140
- name: Deploy to Gitea docs location
139141
run: |
140142
echo "Deploying documentation to Gitea's special directory..."
143+
# Extract the artifact.tar (created by upload-pages-artifact)
144+
tar -xf ./docs-site/artifact.tar -C ./docs-site
145+
rm ./docs-site/artifact.tar
146+
141147
# The '/pages' directory is a mounted volume on the Gitea runner for serving static content.
142-
sudo mkdir -p /pages/
143-
sudo cp -r ./docs-site/* /pages/
148+
# Deploy to a subfolder named after the repository
149+
TARGET_DIR="/pages/docs/${{ github.event.repository.name }}"
150+
sudo mkdir -p "$TARGET_DIR"
151+
sudo cp -r ./docs-site/* "$TARGET_DIR/"

.github/workflows/notebook-test.yml

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,38 +51,24 @@ jobs:
5151
# This trusts your mounted certificate (from the act command)
5252
sudo update-ca-certificates
5353
54-
- name: Install ping utility
54+
- name: Install System Dependencies
5555
run: |
5656
sudo apt-get update
57-
sudo apt-get install -y iputils-ping
58-
59-
- name: Set timezone to UTC
60-
run: |
57+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
58+
iputils-ping \
59+
tzdata \
60+
libgomp1 \
61+
default-jre \
62+
build-essential
63+
# Set timezone after installing tzdata
6164
sudo ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime
6265
echo "Etc/UTC" | sudo tee /etc/timezone
63-
sudo apt-get update
64-
sudo apt-get install -y tzdata
6566
sudo dpkg-reconfigure -f noninteractive tzdata
6667
67-
- name: Install libgomp1 for LightGBM
68-
run: |
69-
sudo apt-get update
70-
sudo apt-get install -y libgomp1
71-
72-
- name: Install Java for H2O
73-
run: |
74-
sudo apt-get update
75-
sudo apt-get install -y default-jre
76-
77-
- name: Install build dependencies
78-
run: |
79-
sudo apt-get update
80-
sudo apt-get install -y build-essential
81-
8268
- name: Install Python 3.12 and Git
8369
run: |
8470
sudo apt-get update
85-
sudo apt-get install -y lsb-release software-properties-common gnupg curl git
71+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lsb-release software-properties-common gnupg curl git
8672
8773
# --- THIS IS THE GPG KEY FIX ---
8874
@@ -93,7 +79,7 @@ jobs:
9379
echo "deb [signed-by=/usr/share/keyrings/deadsnakes-archive-keyring.gpg] http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/deadsnakes-ppa.list
9480
9581
sudo apt-get update
96-
sudo apt-get install -y python3.12 python3.12-venv python3.12-dev
82+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3.12 python3.12-venv python3.12-dev
9783
9884
# Install pip for Python 3.12 (force reinstall to avoid Debian package conflicts)
9985
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3.12 - --break-system-packages --ignore-installed
@@ -107,7 +93,7 @@ jobs:
10793
run: |
10894
cd $GITHUB_WORKSPACE
10995
chmod +x install.sh
110-
sudo python -m pip install --upgrade pip setuptools wheel --break-system-packages
96+
sudo python -m pip install --upgrade --ignore-installed pip setuptools wheel --break-system-packages
11197
# The install.sh will use PIP_EXTRA_INDEX_URL if set for CPU-only PyTorch
11298
./install.sh
11399

0 commit comments

Comments
 (0)