N+1問題を解決するためのAttendance統計メソッドの修正 #243
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: Docker Image CI | |
on: | |
pull_request_target: | |
types: [closed] # プルリクエストがクローズされたときに実行 | |
branches: [main] # main ブランチに対してのみ実行 | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: contains(github.event.pull_request.labels.*.name, '🆗 safe') && github.event.pull_request.merged == true # 「🆗 safe」 ラベルがあり、マージされたプルリクエストに対してのみ実行 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Go environment | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install ko | |
run: go install github.com/google/ko@latest | |
- name: Run unit tests | |
run: go test -tags=unit ./tests/... | |
# - name: Run integration tests | |
# run: go test -tags=integration ./tests/... | |
- name: Get the current date | |
id: date | |
run: echo "date=$(date +'%Y%m%d%H%M')" >> $GITHUB_ENV | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3.0.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.PASSWORD }} | |
# - name: Build and push image using ko | |
# env: | |
# KO_DOCKER_REPO: ghcr.io/yju-okura/minori_gin | |
# PATH: $PATH:~/go/bin | |
# run: | | |
# ko publish . -B --tags=${{ env.date }},latest | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
no-cache: true | |
tags: | | |
ghcr.io/yju-okura/minori_gin:${{ env.date }} | |
ghcr.io/yju-okura/minori_gin:latest |