Skip to content

Commit

Permalink
apacheGH-39883: [CI][R][Windows] Use ci/scripts/install_minio.sh with…
Browse files Browse the repository at this point in the history
… Git bash (apache#39929)

### Rationale for this change

`curl` in Rtools can't be used on non Rtools' MSYS2 environment. Because `curl` in Rtools can't refer `/usr/ssl/certs/ca-bundle.crt` on non Rtools' MSYS2 environment.

### What changes are included in this PR?

Use the `bash` in GitHub Actions Runner. `curl` in the environment works.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* Closes: apache#39883

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
kou authored and zanmato1984 committed Feb 28, 2024
1 parent 869fa1e commit bf633f9
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 41 deletions.
41 changes: 22 additions & 19 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@ on:
push:
paths:
- ".github/workflows/r.yml"
- "ci/scripts/r_*.sh"
- "ci/scripts/cpp_*.sh"
- "ci/scripts/PKGBUILD"
- "ci/etc/rprofile"
- "ci/docker/**"
- "ci/etc/rprofile"
- "ci/scripts/PKGBUILD"
- "ci/scripts/cpp_*.sh"
- "ci/scripts/install_minio.sh"
- "ci/scripts/r_*.sh"
- "cpp/**"
- 'docker-compose.yml'
- "docker-compose.yml"
- "r/**"
pull_request:
paths:
- ".github/workflows/r.yml"
- "ci/scripts/r_*.sh"
- "ci/scripts/cpp_*.sh"
- "ci/scripts/PKGBUILD"
- "ci/etc/rprofile"
- "ci/docker/**"
- "ci/etc/rprofile"
- "ci/scripts/PKGBUILD"
- "ci/scripts/cpp_*.sh"
- "ci/scripts/install_minio.sh"
- "ci/scripts/r_*.sh"
- "cpp/**"
- 'docker-compose.yml'
- "docker-compose.yml"
- "r/**"

concurrency:
Expand Down Expand Up @@ -256,6 +258,16 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
# This must be done before r-lib/actions/setup-r because curl in
# Rtools doesn't work on non Rtools' MSYS2 environment. If we
# use "shell: bash" after r-lib/actions/setup-r, bash in Rtools
# is used on non Rtools' MSYS2 environment.
- name: Install MinIO
shell: bash
run: |
mkdir -p "$HOME/.local/bin"
ci/scripts/install_minio.sh latest "$HOME/.local"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- run: mkdir r/windows
- name: Download artifacts
uses: actions/download-artifact@v3
Expand All @@ -282,15 +294,6 @@ jobs:
working-directory: 'r'
extra-packages: |
any::rcmdcheck
- name: Install MinIO
shell: bash
run: |
mkdir -p "$HOME/.local/bin"
curl \
--output "$HOME/.local/bin/minio.exe" \
https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2022-05-26T05-48-41Z
chmod +x "$HOME/.local/bin/minio.exe"
echo "$HOME/.local/bin" >> $GITHUB_PATH
# TODO(ARROW-17149): figure out why the GCS tests are hanging on Windows
# - name: Install Google Cloud Storage Testbench
# shell: bash
Expand Down
67 changes: 45 additions & 22 deletions ci/scripts/install_minio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,76 @@
# specific language governing permissions and limitations
# under the License.

set -e
set -eu

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <version> <prefix>"
exit 1
fi

version=$1
prefix=$2

declare -A archs
archs=([x86_64]=amd64
[arm64]=arm64
[aarch64]=arm64
[s390x]=s390x)

declare -A platforms
platforms=([Linux]=linux
[Darwin]=darwin)

arch=$(uname -m)
platform=$(uname)
version=$1
prefix=$2

if [ "$#" -ne 2 ]; then
echo "Usage: $0 <version> <prefix>"
exit 1
elif [ -z ${archs[$arch]} ]; then
if [ -z ${archs[$arch]} ]; then
echo "Unsupported architecture: ${arch}"
exit 0
elif [ -z ${platforms[$platform]} ]; then
echo "Unsupported platform: ${platform}"
exit 0
elif [ "${version}" != "latest" ]; then
fi
arch=${archs[$arch]}

platform=$(uname)
case ${platform} in
Linux)
platform=linux
;;
Darwin)
platform=darwin
;;
MSYS_NT*|MINGW64_NT*)
platform=windows
;;
*)
echo "Unsupported platform: ${platform}"
exit 0
;;
esac

if [ "${version}" != "latest" ]; then
echo "Cannot fetch specific versions of minio, only latest is supported."
exit 1
fi

arch=${archs[$arch]}
platform=${platforms[$platform]}

# Use specific versions for minio server and client to avoid CI failures on new releases.
minio_version="minio.RELEASE.2022-05-26T05-48-41Z"
mc_version="mc.RELEASE.2022-05-09T04-08-26Z"

download()
{
local output=$1
local url=$2

if type wget > /dev/null 2>&1; then
wget -nv --output-document ${output} ${url}
else
curl --fail --location --output ${output} ${url}
fi
}

if [[ ! -x ${prefix}/bin/minio ]]; then
url="https://dl.min.io/server/minio/release/${platform}-${arch}/archive/${minio_version}"
echo "Fetching ${url}..."
wget -nv --output-document ${prefix}/bin/minio ${url}
download ${prefix}/bin/minio ${url}
chmod +x ${prefix}/bin/minio
fi
if [[ ! -x ${prefix}/bin/mc ]]; then
url="https://dl.min.io/client/mc/release/${platform}-${arch}/archive/${mc_version}"
echo "Fetching ${url}..."
wget -nv --output-document ${prefix}/bin/mc ${url}
download ${prefix}/bin/mc ${url}
chmod +x ${prefix}/bin/mc
fi

0 comments on commit bf633f9

Please sign in to comment.