Skip to content

Commit

Permalink
データベース作成クエリを実行してからキャッシュ保存。
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumika Koyama committed Nov 9, 2023
1 parent 508fb40 commit efb5e78
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions .github/workflows/samples-dressca-backend.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ jobs:
id: imagetag
run: |
VARIANT=$(TZ=UTC-9 date '+%Y%m')
# イメージのタグを作成
NAME_IMAGE=SQLServerDockerImage
# キャッシュする tar アーカイブ名とパスの設定
NAME_TAR="${NAME_IMAGE}.${VARIANT}.tar"
Expand All @@ -79,35 +78,28 @@ jobs:
path: ${{ env.PATH_CACHE }}
key: ${{ steps.imagetag.outputs.NAME_TAR }}

- 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: docker load --input ${{ steps.imagetag.outputs.PATH_TAR }}

- name: キャッシュがない場合にイメージをプル
- 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: キャッシュの保存
if: steps.cache.outputs.cache-hit != 'true'
id: cache
uses: actions/cache/save@v3
with:
path: ${{ env.PATH_CACHE }}
key: ${{ steps.imagetag.outputs.NAME_TAR }}

- name: 結合テスト用にSQL Serverをセットアップ
run: |
#sudo docker pull mcr.microsoft.com/mssql/server:2022-latest
sudo docker run -e "ACCEPT_EULA=Y" \
-e "MSSQL_SA_PASSWORD=P@ssw0rd" \
-p 1433:1433 --name sql1 \
--hostname sql1 \
-d \
mcr.microsoft.com/mssql/server:2022-latest
sudo docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "P@ssw0rd" -Q "CREATE DATABASE Dressca_Eshop;"
sudo docker save mcr.microsoft.com/mssql/server:2022-latest -o ${{ steps.imagetag.outputs.PATH_TAR }}
- name: 結合テスト用にSQL Serverをセットアップ
run: |
sudo docker load --input ${{ steps.imagetag.outputs.PATH_TAR }}
sudo docker run
- id: run-tests
name: テストの実行
Expand Down

0 comments on commit efb5e78

Please sign in to comment.