Skip to content

Commit

Permalink
feat(ci): uses private ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajpiar committed May 15, 2024
1 parent 2c868ed commit cffca84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 138 deletions.
79 changes: 13 additions & 66 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
./configure.sh
./gradlew --no-daemon dependencies
./gradlew --no-daemon --stacktrace build -x test
ls -la ./gradle/wrapper/gradle-wrapper.jar
sonarqube:
needs: build
Expand Down Expand Up @@ -82,9 +81,11 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
- name: Get Gradle jar
run: |
./configure.sh
if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then
./configure.sh
fi
- name: Run SonarQube analysis
run: |
Expand Down Expand Up @@ -144,7 +145,9 @@ jobs:
- name: Get Gradle jar
run: |
./configure.sh
if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then
./configure.sh
fi
- name: Unit tests
run: |
Expand All @@ -161,76 +164,19 @@ jobs:
find rskj-core/build/test-results -type f -name "*.xml" -exec cp {} ~/junit/ \;
if: always()

build-push-docker-images:
runs-on: ubuntu-latest
steps:
- name: Check out the mining integration tests repository
uses: actions/checkout@v4
with:
repository: rsksmart/mining-integration-tests
ref: 8bbfd75328344eeff567c93ad15db1e864ba6445
token: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker images
env:
DOCKER_BUILDKIT: 1
run: |
for service in bitcoind1 bitcoind2; do
image="jurajpiar/mit_${service}:latest"
docker pull $image || true
# Build the new image
docker build --cache-from=$image -t $image -f ${service}.Dockerfile .
# Get the new image digest
new_digest=$(docker inspect --format='{{index .RepoDigests 0}}' $image || echo "")
# Get the remote image digest
remote_digest=$(docker inspect --format='{{index .RepoDigests 0}}' $image || echo "")
# Check if the new digest is empty (meaning the image is new and has not been pushed yet)
if [ -z "$new_digest" ]; then
new_digest=$(docker inspect --format='{{.Id}}' $image)
fi
# Compare the digests
if [ "$new_digest" != "$remote_digest" ]; then
echo "Pushing $image as it has changed"
docker push $image
else
echo "$image has not changed, skipping push"
fi
done
# docker build -t rsksmart/mit_bitcoind1:latest -f bitcoind1.Dockerfile .
# docker push rsksmart/mit_bitcoind1:latest
# docker build -t rsksmart/mit_bitcoind2:latest -f bitcoind2.Dockerfile .
# docker push rsksmart/mit_bitcoind2:latest


mining-tests:
needs:
# - build-push-docker-images // TODO: Uncomment once the we have the permission to push the images
- build
needs: build
runs-on: ubuntu-latest
services:
bitcoind1:
image: jurajpiar/mit_bitcoind1:latest
image: ghcr.io/rsksmart/rskj/mit_bitcoind1:latest
ports:
- 8331:8331
- 31591:31591
- 32591:32591
options: --name bitcoind1
bitcoind2:
image: jurajpiar/mit_bitcoind2:latest
image: ghcr.io/rsksmart/rskj/mit_bitcoind2:latest
ports:
- 8332:8332
- 31592:31592
Expand Down Expand Up @@ -290,11 +236,12 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
- name: Get Gradle jar
run: |
if [ ! -d rskj-core/build ]; then
if [ ! -f ./gradle/wrapper/gradle-wrapper.jar ]; then
./configure.sh
fi
- name: Start RSKj and Run Tests
working-directory: mining-integration-tests
run: |
Expand Down
72 changes: 0 additions & 72 deletions minGasPrice.md

This file was deleted.

0 comments on commit cffca84

Please sign in to comment.