From b501bc790362b149640cb977f9dbcef01b9e58d8 Mon Sep 17 00:00:00 2001 From: Ryu Sato Date: Fri, 3 May 2024 20:46:40 +0900 Subject: [PATCH 1/4] add workflow to remove cache --- .github/workflows/misc-remove_cache.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/misc-remove_cache.yaml diff --git a/.github/workflows/misc-remove_cache.yaml b/.github/workflows/misc-remove_cache.yaml new file mode 100644 index 00000000..010d2fef --- /dev/null +++ b/.github/workflows/misc-remove_cache.yaml @@ -0,0 +1,17 @@ +name: Misc - Remove cache + +on: + workflow_dispatch: + workflow_run: + workflows: + - Application - Test + types: + - completed + +jobs: + misc-remove_cache: + runs-on: ubuntu-latest + + steps: + # remove cache older than 1 hour ago + - run: gh cache list --json id,createdAt | jq ".[].createdAt |= (sub(\"\\\\..*Z\";\"Z\") | fromdateiso8601 < `expr $(date +%s) - 60 \* 60`)" From 8bfa16ed62d33fe1751e45087136c3e4093e78e0 Mon Sep 17 00:00:00 2001 From: Ryu Sato Date: Fri, 3 May 2024 20:48:27 +0900 Subject: [PATCH 2/4] wait until container is started --- .github/workflows/app-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/app-test.yaml b/.github/workflows/app-test.yaml index 6ca05df7..561d6f4c 100644 --- a/.github/workflows/app-test.yaml +++ b/.github/workflows/app-test.yaml @@ -42,7 +42,7 @@ jobs: - name: Start all DBs and middle run: | docker-compose -f .devcontainer/docker-compose.yml build --build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g) - docker-compose -f .devcontainer/docker-compose.yml up -d + docker-compose -f .devcontainer/docker-compose.yml up -d --wait - name: Run test run: docker-compose -f .devcontainer/docker-compose.yml exec -T -- node bash -c 'yarn install && yarn test' From 4fb170c2936c0fe3970ccdb7bc6483bc8fb18575 Mon Sep 17 00:00:00 2001 From: Ryu Sato Date: Fri, 3 May 2024 23:00:45 +0900 Subject: [PATCH 3/4] revert --- .github/workflows/app-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/app-test.yaml b/.github/workflows/app-test.yaml index 561d6f4c..6ca05df7 100644 --- a/.github/workflows/app-test.yaml +++ b/.github/workflows/app-test.yaml @@ -42,7 +42,7 @@ jobs: - name: Start all DBs and middle run: | docker-compose -f .devcontainer/docker-compose.yml build --build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g) - docker-compose -f .devcontainer/docker-compose.yml up -d --wait + docker-compose -f .devcontainer/docker-compose.yml up -d - name: Run test run: docker-compose -f .devcontainer/docker-compose.yml exec -T -- node bash -c 'yarn install && yarn test' From dae3696fbc8358d523461a919d2331c0e71fdc31 Mon Sep 17 00:00:00 2001 From: Ryu Sato Date: Sat, 4 May 2024 00:03:43 +0900 Subject: [PATCH 4/4] remove github action's cache --- .github/workflows/misc-remove_cache.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/misc-remove_cache.yaml b/.github/workflows/misc-remove_cache.yaml index 010d2fef..43876896 100644 --- a/.github/workflows/misc-remove_cache.yaml +++ b/.github/workflows/misc-remove_cache.yaml @@ -14,4 +14,7 @@ jobs: steps: # remove cache older than 1 hour ago - - run: gh cache list --json id,createdAt | jq ".[].createdAt |= (sub(\"\\\\..*Z\";\"Z\") | fromdateiso8601 < `expr $(date +%s) - 60 \* 60`)" + - run: + for ID in $(gh cache list --json id,createdAt | jq ".[].createdAt |= (sub(\"\\\\..*Z\";\"Z\") | fromdateiso8601 < `expr $(date +%s) - 60 \* 60`)" | jq -r '.[].id'); + do gh cache delete $ID; + done