diff --git a/.github/workflows/on_call_build_site.yaml b/.github/workflows/on_call_build_site.yaml index cb6beb98..4e9cf3b8 100644 --- a/.github/workflows/on_call_build_site.yaml +++ b/.github/workflows/on_call_build_site.yaml @@ -5,12 +5,28 @@ on: jobs: build_site: runs-on: ubuntu-latest + permissions: + packages: write + env: + CACHE_IMAGE: orionrobots/orionrobots-site + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 steps: - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Build the site with docker compose run: | - docker compose run --build build + docker compose -f docker-compose.yml -f docker-compose.ci.yml run --build build - name: Tarball the site run: | diff --git a/.github/workflows/on_call_staging_test.yaml b/.github/workflows/on_call_staging_test.yaml index c8dd519f..9776b7b2 100644 --- a/.github/workflows/on_call_staging_test.yaml +++ b/.github/workflows/on_call_staging_test.yaml @@ -5,6 +5,12 @@ on: jobs: staging_test: runs-on: ubuntu-latest + permissions: + packages: write + env: + CACHE_IMAGE: orionrobots/orionrobots-site + DOCKER_BUILDKIT: 1 + COMPOSE_DOCKER_CLI_BUILD: 1 steps: - uses: actions/checkout@v4 - name: Fetch site artifact @@ -18,6 +24,13 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Login to Docker + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Prepare staging context run: | # Copy staging files into the _site directory for the docker build @@ -42,7 +55,7 @@ jobs: # Run BDD integration tests using docker compose echo "## BDD Test Results" >> $GITHUB_STEP_SUMMARY echo "\`\`\`" >> $GITHUB_STEP_SUMMARY - docker compose run test 2>&1 | tee bdd_output.txt + docker compose -f docker-compose.yml -f docker-compose.ci.yml run test 2>&1 | tee bdd_output.txt bdd_exit_code=$? cat bdd_output.txt >> $GITHUB_STEP_SUMMARY echo "\`\`\`" >> $GITHUB_STEP_SUMMARY diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 0e550648..c96941e5 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,7 +1,56 @@ services: + serve: + build: + cache_from: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.serve:cache + cache_to: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.serve:cache,mode=max + + dist: + build: + cache_from: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.dist:cache + cache_to: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.dist:cache,mode=max + + build: + build: + cache_from: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.build:cache + cache_to: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.build:cache,mode=max + staging: build: cache_from: - - type=gha + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.staging:cache + cache_to: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.staging:cache,mode=max + + test: + build: + cache_from: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.test:cache + cache_to: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.test:cache,mode=max + + shell: + build: + cache_from: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.shell:cache + cache_to: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.shell:cache,mode=max + + http_serve: + build: + cache_from: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.http_serve:cache + cache_to: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.http_serve:cache,mode=max + + broken_links: + build: + cache_from: + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.broken_links:cache cache_to: - - type=gha,mode=max \ No newline at end of file + - type=registry,ref=ghcr.io/orionrobots/orionrobots-site.broken_links:cache,mode=max