From 6cea763f73342e95417069a519084668e966480f Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sat, 31 May 2025 16:15:50 -0400 Subject: [PATCH] Add CI workflow and offline-aware startup --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ startup.sh | 6 +++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e51135e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Cache wheelhouse + uses: actions/cache@v4 + with: + path: wheelhouse + key: wheelhouse-${{ runner.os }}-${{ hashFiles('wheelhouse/*.whl') }} + restore-keys: | + wheelhouse-${{ runner.os }}- + + - name: Install pytest + run: pip install pytest + + - name: Run tests + env: + PIP_FIND_LINKS: wheelhouse + run: | + chmod +x startup.sh + ./startup.sh pytest -q diff --git a/startup.sh b/startup.sh index b0e79dc..700d626 100755 --- a/startup.sh +++ b/startup.sh @@ -16,7 +16,11 @@ DEFAULT_MODULE="scripts.lagged_oil_unrate_chart_styled" # 1) Ensure pip & setuptools are up to date echo "🛠 Upgrading pip & setuptools…" -pip install --upgrade pip setuptools +if [[ "${PIP_NO_INDEX:-}" == "1" ]]; then + echo "🔒 Offline mode detected; skipping upgrade" +else + pip install --upgrade pip setuptools +fi # 2) Install project dependencies globally echo "📦 Installing dependencies from $REQ_FILE…"