ci: pull docker images before build #245
Workflow file for this run
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: Benchmark | |
on: | |
workflow_dispatch: | |
push: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.sha }} | |
cancel-in-progress: true | |
jobs: | |
benchmark: | |
name: Run benchmark | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
language: | |
- "crystal" | |
- "go" | |
- "nodejs" | |
- "php" | |
- "python" | |
- "ruby" | |
env: | |
ISHOCON_APP_LANG: ${{ matrix.language }} | |
UNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Replace base image in docker-compose.yml with github actor name | |
run: | | |
make change-lang | |
sed -i 's/ishocon2-app-base/${{ env.UNAME }}\/ishocon2-app-base/g' ./docker-compose.yml | |
cat ./docker-compose.yml | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Pull docker images | |
run: | | |
docker pull ${{ env.UNAME }}/ishocon2-app-bench:latest | |
docker pull ${{ env.UNAME }}/ishocon2-app-base:latest | |
docker pull ${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:latest | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.UNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and push bench image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
file: ./docker/benchmarker/Dockerfile | |
tags: ${{ env.UNAME }}/ishocon2-app-bench:latest | |
cache-from: type=registry,ref=${{ env.UNAME }}/ishocon2-app-bench:latest | |
cache-to: type=inline,ref=${{ env.UNAME }}/ishocon2-app-bench:latest | |
- name: Build and push base image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
file: ./docker/app/base/Dockerfile | |
tags: ${{ env.UNAME }}/ishocon2-app-base:latest | |
cache-from: type=registry,ref=${{ env.UNAME }}/ishocon2-app-base:latest | |
cache-to: type=inline,ref=${{ env.UNAME }}/ishocon2-app-base:latest | |
- name: Build and push app image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:latest | |
file: ./docker/app/${{ env.ISHOCON_APP_LANG }}/Dockerfile | |
build-args: BASE_IMAGE=${{ env.UNAME }}/ishocon2-app-base:latest | |
cache-from: type=registry,ref=${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:latestst | |
cache-to: type=inline,ref=${{ env.UNAME }}/ishocon2-app-${{ env.ISHOCON_APP_LANG }}:latest | |
- run: make build | |
timeout-minutes: 10 | |
- run: make up bench-with-db-init | |
timeout-minutes: 10 | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 |