Fixes git client #534
This file contains 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
name: ci | |
on: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: | |
- "master" | |
jobs: | |
# ┌────────────────────┐ | |
# │ 1) Build & Test │ | |
# └────────────────────┘ | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis:6 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 300 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Test Image (amd64) | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64 | |
load: true # So we can docker run the image locally | |
cache-from: type=gha,scope=blot-docker-cache | |
cache-to: type=gha,mode=max,scope=blot-docker-cache | |
target: test | |
# Tagged purely for local usage in this job; no push. | |
tags: ghcr.io/${{ github.repository_owner }}/blot:test-${{ github.sha }} | |
- name: Run Tests | |
env: | |
BLOT_STRIPE_KEY: ${{ secrets.BLOT_STRIPE_KEY }} | |
BLOT_STRIPE_SECRET: ${{ secrets.BLOT_STRIPE_SECRET }} | |
BLOT_STRIPE_PRODUCT: ${{ secrets.BLOT_STRIPE_PRODUCT }} | |
run: | | |
docker run --rm \ | |
--network name=${{ job.services.redis.network }} \ | |
-e BLOT_REDIS_HOST=redis \ | |
-e BLOT_STRIPE_KEY=$BLOT_STRIPE_KEY \ | |
-e BLOT_STRIPE_SECRET=$BLOT_STRIPE_SECRET \ | |
-e BLOT_STRIPE_PRODUCT=$BLOT_STRIPE_PRODUCT \ | |
ghcr.io/${{ github.repository_owner }}/blot:test-${{ github.sha }} \ | |
sh -c "node tests && npx depcheck --ignores=depcheck,nodemon,blessed-contrib,twit,fontkit,text-to-svg --skip-missing" | |
# ┌────────────────────────────────────┐ | |
# │ 2) Build Production Images │ | |
# │ (in parallel with tests) │ | |
# └────────────────────────────────────┘ | |
build: | |
name: Build Production Images | |
runs-on: ubuntu-latest | |
# This job does NOT depend on "test", so it can run in parallel. | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 300 | |
- name: Set up QEMU (for multi-arch) | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build multi-arch production image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
target: prod | |
tags: ghcr.io/${{ github.repository_owner }}/blot:${{ github.sha }} | |
cache-from: type=gha,scope=blot-docker-cache | |
cache-to: type=gha,mode=max,scope=blot-docker-cache |