From 8f5296e8c736248189af3904d079e4d1f6df7184 Mon Sep 17 00:00:00 2001 From: Ivan Gabaldon Date: Sun, 4 May 2025 22:04:14 +0200 Subject: [PATCH] refactor integration.yml --- .github/workflows/container.yml | 8 +- .github/workflows/data-update.yml | 2 +- .github/workflows/integration.yml | 131 ++++++++++++++++-------------- Makefile | 3 +- 4 files changed, 75 insertions(+), 69 deletions(-) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index b273d3d5c..818d2bc6b 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -8,9 +8,9 @@ on: - Integration types: - completed -# TODO: Uncomment -# branches: -# - master + # TODO: Test container.yml on merge https://github.com/searxng/searxng/pull/4699 + branches: + - master permissions: contents: read @@ -55,7 +55,7 @@ jobs: with: key: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-${{ hashFiles('./requirements*.txt') }}" restore-keys: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-" - path: "./local" + path: "./local/" - name: Setup cache container mounts uses: actions/cache@v4 diff --git a/.github/workflows/data-update.yml b/.github/workflows/data-update.yml index 2d748ec5d..9665064ab 100644 --- a/.github/workflows/data-update.yml +++ b/.github/workflows/data-update.yml @@ -46,7 +46,7 @@ jobs: with: key: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-${{ hashFiles('./requirements*.txt') }}" restore-keys: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-" - path: "./local" + path: "./local/" - name: Setup venv run: make V=1 install diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b0170d794..d32a4fe96 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,3 +1,4 @@ +--- name: Integration # yamllint disable-line rule:truthy @@ -13,8 +14,11 @@ on: permissions: contents: read +env: + PYTHON_VERSION: "3.13" + jobs: - python: + test: # TODO: Remove this if: false name: Python ${{ matrix.python-version }} @@ -29,139 +33,140 @@ jobs: - "3.13" steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "${{ matrix.python-version }}" + - name: Checkout uses: actions/checkout@v4 with: persist-credentials: "false" - - name: Install Ubuntu packages - run: sudo ./utils/searxng.sh install packages - - - name: Set up Python - uses: actions/setup-python@v5 + - name: Setup cache Python + uses: actions/cache@v4 with: - python-version: "${{ matrix.python-version }}" + key: "python-${{ matrix.python-version }}-${{ runner.arch }}-${{ hashFiles('./requirements*.txt') }}" + restore-keys: "python-${{ matrix.python-version }}-${{ runner.arch }}-" + path: "./local/" + + - name: Setup venv + run: make V=1 install - name: Run tests run: make V=1 ci.test - themes: + theme: # TODO: Remove this if: false - name: Themes - runs-on: ubuntu-24.04 + name: Theme + runs-on: ubuntu-24.04-arm steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: "false" - - name: Install Ubuntu packages - run: sudo ./utils/searxng.sh install buildhost - - - name: Set up Python - uses: actions/setup-python@v5 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - python-version: "3.13" + node-version-file: "./.nvmrc" - - name: Build themes + - name: Setup cache Node.js + uses: actions/cache@v4 + with: + key: "nodejs-${{ runner.arch }}-${{ hashFiles('./.nvmrc', './package.json') }}" + path: "./client/simple/node_modules/" + + - name: Build run: make themes.all documentation: # TODO: Remove this if: false name: Documentation - runs-on: ubuntu-24.04 + runs-on: ubuntu-24.04-arm permissions: # for JamesIves/github-pages-deploy-action to push contents: write steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "${{ env.PYTHON_VERSION }}" + - name: Checkout uses: actions/checkout@v4 with: persist-credentials: "false" fetch-depth: "0" - - name: Install Ubuntu packages - run: sudo ./utils/searxng.sh install buildhost - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Cache Python dependencies - id: cache-python + - name: Setup cache Python uses: actions/cache@v4 with: - path: | - ./local - ./.nvm - ./node_modules - key: python-ubuntu-24.04-3.13-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }} + key: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-${{ hashFiles('./requirements*.txt') }}" + restore-keys: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-" + path: "./local/" + + - name: Setup venv + run: make V=1 install - name: Build documentation run: make V=1 docs.clean docs.html - if: github.ref == 'refs/heads/master' name: Deploy - uses: JamesIves/github-pages-deploy-action@3.7.1 + uses: JamesIves/github-pages-deploy-action@v4 with: - GITHUB_TOKEN: "${{ github.token }}" - BRANCH: "gh-pages" - FOLDER: "dist/docs" + folder: "dist/docs" + branch: "gh-pages" + commit-message: "[doc] build from commit ${{ github.sha }}" # Automatically remove deleted files from the deploy branch - CLEAN: "true" - SINGLE_COMMIT: "true" - COMMIT_MESSAGE: "[doc] build from commit ${{ github.sha }}" + clean: "true" + single-commit: "true" babel: - # TODO: Remove this - if: false - # if: github.repository_owner == 'searxng' && github.ref == 'refs/heads/master' + if: github.repository_owner == 'searxng' && github.ref == 'refs/heads/master' name: Update translations branch - runs-on: ubuntu-24.04 + runs-on: ubuntu-24.04-arm needs: - - python - - themes + - test + - theme - documentation permissions: - # for make V=1 weblate.push.translations + # For "make V=1 weblate.push.translations" contents: write steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "${{ env.PYTHON_VERSION }}" + - name: Checkout uses: actions/checkout@v4 with: token: "${{ secrets.WEBLATE_GITHUB_TOKEN }}" fetch-depth: "0" - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Cache Python dependencies - id: cache-python + - name: Setup cache Python uses: actions/cache@v4 with: - path: | - ./local - ./.nvm - ./node_modules - key: python-ubuntu-20.04-3.13-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }} + key: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-${{ hashFiles('./requirements*.txt') }}" + restore-keys: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-" + path: "./local/" + + - name: Setup venv + run: make V=1 install - name: weblate & git setup - env: - WEBLATE_CONFIG: "${{ secrets.WEBLATE_CONFIG }}" run: | mkdir -p ~/.config - echo "${WEBLATE_CONFIG}" > ~/.config/weblate + echo "${{ secrets.WEBLATE_CONFIG }}" > ~/.config/weblate git config --global user.email "searxng-bot@users.noreply.github.com" git config --global user.name "searxng-bot" - name: Update transations - id: update run: make V=1 weblate.push.translations diff --git a/Makefile b/Makefile index d7ac9eb09..977143582 100644 --- a/Makefile +++ b/Makefile @@ -100,5 +100,6 @@ $(MANAGE): PHONY += docs docker themes docs: docs.html -docker: docker.build +container: container.build +docker: container.build themes: themes.all