Bump elasticsearch/elasticsearch from 7.17.28 to 9.2.0 #68
Workflow file for this run
This file contains hidden or 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
| # Build and publish a Docker image. | |
| name: Build and publish docker images | |
| on: | |
| push: | |
| branches: ["main"] | |
| # Publish semver tags as releases. | |
| tags: ["v*.*.*"] | |
| pull_request: | |
| branches: ["main"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| UV_VERSION: 0.6 | |
| PYTHON_VERSION: 3.12 | |
| # If you want to skip the tests for some plugins, add them to the list below | |
| PLUGIN_TESTS_PLUGINS_TO_SKIP: | | |
| workflowparsers | |
| nomad_porous_materials | |
| simulationworkflowschema | |
| databaseparsers | |
| soapnormalizer | |
| eelsdbparser | |
| atomisticparsers | |
| nomad_aitoolkit | |
| pynxtools_igor | |
| permissions: | |
| contents: write | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| jobs: | |
| # Job 1: Update Lock File | |
| update-lockfile: | |
| name: Update Python Lock File | |
| runs-on: ubuntu-latest | |
| outputs: | |
| scm_version: ${{ steps.get_scm_version.outputs.scm_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref || github.ref_name }} | |
| submodules: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Update lock file | |
| run: uv lock | |
| # Commits any changes made to the lockfile | |
| - name: Commit lock file changes | |
| run: | | |
| git config --global user.name github-actions | |
| git config --global user.email [email protected] | |
| git add uv.lock | |
| if [[ `git status --porcelain` ]]; then | |
| git commit -m "Update lockfile" | |
| git push origin -o ci.skip # prevent triggering the pipeline again | |
| fi | |
| - name: Get SCM Version | |
| id: get_scm_version | |
| run: | | |
| SCM_VERSION=$(uvx --with setuptools_scm python -m setuptools_scm) | |
| echo "SCM version: $SCM_VERSION" | |
| echo "scm_version=$SCM_VERSION" >> "$GITHUB_OUTPUT" | |
| # Job 2: Run unit tests for all of the plugin | |
| plugin_unit_tests: | |
| name: Run plugin unit tests | |
| needs: update-lockfile | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| group: [1, 2] | |
| env: | |
| PLUGIN_TESTS_CI_NODE_TOTAL: 2 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref || github.ref_name }} | |
| submodules: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Run plugin tests | |
| env: | |
| PLUGIN_TESTS_CI_NODE_INDEX: ${{ matrix.group }} | |
| run: | | |
| # replace the yaml list with a string, use a `,` to separate the plugins | |
| PLUGINS_STRING=$(echo "$PLUGIN_TESTS_PLUGINS_TO_SKIP" | tr '\n' ',' | sed 's/,$//') | |
| uv run \ | |
| --extra plugins \ | |
| --with "nomad-plugin-tests" \ | |
| nomad-plugin-tests --plugins-to-skip "$PLUGINS_STRING" | |
| # Job 3: Build and Push Docker Image | |
| build: | |
| name: Build Docker Image | |
| runs-on: ubuntu-latest | |
| needs: update-lockfile | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| service: [app, jupyter] | |
| env: | |
| SETUPTOOLS_SCM_PRETEND_VERSION_FOR_NOMAD_DISTRIBUTION: ${{ needs.update-lockfile.outputs.scm_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref || github.ref_name }} | |
| submodules: true | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }}${{ matrix.service == 'jupyter' && '/jupyter' || '' }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| build-args: | | |
| SETUPTOOLS_SCM_PRETEND_VERSION_FOR_NOMAD_DISTRIBUTION=${{ env.SETUPTOOLS_SCM_PRETEND_VERSION_FOR_NOMAD_DISTRIBUTION }} | |
| UV_VERSION=${{ env.UV_VERSION }} | |
| PYTHON_VERSION=${{ env.PYTHON_VERSION }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| target: ${{ matrix.service == 'jupyter' && 'jupyter' || 'final' }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Set APP_IMAGE for app service | |
| if: matrix.service == 'app' | |
| run: echo "APP_IMAGE=${{ steps.meta.outputs.tags }}" >> $GITHUB_ENV | |
| - name: Set JUPYTER_IMAGE for jupyter service | |
| if: matrix.service == 'jupyter' | |
| run: echo "JUPYTER_IMAGE=${{ steps.meta.outputs.tags }}" >> $GITHUB_ENV | |
| outputs: | |
| app_image: ${{ env.APP_IMAGE }} | |
| jupyter_image: ${{ env.JUPYTER_IMAGE }} | |
| # Job 4: Run example upload tests | |
| example_upload_tests: | |
| name: Run example upload tests | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| APP_IMAGE: ${{ needs.build.outputs.app_image }} | |
| JUPYTER_IMAGE: ${{ needs.build.outputs.jupyter_image }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref || github.ref_name }} | |
| submodules: true | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Start containers | |
| working-directory: tests | |
| run: | | |
| docker compose up -d --quiet-pull | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Health check | |
| run: | | |
| #!/bin/bash | |
| set -e # Exit immediately if a command exits with a non-zero status. | |
| secs=300 # Set interval (duration) in seconds. | |
| endTime=$(( $(date +%s) + secs )) # Calculate end time. | |
| check_app_health() { | |
| curl -s localhost:8000/-/health > /dev/null | |
| } | |
| check_jupyter_health() { | |
| curl -s localhost:8888/ > /dev/null | |
| } | |
| while [ $(date +%s) -lt $endTime ]; do # Loop until interval has elapsed. | |
| if check_app_health && check_jupyter_health; then | |
| echo "Both App and Jupyter health endpoints are responding correctly." | |
| exit 0 | |
| else | |
| echo "The App or Jupyter health endpoint is not responding. Retrying in 10 seconds..." | |
| sleep 10 | |
| fi | |
| done | |
| echo "Timeout reached. The App or Jupyter health endpoint did not respond within 5 minutes." | |
| echo "Fetching Docker logs for debugging..." | |
| docker logs app # Output logs from the app container | |
| docker logs jupyter # Output logs from the Jupyter container | |
| exit 1 | |
| - name: Run tests | |
| working-directory: tests | |
| run: | | |
| export PLUGINS_STRING=$(echo "$PLUGIN_TESTS_PLUGINS_TO_SKIP" | tr '\n' ',' | sed 's/,$//') | |
| uv run --extra plugins pytest -p no:warnings -sv |