9797 mkdir -p ~/workdir/artifacts/
9898 mv ~/workdir/tmp-artifacts/codacy-coverage-reporter-assembly.jar ~/workdir/artifacts/codacy-coverage-reporter-assembly.jar
9999 upx --lzma -o ~/workdir/artifacts/codacy-coverage-reporter-linux ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux
100+ mv ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux-arm-assembly.jar ~/workdir/artifacts/codacy-coverage-reporter-linux-arm-assembly.jar
101+ upx --lzma -o ~/workdir/artifacts/codacy-coverage-reporter-linux-arm ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux-arm
100102 # upx binaries don't work on Mac OS Big Sur https://github.com/upx/upx/issues/424
101103 # use upx again once the bug is fixed
102104 # upx --lzma -o ~/workdir/artifacts/codacy-coverage-reporter-darwin ~/workdir/tmp-artifacts/codacy-coverage-reporter-darwin
@@ -164,6 +166,8 @@ jobs:
164166 name : prepare the environment
165167 command : |
166168 brew install mockserver coreutils
169+ sudo rm -rf /Library/Developer/CommandLineTools
170+ sudo xcode-select --install
167171 export CODACY_REPORTER_TMP_FOLDER=".codacy-coverage"
168172 version=$(cat .version)
169173 mkdir -p $CODACY_REPORTER_TMP_FOLDER/$version
@@ -188,6 +192,201 @@ jobs:
188192 if [ $ERROR_CODE -ne 0 ]; then echo "expected an error code 0 and got $ERROR_CODE instead"; exit 1; fi
189193 echo "test completed with the expected error code: 0"
190194
195+
196+
197+ it_coverage_script_ubuntu_linux_arm :
198+ resource_class : arm.medium
199+ docker :
200+ - image : cimg/base:2023.10 # ubuntu based image
201+ - image : mockserver/mockserver:5.15.0
202+ working_directory : ~/workdir
203+ steps :
204+ - attach_workspace :
205+ at : ~/workdir
206+ create_artifacts_linux_arm :
207+ description : Default sbt job
208+ environment :
209+ AWS_DEFAULT_REGION : << parameters.region >>
210+ AWS_PROFILE : << parameters.aws_profile >>
211+ machine :
212+ image : ubuntu-2204:current
213+ resource_class : arm.medium
214+ parameters :
215+ aws_profile :
216+ default : default
217+ description : The AWS profile to be used
218+ type : string
219+ cache_prefix :
220+ default : sbt-cache-032020
221+ description : The prefix of cache to be used
222+ type : string
223+ cmd :
224+ default : ' '
225+ description : SBT command to run
226+ type : string
227+ credentials_file_content :
228+ default : >
229+ [default]
230+
231+ aws_access_key_id=$ACCESS_KEY_ID
232+
233+ aws_secret_access_key=$SECRET_ACCESS_KEY
234+
235+ [maven]
236+
237+ source_profile = default
238+
239+ role_arn =
240+ arn:aws:iam::$AWS_ACCOUNT_ID_PRODUCTION:role/$MAVEN_PUBLISHER_ROLE
241+ description : AWS credentials file contents to grant access for the step
242+ type : string
243+ docker_scout_version :
244+ default : 0.13.1
245+ description : Version of the docker scout plugin to use
246+ type : string
247+ install_sbt_version :
248+ default : ' '
249+ description : >-
250+ Version of SBT to install. Ensure compatibility with openjdk_version. If
251+ empty, the system one will be used
252+ type : string
253+ no_output_timeout :
254+ default : 15m
255+ description : The time to wait for the command without output
256+ type : string
257+ openjdk_version :
258+ default : ' 11'
259+ description : >-
260+ OpenJDK major version to install. Ensure compatibility with
261+ install_sbt_version. If empty, the system one will be used
262+ type : string
263+ persist_to_workspace :
264+ default : true
265+ description : Whether to persist the workspace or not at the end of the job
266+ type : boolean
267+ region :
268+ default : eu-west-1
269+ description : The AWS region for the deployment
270+ type : string
271+ save_cache :
272+ default : true
273+ description : Whether to save the cache or not at the end of the job
274+ type : boolean
275+ setup_docker_scout :
276+ default : false
277+ description : >-
278+ Install and setup docker scout plugin to scan for docker image
279+ vulnerabilities
280+ type : boolean
281+ steps :
282+ default : [ ]
283+ description : Steps to run
284+ type : steps
285+ steps_before_sbt :
286+ default : [ ]
287+ description : Steps to run before sbt starts
288+ type : steps
289+ store_test_results :
290+ default : false
291+ description : Whether to upload the test results back to CircleCI
292+ type : boolean
293+ use_sbt_native_client :
294+ default : false
295+ description : Use the sbt thin client
296+ type : boolean
297+ steps :
298+ - checkout
299+ - attach_workspace :
300+ at : ~/workdir
301+ - when :
302+ condition : << parameters.openjdk_version >>
303+ steps :
304+ - run :
305+ command : >
306+ sudo apt update
307+
308+ sudo apt install openjdk-${OJDK_VERSION}-jre
309+
310+ sudo update-alternatives --set java
311+ /usr/lib/jvm/java-${OJDK_VERSION}-openjdk-arm64/bin/java
312+ environment :
313+ OJDK_VERSION : << parameters.openjdk_version >>
314+ name : Install openjdk << parameters.openjdk_version >>
315+ - when :
316+ condition : << parameters.install_sbt_version >>
317+ steps :
318+ - run :
319+ command : >
320+ # remove pre-installed sbt
321+
322+ sudo rm -rf /opt/sbt/
323+
324+ wget https://repo.scala-sbt.org/scalasbt/debian/sbt-<<
325+ parameters.install_sbt_version >>.deb
326+
327+ sudo dpkg -i sbt-<< parameters.install_sbt_version >>.deb
328+
329+ rm -f sbt-<< parameters.install_sbt_version >>.deb
330+ name : Install sbt << parameters.install_sbt_version >>
331+ - when :
332+ condition : << parameters.setup_docker_scout >>
333+ steps :
334+ - run :
335+ command : >
336+ curl -L https://github.com/docker/scout-cli/releases/download/v<<
337+ parameters.docker_scout_version >>/docker-scout_<<
338+ parameters.docker_scout_version >>_linux_amd64.tar.gz -o
339+ docker-scout.tar.gz
340+
341+ mkdir -p $HOME/.docker/cli-plugins
342+
343+ tar -xvzf docker-scout.tar.gz -C $HOME/.docker/cli-plugins
344+
345+ chmod +x $HOME/.docker/cli-plugins/docker-scout
346+ name : >-
347+ Download and install docker scout <<
348+ parameters.docker_scout_version >>
349+ - run :
350+ command : |
351+ mkdir -p ~/.aws && touch ~/.aws/credentials
352+ cat >> ~/.aws/credentials \<< EOF
353+ << parameters.credentials_file_content >>
354+ EOF
355+ name : Setup AWS Credentials
356+ - run :
357+ command : |
358+ if [[ -f "targets.tar.gz" ]]; then
359+ echo "unpacking persisted workspace" && tar -xf targets.tar.gz
360+ else
361+ echo "no persisted workspace found"
362+ fi
363+ name : Uncompress local targets
364+ - run :
365+ command : |
366+ ARCH="arm" graalvm/build-deps.sh
367+ export PATH=$HOME/.musl/arm-linux-musleabi-native/bin:$PATH
368+ sbt "assembly;nativeImage"
369+ mkdir -p ~/workdir/tmp-artifacts
370+ mv target/native-image/codacy-coverage-reporter ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux-arm
371+ ls -al target
372+ mv target/codacy-coverage-reporter-assembly-0.1.0-SNAPSHOT.jar ~/workdir/tmp-artifacts/codacy-coverage-reporter-linux-arm-assembly.jar
373+ ls -al ~/workdir/tmp-artifacts
374+ name : Generate binaries for Linux ARM
375+ - when :
376+ condition : << parameters.persist_to_workspace >>
377+ steps :
378+ - run :
379+ command : >
380+ find -name target -type d -exec tar -zcf targets.tar.gz -H posix
381+ {} + | true
382+
383+ find -name target -type d -exec rm -rf {} + | true
384+ name : Compressing targets
385+ - persist_to_workspace :
386+ paths :
387+ - ' tmp-artifacts'
388+ root : ~/workdir
389+
191390workflows :
192391 compile_test_deploy :
193392 jobs :
@@ -265,10 +464,14 @@ workflows:
265464 persist_to_workspace_path : " tmp-artifacts/codacy-coverage-reporter-darwin"
266465 requires :
267466 - compile_and_test
467+ - create_artifacts_linux_arm :
468+ requires :
469+ - compile_and_test
268470 - package_artifacts :
269471 requires :
270472 - create_artifacts
271473 - create_artifacts_for_osx
474+ - create_artifacts_linux_arm
272475 - codacy/shell :
273476 name : generate_checksums
274477 cmd : |
@@ -284,6 +487,10 @@ workflows:
284487 - it_coverage_script_macosx :
285488 requires :
286489 - package_artifacts
490+ - it_coverage_script_ubuntu_linux_arm :
491+ name : it_coverage_script_ubuntu_linux_arm
492+ requires :
493+ - package_artifacts
287494 - it_coverage_script_alpine :
288495 requires :
289496 - package_artifacts
0 commit comments