Skip to content

Commit eca3b0d

Browse files
committed
commit sample workflow
Signed-off-by: davidradl <[email protected]>
1 parent fce5cb3 commit eca3b0d

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
---
19+
name: "Community Review"
20+
description: "Manages community labels"
21+
inputs:
22+
jdk_version:
23+
description: "The JDK version that's supposed to be used."
24+
required: true
25+
maven_repo_folder:
26+
description: "The location of the local Maven repository (not setting this parameter will omit the caching of Maven artifacts)."
27+
required: false
28+
default: ""
29+
source_directory:
30+
description: "Specifies the directory from which the code should be moved from (needed for containerized runs; not setting this parameter will omit moving the checkout)."
31+
required: false
32+
default: ""
33+
target_directory:
34+
description: "Specifies the directory to which the code should be moved to (needed for containerized runs; not setting this parameter will omit moving the checkout)."
35+
required: false
36+
default: ""
37+
runs:
38+
using: "composite"
39+
steps:
40+
- name: "Initializes GHA_PIPELINE_START_TIME with the job's start time"
41+
shell: bash
42+
run: |
43+
job_start_time="$(date --rfc-3339=seconds)"
44+
echo "GHA_PIPELINE_START_TIME=${job_start_time}" >> "${GITHUB_ENV}"
45+
echo "The job's start time is set to ${job_start_time}."
46+
47+
- name: "Pre-cleanup Disk Info"
48+
shell: bash
49+
run: df -h
50+
51+
- name: "Delete unused binaries"
52+
shell: bash
53+
run: |
54+
# inspired by https://github.com/easimon/maximize-build-space
55+
for label_with_path in \
56+
"Android SDK:/usr/local/lib/android" \
57+
"CodeQL:/opt/hostedtoolcache/CodeQL" \
58+
".NET:/usr/share/dotnet"; do
59+
dependency_name="$(echo "${label_with_path}" | cut -d: -f1)"
60+
dependency_path="$(echo "${label_with_path}" | cut -d: -f2)"
61+
62+
if [ -d "${dependency_path}" ]; then
63+
echo "[INFO] Deleting binaries of ${dependency_name} in ${dependency_path}."
64+
sudo rm -rf "${dependency_path}"
65+
df -h
66+
else
67+
echo "[INFO] The directory '${dependency_path}' doesn't exist. ${dependency_name} won't be removed."
68+
fi
69+
done
70+
71+
- name: "Set JDK version to ${{ inputs.jdk_version }}"
72+
shell: bash
73+
run: |
74+
echo "JAVA_HOME=$JAVA_HOME_${{ inputs.jdk_version }}_X64" >> "${GITHUB_ENV}"
75+
echo "PATH=$JAVA_HOME_${{ inputs.jdk_version }}_X64/bin:$PATH" >> "${GITHUB_ENV}"
76+
77+
- name: "Setup Maven package cache"
78+
if: ${{ inputs.maven_repo_folder != '' }}
79+
uses: actions/cache@v4
80+
with:
81+
path: ${{ inputs.maven_repo_folder }}
82+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
83+
restore-keys: ${{ runner.os }}-maven
84+
85+
- name: "Moves checkout content from ${{ inputs.source_directory }} to ${{ inputs.target_directory }}."
86+
if: ${{ inputs.source_directory != '' && inputs.target_directory != '' }}
87+
shell: bash
88+
run: |
89+
mkdir -p ${{ inputs.target_directory }}
90+
91+
# .scalafmt.conf is needed for Scala format checks
92+
# .mvn is needed to make the Maven wrapper accessible in test runs
93+
mv ${{ inputs.source_directory }}/* \
94+
${{ inputs.source_directory }}/.scalafmt.conf \
95+
${{ inputs.source_directory }}/.mvn \
96+
${{ inputs.target_directory }}

0 commit comments

Comments
 (0)