fix(satp): testing ci #78
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SATP-Hermes Gateway tests and docker deployments | |
name: SATP-Hermes Gateway | |
env: | |
NODEJS_VERSION: v18.19.0 | |
on: | |
pull_request: | |
branches: [main, satp-dev] | |
push: | |
branches: [main, satp-dev] | |
jobs: | |
build-dev-satp: | |
runs-on: ubuntu-22.04 | |
continue-on-error: false | |
env: | |
NODEJS_VERSION: v18.19.0 | |
FULL_BUILD_DISABLED: true | |
TOOLS_VALIDATE_BUNDLE_NAMES_DISABLED: true | |
CUSTOM_CHECKS_DISABLED: true | |
CONFIGURE_DISABLED: false | |
CHECK_WORK_TREE_STATUS_DISABLED: true | |
steps: | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ env.NODEJS_VERSION }} | |
- uses: actions/[email protected] | |
- id: yarn-cache | |
name: Initialize Yarn Cache | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | |
path: ./.yarn/ | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- if: steps.yarn-cache.outputs.cache-hit != 'true' | |
name: Run CI script | |
run: ./tools/ci.sh | |
run-satp-tests: | |
needs: build-dev-satp | |
runs-on: ubuntu-22.04 | |
env: | |
NODEJS_VERSION: v18.19.0 | |
FULL_BUILD_DISABLED: true | |
JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts | |
JEST_TEST_RUNNER_DISABLED: false | |
# SATP specific configuration | |
SATP_ENABLE_CRASH_RECOVERY: false | |
SATP_ENABLE_OPEN_API: false | |
SATP_LOG_LEVEL: DEBUG | |
SATP_ENABLE_LOCAL_REPOSITORY: true | |
SATP_ENABLE_REMOTE_REPOSITORY: false | |
steps: | |
- uses: actions/[email protected] | |
- name: Use Node.js ${{ env.NODEJS_VERSION }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ env.NODEJS_VERSION }} | |
- run: ./tools/ci.sh | |
set-docker-tags: | |
needs: run-satp-tests | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/satp-dev') | |
runs-on: ubuntu-22.04 | |
outputs: | |
tag_suffix: ${{ steps.set_tags.outputs.tag_suffix }} | |
tag_version: ${{ steps.set_tags.outputs.tag_version }} | |
dockerhub_image: ${{ steps.set_tags.outputs.dockerhub_image }} | |
ghcr_image: ${{ steps.set_tags.outputs.ghcr_image }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Debug Build Info | |
run: | | |
PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').version)") | |
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}" | |
echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}" | |
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}" | |
echo "Debug: Package version = ${PACKAGE_VERSION}" | |
echo "Debug: Commit hash = $(git rev-parse --short HEAD)" | |
- name: Set image tags | |
id: set_tags | |
run: | | |
TAG_SUFFIX=$(if [ "${{ github.ref }}" = "refs/heads/main" ]; then echo "prod"; else echo "dev"; fi) | |
TAG_VERSION="$(date -u +"%Y-%m-%dT%H-%M-%S")-${TAG_SUFFIX}-$(git rev-parse --short HEAD)" | |
DOCKERHUB_IMAGE="hyperledger/satp-hermes-gateway" | |
GHCR_IMAGE="ghcr.io/hyperledger-cacti/satp-hermes-gateway" | |
echo "Debug: Setting tag suffix = ${TAG_SUFFIX}" | |
echo "Debug: Setting tag version = ${TAG_VERSION}" | |
echo "Debug: Setting dockerhub image = ${DOCKERHUB_IMAGE}" | |
echo "Debug: Setting ghcr image = ${GHCR_IMAGE}" | |
echo "tag_suffix=${TAG_SUFFIX}" >> $GITHUB_OUTPUT | |
echo "tag_version=${TAG_VERSION}" >> $GITHUB_OUTPUT | |
echo "dockerhub_image=${DOCKERHUB_IMAGE}" >> $GITHUB_OUTPUT | |
echo "ghcr_image=${GHCR_IMAGE}" >> $GITHUB_OUTPUT | |
build-and-push-dockerhub: | |
needs: set-docker-tags | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/satp-dev') | |
runs-on: ubuntu-22.04 | |
env: | |
NODEJS_VERSION: v18.19.0 | |
steps: | |
- uses: actions/[email protected] | |
- name: Debug Build Info | |
run: | | |
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}" | |
echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}" | |
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}" | |
echo "Debug: Working directory content:" | |
ls -la | |
echo "Debug: SATP plugin directory content:" | |
ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found" | |
- name: Use Node.js ${{ env.NODEJS_VERSION }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ env.NODEJS_VERSION }} | |
- name: Configure and build bundle | |
run: | | |
echo "Debug: Starting bundle configuration and build" | |
yarn configure | |
echo "Debug: Yarn configure completed" | |
yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes | |
echo "Debug: Bundle build completed" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Debug Docker Info | |
run: | | |
echo "Debug: Docker version:" | |
docker version | |
echo "Debug: Docker info:" | |
docker info | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./packages/cactus-plugin-satp-hermes/ | |
file: ./packages/cactus-plugin-satp-hermes/satp-hermes-gateway.Dockerfile | |
push: true | |
labels: | | |
org.opencontainers.image.source=https://github.com/hyperledger/cacti | |
org.opencontainers.image.description=SATP Hermes Gateway | |
org.opencontainers.image.licenses=Apache-2.0 | |
org.opencontainers.image.vendor=Hyperledger | |
org.opencontainers.image.version=${{ needs.set-docker-tags.outputs.tag_version }} | |
org.opencontainers.image.visibility=public | |
tags: | | |
${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }} | |
${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest | |
build-and-push-ghcr: | |
needs: set-docker-tags | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/satp-dev') | |
runs-on: ubuntu-22.04 | |
env: | |
NODEJS_VERSION: v18.19.0 | |
steps: | |
- uses: actions/[email protected] | |
- name: Debug Build Info | |
run: | | |
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}" | |
echo "Debug: Building for GHCR image = ${{ needs.set-docker-tags.outputs.ghcr_image }}" | |
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}" | |
echo "Debug: Working directory content:" | |
ls -la | |
echo "Debug: SATP plugin directory content:" | |
ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found" | |
- name: Use Node.js ${{ env.NODEJS_VERSION }} | |
uses: actions/[email protected] | |
with: | |
node-version: ${{ env.NODEJS_VERSION }} | |
- name: Configure and build bundle | |
run: | | |
echo "Debug: Starting bundle configuration and build" | |
yarn configure | |
echo "Debug: Yarn configure completed" | |
yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes | |
echo "Debug: Bundle build completed" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Debug Docker Info | |
run: | | |
echo "Debug: Docker version:" | |
docker version | |
echo "Debug: Docker info:" | |
docker info | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./packages/cactus-plugin-satp-hermes/ | |
file: ./packages/cactus-plugin-satp-hermes/satp-hermes-gateway.Dockerfile | |
push: true | |
labels: | | |
org.opencontainers.image.source=https://github.com/hyperledger/cacti | |
org.opencontainers.image.description=SATP Hermes Gateway | |
org.opencontainers.image.licenses=Apache-2.0 | |
org.opencontainers.image.vendor=Hyperledger | |
org.opencontainers.image.version=${{ needs.set-docker-tags.outputs.tag_version }} | |
org.opencontainers.image.visibility=public | |
tags: | | |
${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }} | |
${{ needs.set-docker-tags.outputs.ghcr_image }}:latest |