diff --git a/.github/workflows/tests.yml b/.github/workflows/elasticsearch_tests.yml similarity index 95% rename from .github/workflows/tests.yml rename to .github/workflows/elasticsearch_tests.yml index 38604a0..d3b9898 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/elasticsearch_tests.yml @@ -1,4 +1,4 @@ -name: CI +name: Elasticsearch on: push: @@ -7,7 +7,7 @@ on: pull_request: jobs: - tests: + elasticsearch_tests: runs-on: ubuntu-latest services: es: @@ -39,4 +39,3 @@ jobs: - name: Run tests run: python3 search_test.py --count=2000 --search_db_url=http://localhost:9200 - diff --git a/.github/workflows/github_container_image.yml b/.github/workflows/github_container_image.yml new file mode 100644 index 0000000..96b6c6e --- /dev/null +++ b/.github/workflows/github_container_image.yml @@ -0,0 +1,54 @@ +name: Create and publish a Docker image + +on: + push: + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: type=semver, pattern={{raw}} + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/opensearch_tests.yml b/.github/workflows/opensearch_tests.yml new file mode 100644 index 0000000..a77fe09 --- /dev/null +++ b/.github/workflows/opensearch_tests.yml @@ -0,0 +1,41 @@ +name: OpenSearch + +on: + push: + branches: + - master + pull_request: + +jobs: + opensearch_tests: + runs-on: ubuntu-latest + services: + es: + image: opensearchproject/opensearch:2 + ports: + - 9200:9200 + options: >- + --env discovery.type=single-node + --env DISABLE_SECURITY_PLUGIN=true + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install -r requirements.txt + + - name: Wait for Opensearch + run: | + sleep 10 + curl -s http://localhost:9200 + + - name: Run tests + run: python3 search_test.py --count=2000 --search_db_url=http://localhost:9200