From 46264a2c13726a6df5ed2da085980ee1a56b4151 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Fri, 4 Feb 2022 15:12:44 +0100 Subject: [PATCH] Fix temp folder handling on windows Something with the globing seems not work but not sure exactly. Now using a simple way of ensure that the target folder never exists when calling `mv` so that it behaves as a rename instead of a move into. The folder still needs to be created first so that parent folders (in case of a custom cache path) are created. --- .github/workflows/workflow.yml | 9 ++++++++- .gitignore | 1 + setup.sh | 14 +++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index bb836924..728fe5e2 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,5 +1,12 @@ name: Main workflow -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: + branches: + - main + jobs: test_channel: runs-on: ${{ matrix.operating-system }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..485dee64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/setup.sh b/setup.sh index 62d06f3c..d6b08504 100755 --- a/setup.sh +++ b/setup.sh @@ -52,11 +52,17 @@ download_archive() { curl --connect-timeout 15 --retry 5 $archive_url >$archive_local + # Create the target folder + mkdir -p "$2" + if [[ $archive_name == *zip ]]; then unzip -q -o "$archive_local" -d "$RUNNER_TEMP" - shopt -s dotglob - mv ${RUNNER_TEMP}/flutter/* "$2" - shopt -u dotglob + # Remove the folder again so that the move command can do a simple rename + # instead of moving the content into the target folder. + # This is a little bit of a hack since the "mv --no-target-directory" + # linux option is not available here + rm -r "$2" + mv ${RUNNER_TEMP}/flutter "$2" else tar xf "$archive_local" -C "$2" --strip-components=1 fi @@ -90,8 +96,6 @@ else PUB_CACHE="${HOME}/.pub-cache" fi -mkdir -p "$SDK_CACHE" - if [[ ! -x "${SDK_CACHE}/bin/flutter" ]]; then if [[ $CHANNEL == master ]]; then git clone -b master https://github.com/flutter/flutter.git "$SDK_CACHE"