Skip to content

Commit

Permalink
Use actions/cache instead of NuGet
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Nov 6, 2024
1 parent e94314b commit 78ee981
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 37 deletions.
12 changes: 6 additions & 6 deletions ci/docker/python-wheel-manylinux.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ COPY ci/scripts/install_ccache.sh arrow/ci/scripts/
RUN /arrow/ci/scripts/install_ccache.sh ${ccache} /usr/local

# Install vcpkg
ARG GITHUB_ACTOR
ARG GITHUB_TOKEN
ARG ACTIONS_CACHE_URL
ARG ACTIONS_RUNTIME_TOKEN
ARG vcpkg
COPY ci/vcpkg/*.patch \
ci/vcpkg/*linux*.cmake \
Expand All @@ -76,10 +76,10 @@ COPY ci/scripts/install_vcpkg.sh \
arrow/ci/scripts/
ENV VCPKG_ROOT=/opt/vcpkg
ARG build_type=release
ENV CMAKE_BUILD_TYPE=${build_type} \
GITHUB_ACTOR="${GITHUB_ACTOR}" \
GITHUB_TOKEN="${GITHUB_TOKEN}" \
VCPKG_BINARY_SOURCES="clear;nugetconfig,${VCPKG_ROOT}/nuget.config" \
ENV ACTIONS_CACHE_URL="${ACTIONS_CACHE_URL}" \
ACTIONS_RUNTIME_TOKEN="${ACTIONS_RUNTIME_TOKEN}" \
CMAKE_BUILD_TYPE=${build_type} \
VCPKG_BINARY_SOURCES="clear;x-gha,readwrite" \
VCPKG_DEFAULT_TRIPLET=${arch_short}-linux-static-${build_type} \
VCPKG_FEATURE_FLAGS="manifests" \
VCPKG_FORCE_SYSTEM_BINARIES=1 \
Expand Down
29 changes: 0 additions & 29 deletions ci/scripts/install_vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,4 @@ if [ -f "${vcpkg_ports_patch}" ]; then
echo "Patch successfully applied to the VCPKG port files!"
fi

if [ -n "${GITHUB_TOKEN:-}" ] && [ -n "${GITHUB_ACTOR:-}" ]; then
if type dnf 2>/dev/null; then
dnf install -y epel-release
dnf install -y mono-complete
fi
nuget_url="https://nuget.pkg.github.com/${GITHUB_ACTOR}/index.json"
cat <<NUGET_CONFIG > "${VCPKG_ROOT}/nuget.config"
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="defaultPushSource" value="${nuget_url}" />
</config>
<apikeys>
<add key="${nuget_url}" value="${GITHUB_TOKEN}" />
</apikeys>
<packageSources>
<clear />
<add key="GitHubPackages" value="${nuget_url}" />
</packageSources>
<packageSourcesCredentials>
<GitHubPackages>
<add key="Username" value="${GITHUB_ACTOR}" />
<add key="Password" value="${GITHUB_TOKEN}" />
</GitHubPackages>
</packageSourcesCredentials>
</configuration>
NUGET_CONFIG
fi

popd
14 changes: 14 additions & 0 deletions dev/tasks/python-wheels/github.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ jobs:
{{ macros.github_install_archery()|indent }}
{{ macros.github_login_dockerhub()|indent }}

- name: Cache vcpkg
uses: actions/cache@v4
with:
path: vcpkg
key: python-wheel-manylinux-{{ manylinux_version }}-{{ "${{ hashFiles('ci/vcpkg/vcpkg.json') }}" }}
restore-keys: python-wheel-manylinux-{{ manylinux_version }}-

- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build wheel
shell: bash
run: |
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ x-sccache: &sccache

x-vcpkg-build-args: &vcpkg-build-args
vcpkg: ${VCPKG}
GITHUB_ACTOR:
GITHUB_TOKEN:
ACTIONS_CACHE_URL:
ACTIONS_RUNTIME_TOKEN:

# CPU/memory limit presets to pass to Docker.
#
Expand Down

0 comments on commit 78ee981

Please sign in to comment.