diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d80e1b5..b4e7bce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,7 @@ jobs: - linux architecture: - amd64 - - arm64 + # - arm64 steps: - name: Checkout repository diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 0798436..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Release - -on: - release: - types: - - published - workflow_dispatch: - workflow_run: - workflows: ["Build"] - types: ["completed"] - branches: - - main - -env: - REGISTRY: ghcr.io - -jobs: - setup: - runs-on: ubuntu-latest - steps: - - name: Sanitize image name - uses: actions/github-script@v6 - id: image-name - with: - result-encoding: string - script: return '${{ env.REGISTRY }}/${{ github.repository }}'.toLowerCase() - - - name: Get short SHA - run: | - echo SHORT_SHA="${GITHUB_SHA:0:7}" >> $GITHUB_ENV - - outputs: - base_image_name: ${{ steps.image-name.outputs.result }} - build_image: ${{ steps.image-name.outputs.result }}:${{ env.SHORT_SHA }} - - push: - if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - needs: setup - permissions: - packages: write - env: - BASE_IMAGE_NAME: ${{ needs.setup.outputs.base_image_name }} - BUILD_IMAGE: ${{ needs.setup.outputs.build_image }} - steps: - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.BASE_IMAGE_NAME }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=semver,pattern={{major}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{version}} - - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Tag and push image - uses: akhilerm/tag-push-action@v2.1.0 - with: - src: ${{ env.BUILD_IMAGE }} - dst: | - ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dee28ea --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,58 @@ +name: Test + +on: + workflow_dispatch: {} + workflow_run: + workflows: + - Build + types: + - completed + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + test: + env: + COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml + DOCKER_APP_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA }} + WAIT_SECONDS: 10 + + permissions: + packages: read + contents: read + + runs-on: ubuntu-latest + + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Prepare the stack + run: | + mkdir artifacts + docker compose pull + docker compose up --wait + docker compose exec -e RAILS_ENV=test app rails assets:precompile db:setup geoblacklight:solr:seed + + - name: Run RSpec + run: | + set -o pipefail + docker compose exec app rspec -f html | tee artifacts/rspec.html + + - name: Write service and event logs + if: ${{ always() }} + run: | + docker compose events > artifacts/docker-compose-events.log + docker compose logs > artifacts/docker-compose-logs.log + + - name: Archive test results and logs + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: test-results + path: artifacts