Skip to content

Commit

Permalink
キャッシュしない場合の動作確認。
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumika Koyama committed Nov 7, 2023
1 parent 7f2ca33 commit c56373e
Showing 1 changed file with 34 additions and 35 deletions.
69 changes: 34 additions & 35 deletions .github/workflows/samples-dressca-backend.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,45 +59,44 @@ jobs:
echo '# Build Result :gear:' >> $GITHUB_STEP_SUMMARY
cat build-result.txt | sed -n -e 's/^/> /p' >> $GITHUB_STEP_SUMMARY
- name: キャッシュIDの作成
id: imagetag
run: |
VARIANT=$(TZ=UTC-9 date '+%Y%m')
# イメージのタグを作成
NAME_IMAGE=DockerImage
TAG="${NAME_IMAGE}:${VARIANT}"
# キャッシュする tar アーカイブ名とパスの設定
NAME_TAR="${NAME_IMAGE}.${VARIANT}.tar"
PATH_TAR=${{ env.PATH_CACHE }}"/${NAME_TAR}"
# 変数を他の run でも使えるように output
echo "TAG=${TAG}" >> "$GITHUB_OUTPUT"
echo "NAME_TAR=${NAME_TAR}" >> "$GITHUB_OUTPUT"
echo "PATH_TAR=${PATH_TAR}" >> "$GITHUB_OUTPUT"
- name: キャッシュ有効化
id: cache
uses: actions/cache@v3
with:
path: ${{ env.PATH_CACHE }}
key: ${{ steps.imagetag.outputs.TAG }}

- name: キャッシュがある場合にロード
if: steps.cache.outputs.cache-hit == 'true'
run: docker load --input ${{ steps.imagetag.outputs.PATH_TAR }}

- name: キャッシュがない場合にイメージを保存
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.PATH_CACHE }}
sudo docker pull mcr.microsoft.com/mssql/server:2022-latest
sudo docker save mcr.microsoft.com/mssql/server:2022-latest -o ${{ steps.imagetag.outputs.PATH_TAR }}
#- name: キャッシュIDの作成
# id: imagetag
# run: |
# VARIANT=$(TZ=UTC-9 date '+%Y%m')
# # イメージのタグを作成
# NAME_IMAGE=DockerImage
# TAG="${NAME_IMAGE}:${VARIANT}"
# # キャッシュする tar アーカイブ名とパスの設定
# NAME_TAR="${NAME_IMAGE}.${VARIANT}.tar"
# PATH_TAR=${{ env.PATH_CACHE }}"/${NAME_TAR}"
# # 変数を他の run でも使えるように output
# echo "TAG=${TAG}" >> "$GITHUB_OUTPUT"
# echo "NAME_TAR=${NAME_TAR}" >> "$GITHUB_OUTPUT"
# echo "PATH_TAR=${PATH_TAR}" >> "$GITHUB_OUTPUT"

#- name: キャッシュ有効化
# id: cache
# uses: actions/cache@v3
# with:
# path: ${{ env.PATH_CACHE }}
# key: ${{ steps.imagetag.outputs.TAG }}

#- name: キャッシュがある場合にロード
# if: steps.cache.outputs.cache-hit == 'true'
# run: docker load --input ${{ steps.imagetag.outputs.PATH_TAR }}

#- name: キャッシュがない場合にイメージを保存
# if: steps.cache.outputs.cache-hit != 'true'
# run: |
# mkdir -p ${{ env.PATH_CACHE }}
# sudo docker pull mcr.microsoft.com/mssql/server:2022-latest
# sudo docker save mcr.microsoft.com/mssql/server:2022-latest -o ${{ steps.imagetag.outputs.PATH_TAR }}

- name: 結合テスト用にSQL Serverをセットアップ
run: |
sudo docker run mcr.microsoft.com/mssql/server:2022-latest \
-e "ACCEPT_EULA=Y" \
sudo docker pull mcr.microsoft.com/mssql/server:2022-latest
sudo docker run -e "ACCEPT_EULA=Y" \
-e "MSSQL_SA_PASSWORD=P@ssw0rd" \
-v sqlvolume:/var/opt/mssql \
-p 1433:1433 --name sql1 \
--hostname sql1 \
-d \
Expand Down

0 comments on commit c56373e

Please sign in to comment.