Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #62

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 108 additions & 108 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,114 +390,114 @@ jobs:
run: |
docker push ${{ env.imageTag }}

build-obsidian-lightswitch-chaincode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Checkout the Obsidian repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
with:
repository: mcoblenz/Obsidian
path: './Obsidian'
- name: Modify Obsidian build contents
run: |
pushd ./Obsidian

# Upgrade protocol buffer
sed -i 's|"protobuf-java" % "3\.11\.4"|"protobuf-java" % "3\.19\.1"|g' build.sbt
sed -i "s|'protobuf-java', version: '3.11.4'|'protobuf-java', version: '3.19.1'|g" fabric/java/build.gradle

# Upgrade chaincode shim
sed -i 's|"fabric-chaincode-shim" % "1\.4\.4"|"fabric-chaincode-shim" % "2\.2\.3"|g' build.sbt
sed -i "s|'fabric-chaincode-shim', version: '1.4.4'|'fabric-chaincode-shim', version: '2.2.3'|g" fabric/java/build.gradle

# Skips running the tests.
mv ./src/test ./src/test_save

sbt assembly
popd
- name: Execute Obsidian compiler
run: |
# Install prerequisite - protobuf
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.1/protoc-21.1-linux-x86_64.zip -P /tmp
unzip -d /tmp/protoc /tmp/protoc-21.1-linux-x86_64.zip
export PATH=/tmp/protoc/bin:${PATH}
protoc --version
pwd
./Obsidian/bin/obsidianc obsidian/contracts/simple/lightswitch.obs --output-path out/
ls -rotl out/LightSwitch

- name: Execute Gradle
run: |
pushd out/LightSwitch

docker run --rm -u root -v "$PWD":/home/gradle/project -w /home/gradle/project ${{ env.DOCKER_REGISTRY }}/${{ env.CUSTOM_BUILDER_IMAGE_NAME }}:${{ env.CUSTOM_BUILDER_IMAGE_VERSION }} gradle build shadowJar #-x checkstyleMain -x checkstyleTest
ls -rotl build/libs
echo "buildRoot=${PWD}" >> $GITHUB_ENV
popd
- name: Publish chaincode jar
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
with:
name: lightswitch-chaincode
path: |
out/LightSwitch

docker-lightswitch-chaincode:
runs-on: ubuntu-latest
needs: [build-obsidian-lightswitch-chaincode]
env:
IMAGE_NAME: obsidian-lightswitch
IMAGE_VERSION: v0.0.0
BUILD_DIR: chaincode/lightswitch/docker/
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
- name: Prepare
run: |
pushd lightswitch-chaincode/build/libs
ls -rotl ../../../${{ env.BUILD_DIR }}
cp ../../../${{ env.BUILD_DIR }}/chaincode.env .
cp ../../../${{ env.BUILD_DIR }}/connection.json .
cp ../../../${{ env.BUILD_DIR }}/Dockerfile .
cp ../../../${{ env.BUILD_DIR }}/metadata.json .
cp ../../../${{ env.BUILD_DIR }}/logging.properties .
cp ../../../${{ env.BUILD_DIR }}/docker-entrypoint.sh .
- name: Build image
run: |
pushd lightswitch-chaincode/build/libs
ls -rotl
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag .
echo "imageTag=${imageTag}" >> $GITHUB_ENV

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
docker push ${{ env.imageTag }}

# steps:
# -
# name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# -
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# -
# name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# -
# name: Build and push
# uses: docker/build-push-action@v2
# with:
# build-obsidian-lightswitch-chaincode:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
# - name: Checkout the Obsidian repo
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
# with:
# repository: mcoblenz/Obsidian
# path: './Obsidian'
# - name: Modify Obsidian build contents
# run: |
# pushd ./Obsidian
#
# # Upgrade protocol buffer
# sed -i 's|"protobuf-java" % "3\.11\.4"|"protobuf-java" % "3\.19\.1"|g' build.sbt
# sed -i "s|'protobuf-java', version: '3.11.4'|'protobuf-java', version: '3.19.1'|g" fabric/java/build.gradle
#
# # Upgrade chaincode shim
# sed -i 's|"fabric-chaincode-shim" % "1\.4\.4"|"fabric-chaincode-shim" % "2\.2\.3"|g' build.sbt
# sed -i "s|'fabric-chaincode-shim', version: '1.4.4'|'fabric-chaincode-shim', version: '2.2.3'|g" fabric/java/build.gradle
#
# # Skips running the tests.
# mv ./src/test ./src/test_save
#
# sbt assembly
# popd
# - name: Execute Obsidian compiler
# run: |
# # Install prerequisite - protobuf
# wget https://github.com/protocolbuffers/protobuf/releases/download/v21.1/protoc-21.1-linux-x86_64.zip -P /tmp
# unzip -d /tmp/protoc /tmp/protoc-21.1-linux-x86_64.zip
# export PATH=/tmp/protoc/bin:${PATH}
# protoc --version
# pwd
# ./Obsidian/bin/obsidianc obsidian/contracts/simple/lightswitch.obs --output-path out/
# ls -rotl out/LightSwitch
#
# - name: Execute Gradle
# run: |
# pushd out/LightSwitch
#
# docker run --rm -u root -v "$PWD":/home/gradle/project -w /home/gradle/project ${{ env.DOCKER_REGISTRY }}/${{ env.CUSTOM_BUILDER_IMAGE_NAME }}:${{ env.CUSTOM_BUILDER_IMAGE_VERSION }} gradle build shadowJar #-x checkstyleMain -x checkstyleTest
# ls -rotl build/libs
# echo "buildRoot=${PWD}" >> $GITHUB_ENV
# popd
# - name: Publish chaincode jar
# uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
# with:
# name: lightswitch-chaincode
# path: |
# out/LightSwitch
#
# docker-lightswitch-chaincode:
# runs-on: ubuntu-latest
# needs: [build-obsidian-lightswitch-chaincode]
# env:
# IMAGE_NAME: obsidian-lightswitch
# IMAGE_VERSION: v0.0.0
# BUILD_DIR: chaincode/lightswitch/docker/
# permissions:
# packages: write
# contents: read
# steps:
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
# - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
# - name: Prepare
# run: |
# pushd lightswitch-chaincode/build/libs
# ls -rotl ../../../${{ env.BUILD_DIR }}
# cp ../../../${{ env.BUILD_DIR }}/chaincode.env .
# cp ../../../${{ env.BUILD_DIR }}/connection.json .
# cp ../../../${{ env.BUILD_DIR }}/Dockerfile .
# cp ../../../${{ env.BUILD_DIR }}/metadata.json .
# cp ../../../${{ env.BUILD_DIR }}/logging.properties .
# cp ../../../${{ env.BUILD_DIR }}/docker-entrypoint.sh .
# - name: Build image
# run: |
# pushd lightswitch-chaincode/build/libs
# ls -rotl
# imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
# docker build --tag $imageTag .
# echo "imageTag=${imageTag}" >> $GITHUB_ENV
#
# - name: Log in to registry
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
#
# - name: Push image
# run: |
# docker push ${{ env.imageTag }}
#
# # steps:
# # -
# # name: Set up QEMU
# # uses: docker/setup-qemu-action@v1
# # -
# # name: Set up Docker Buildx
# # uses: docker/setup-buildx-action@v1
# # -
# # name: Login to DockerHub
# # uses: docker/login-action@v1
# # with:
# # registry: ghcr.io
# # username: ${{ github.actor }}
# # password: ${{ secrets.GITHUB_TOKEN }}
# # -
# # name: Build and push
# # uses: docker/build-push-action@v2
# # with:
# context: "{{defaultContext}}:api"
# push: true
# tags: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v2
uses: github/codeql-action/init@277b89701e930e6af7a758f50afa5185bfc53c81 # v2

with:
languages: ${{ matrix.language }}
Expand All @@ -58,7 +58,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3
uses: github/codeql-action/autobuild@277b89701e930e6af7a758f50afa5185bfc53c81 # v3

# Command-line programs to run using the OS shell.
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -71,7 +71,7 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3
uses: github/codeql-action/analyze@277b89701e930e6af7a758f50afa5185bfc53c81 # v3

with:
category: "/language:${{ matrix.language }}"
Expand Down
Loading