From c1a0ea233930a32b6a3fd69d5eb9a6f906c3269c Mon Sep 17 00:00:00 2001 From: RoyalOughtness <129108030+RoyalOughtness@users.noreply.github.com> Date: Mon, 18 Aug 2025 17:33:27 -0700 Subject: [PATCH] fixes --- .github/workflows/buildx.yml | 19 +++++++++--------- .github/workflows/docker_main.yml | 31 +++++++++++++++--------------- .github/workflows/docker_tests.yml | 31 +++++++++++++++--------------- .github/workflows/pypi.yml | 23 +++++++++++++++------- .github/workflows/scan.yml | 22 +++++++++++---------- .github/workflows/tests.yml | 9 ++++++--- 6 files changed, 76 insertions(+), 59 deletions(-) diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index 94a238e..1929afe 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -12,24 +12,24 @@ on: jobs: on-success: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Wait for tests to succeed if: ${{ github.event.workflow_run.conclusion != 'success' && startsWith(github.ref, 'refs/tags') != true }} run: exit 1 - - name: checkout code - uses: actions/checkout@v2 - - name: install buildx - id: buildx - uses: crazy-max/ghaction-docker-buildx@v1 - with: - version: latest + + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 + - name: Login to ghcr.io - uses: docker/login-action@v1 + uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: build and push the image if: startsWith(github.ref, 'refs/heads/live') && github.actor == 'royaloughtness' run: | @@ -41,6 +41,7 @@ jobs: docker buildx build --push \ --tag ghcr.io/royaloughtness/whoogle-search:latest \ --platform linux/amd64,linux/arm64 . + - name: build and push tag if: startsWith(github.ref, 'refs/tags') run: | diff --git a/.github/workflows/docker_main.yml b/.github/workflows/docker_main.yml index 43824e5..d171f0b 100644 --- a/.github/workflows/docker_main.yml +++ b/.github/workflows/docker_main.yml @@ -10,19 +10,20 @@ on: # TODO: Needs refactoring to use reusable workflows and share w/ docker_tests jobs: on-success: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - name: checkout code - uses: actions/checkout@v2 - - name: build and test (docker) - run: | - docker build --tag whoogle-search:test . - docker run --publish 5000:5000 --detach --name whoogle-search-nocompose whoogle-search:test - sleep 15 - docker exec whoogle-search-nocompose curl -f http://localhost:5000/healthz || exit 1 - - name: build and test (docker-compose) - run: | - docker rm -f whoogle-search-nocompose - WHOOGLE_IMAGE="whoogle-search:test" docker compose up --detach - sleep 15 - docker exec whoogle-search curl -f http://localhost:5000/healthz || exit 1 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: build and test (docker) + run: | + docker build --tag whoogle-search:test . + docker run --publish 5000:5000 --detach --name whoogle-search-nocompose whoogle-search:test + sleep 15 + docker exec whoogle-search-nocompose curl -f http://localhost:5000/healthz || exit 1 + + - name: build and test (docker-compose) + run: | + docker rm -f whoogle-search-nocompose + WHOOGLE_IMAGE="whoogle-search:test" docker compose up --detach + sleep 15 + docker exec whoogle-search curl -f http://localhost:5000/healthz || exit 1 diff --git a/.github/workflows/docker_tests.yml b/.github/workflows/docker_tests.yml index 414c364..ac5e50f 100644 --- a/.github/workflows/docker_tests.yml +++ b/.github/workflows/docker_tests.yml @@ -8,19 +8,20 @@ on: jobs: docker: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - name: checkout code - uses: actions/checkout@v2 - - name: build and test (docker) - run: | - docker build --tag whoogle-search:test . - docker run --publish 5000:5000 --detach --name whoogle-search-nocompose whoogle-search:test - sleep 15 - docker exec whoogle-search-nocompose curl -f http://localhost:5000/healthz || exit 1 - - name: build and test (docker compose) - run: | - docker rm -f whoogle-search-nocompose - WHOOGLE_IMAGE="whoogle-search:test" docker compose up --detach - sleep 15 - docker exec whoogle-search curl -f http://localhost:5000/healthz || exit 1 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: build and test (docker) + run: | + docker build --tag whoogle-search:test . + docker run --publish 5000:5000 --detach --name whoogle-search-nocompose whoogle-search:test + sleep 15 + docker exec whoogle-search-nocompose curl -f http://localhost:5000/healthz || exit 1 + + - name: build and test (docker compose) + run: | + docker rm -f whoogle-search-nocompose + WHOOGLE_IMAGE="whoogle-search:test" docker compose up --detach + sleep 15 + docker exec whoogle-search curl -f http://localhost:5000/healthz || exit 1 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 3bb8d6b..f6021f6 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -8,13 +8,15 @@ on: jobs: publish-test: name: Build and publish to TestPyPI - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up Python 3.9 - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: 3.9 + - name: Install pypa/build run: >- python -m @@ -22,8 +24,10 @@ jobs: build setuptools --user + - name: Set dev timestamp run: echo "DEV_BUILD=$(date +%s)" >> $GITHUB_ENV + - name: Build binary wheel and source tarball run: >- python -m @@ -32,26 +36,31 @@ jobs: --wheel --outdir dist/ . + - name: Publish distribution to TestPyPI uses: pypa/gh-action-pypi-publish@master with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository_url: https://test.pypi.org/legacy/\ + publish: name: Build and publish to PyPI - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up Python 3.9 - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: 3.9 + - name: Install pypa/build run: >- python -m pip install build --user + - name: Build binary wheel and source tarball run: >- python -m diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 8790e89..fceb3af 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -6,14 +6,16 @@ on: jobs: scan: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 - - name: Build the container image - run: | - docker build --tag whoogle-search:test . - - name: Initiate grype scan - run: | - curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b . - chmod +x ./grype - ./grype whoogle-search:test --only-fixed + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Build the container image + run: | + docker build --tag whoogle-search:test . + + - name: Initiate grype scan + run: | + curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b . + chmod +x ./grype + ./grype whoogle-search:test --only-fixed diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97573fc..4840d0c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,14 +4,17 @@ on: [push, pull_request] jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: '3.x' + - name: Install dependencies run: pip install --upgrade pip && pip install -r requirements.txt + - name: Run tests run: ./run test