Skip to content

Commit

Permalink
feat(ci): migrates circleci to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajpiar committed Apr 19, 2024
1 parent 9405ac5 commit 1a04d47
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 200 deletions.
200 changes: 0 additions & 200 deletions .circleci/config.yml

This file was deleted.

141 changes: 141 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Build and Test

on: [push]

jobs:
build:
runs-on: ubuntu-latest
container:
image: eclipse-temurin:17-jdk
env:
_JAVA_OPTIONS: "-Xmx3G -Xms2G"
steps:
- uses: actions/checkout@v2

# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '17'

- name: Install Node.js
run: |
curl -fsSL https://deb.nodesource.com/setup_21.x | bash -
apt-get install -y nodejs
- name: Check Node.js version
run: node --version

- name: Install Git
run: |
apt-get update && apt-get install -yqq git
# - name: Cache Gradle packages
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-

- name: Setup
run: |
apt update -y && apt install -y gnupg2
- name: Verify files
run: |
curl -sSL https://secchannel.rsk.co/SUPPORT.asc | gpg2 --import -
gpg2 --verify SHA256SUMS.asc && sha256sum --check SHA256SUMS.asc
- name: Build
run: |
./configure.sh
./gradlew --no-daemon dependencies
./gradlew --no-daemon --stacktrace build -x test
# - name: Persist workspace
# uses: actions/upload-artifact@v3
# with:
# name: workspace
# path: .

sonarqube:
needs: build
runs-on: ubuntu-latest
container:
image: eclipse-temurin:17-jdk
steps:
- uses: actions/checkout@v2
- name: Run SonarQube analysis
env:
SONAR_URL: ${{ secrets.SONAR_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
apt-get update && apt-get install -yqq git
extra_flags=""
if [ "${{ github.event_name }}" == "pull_request" ]; then
git branch -f master origin/master
pr_number=${{ github.event.pull_request.number }}
extra_flags="-Dsonar.pullrequest.base=master
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.key=$pr_number"
else
extra_flags="-Dsonar.branch.name=master"
fi
./gradlew sonarqube --no-daemon -x build -x test $extra_flags
unit-tests:
needs: build
runs-on: ubuntu-latest
container:
image: eclipse-temurin:17-jdk
steps:
- uses: actions/checkout@v2

# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '17'

- name: Install Node.js
run: |
curl -fsSL https://deb.nodesource.com/setup_21.x | bash -
apt-get install -y nodejs
- name: Check Node.js version
run: node --version
#
# - uses: actions/download-artifact@v3
# with:
# name: workspace
# path: .

- name: Install Git
run: |
apt-get update && apt-get install -yqq git
# - uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-

- name: Run unit tests
run: |
./gradlew --no-daemon --stacktrace test
- name: Save test results
run: |
mkdir -p ${{ github.workspace }}/junit/
find rskj-core/build/test-results -type f -name "*.xml" \
-exec cp {} ${{ github.workspace }}/junit/ \;
if: always()
#
# - uses: actions/upload-artifact@v3
# with:
# name: junit-results
# path: ${{ github.workspace }}/junit/

0 comments on commit 1a04d47

Please sign in to comment.