Skip to content

Commit

Permalink
Move download spark job into workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Dec 14, 2024
1 parent ce23b74 commit 9de8c1b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 45 deletions.
48 changes: 3 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,51 +54,9 @@ jobs:
git diff
shell: bash

download:
download-spark:
name: "Spark"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# use spark versions from test-integration.yaml workflow
include:
- spark-version: '3.0.3'
hadoop-version: '2.7'
- spark-version: '3.1.3'
hadoop-version: '2.7'
- spark-version: '3.2.4'
hadoop-version: '2.7'
- spark-version: '3.3.4'
hadoop-version: '3'
- spark-version: '3.4.3'
hadoop-version: '3'
- spark-version: '3.5.3'
hadoop-version: '3'
- spark-version: '4.0.0-preview2'
hadoop-version: '3'
steps:
- name: Cache Spark Binaries
uses: actions/cache@v4
with:
path: ~/spark
key: ${{ runner.os }}-spark-binaries-${{ inputs.spark-version }}-${{ inputs.scala-compat-version }}

- name: Setup Spark Binaries
env:
SPARK_PACKAGE: spark-${{ inputs.spark-version }}/spark-${{ inputs.spark-version }}-bin-hadoop${{ inputs.hadoop-version }}.tgz
run: |
if [[ ! -e ~/spark ]]
then
wget --progress=dot:giga "https://www.apache.org/dyn/closer.lua/spark/${SPARK_PACKAGE}?action=download" -O - | tar -xzC "${{ runner.temp }}"
archive=$(basename "${SPARK_PACKAGE}") bash -c "mv -v "${{ runner.temp }}/\${archive/%.tgz/}" ~/spark"
fi
shell: bash

- name: Upload Spark Binaries
uses: actions/upload-artifact@v4
with:
name: Spark-Binaries-${{ inputs.spark-version }}-${{ inputs.hadoop-version }}
path: ~/spark
uses: "./.github/workflows/download-spark.yml"

build:
name: "Build"
Expand Down Expand Up @@ -175,7 +133,7 @@ jobs:

test-integration:
name: "Test Integration"
needs: [test-dgraph, test-spark]
needs: [download-spark, test-dgraph, test-spark]
uses: "./.github/workflows/test-integration.yml"

delete_binaries:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/download-spark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build

on:
workflow_call:

jobs:
build:
name: Download (Spark ${{ matrix.spark-version }} Hadoop ${{ matrix.hadoop-version }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# use spark versions from test-integration.yaml workflow
include:
- spark-version: '3.0.3'
hadoop-version: '2.7'
- spark-version: '3.1.3'
hadoop-version: '2.7'
- spark-version: '3.2.4'
hadoop-version: '2.7'
- spark-version: '3.3.4'
hadoop-version: '3'
- spark-version: '3.4.3'
hadoop-version: '3'
- spark-version: '3.5.3'
hadoop-version: '3'
- spark-version: '4.0.0-preview2'
hadoop-version: '3'

steps:
- name: Cache Spark Binaries
uses: actions/cache@v4
with:
path: ~/spark
key: ${{ runner.os }}-spark-binaries-${{ matrix.spark-version }}-${{ matrix.scala-compat-version }}

- name: Setup Spark Binaries
env:
SPARK_PACKAGE: spark-${{ matrix.spark-version }}/spark-${{ matrix.spark-version }}-bin-hadoop${{ matrix.hadoop-version }}.tgz
run: |
if [[ ! -e ~/spark ]]
then
wget --progress=dot:giga "https://www.apache.org/dyn/closer.lua/spark/${SPARK_PACKAGE}?action=download" -O - | tar -xzC "${{ runner.temp }}"
archive=$(basename "${SPARK_PACKAGE}") bash -c "mv -v "${{ runner.temp }}/\${archive/%.tgz/}" ~/spark"
fi
shell: bash

- name: Upload Spark Binaries
uses: actions/upload-artifact@v4
with:
name: Spark-Binaries-${{ matrix.spark-version }}-${{ matrix.hadoop-version }}
path: ~/spark

0 comments on commit 9de8c1b

Please sign in to comment.