Skip to content

Commit 118eeef

Browse files
committed
ci(satp-hermes): address action lint errors
Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>
1 parent dbbfbab commit 118eeef

File tree

1 file changed

+83
-67
lines changed

1 file changed

+83
-67
lines changed

.github/workflows/satp-hermes-gateway.yaml

Lines changed: 83 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ jobs:
6060
else
6161
npm run preinstall || { echo "Preinstall failed"; exit 1; }
6262
export PATH="${XDG_CONFIG_HOME:-$HOME}/.foundry/bin:$PATH"
63-
if [ -f ~/.bashrc ]; then
64-
source ~/.bashrc
63+
if [ -f "${HOME}/.bashrc" ]; then
64+
# shellcheck source=/dev/null
65+
source "${HOME}/.bashrc"
6566
fi
6667
foundryup
6768
fi
@@ -90,9 +91,11 @@ jobs:
9091
- name: Run linting
9192
continue-on-error: true
9293
run: |
93-
yarn lint-code || echo "Linting completed with warnings"
94-
yarn lint:oapi || echo "OpenAPI linting completed with warnings"
95-
yarn lint:protobuf || echo "Protobuf linting completed with warnings"
94+
{
95+
yarn lint-code || echo "Linting completed with warnings"
96+
yarn lint:oapi || echo "OpenAPI linting completed with warnings"
97+
yarn lint:protobuf || echo "Protobuf linting completed with warnings"
98+
}
9699
97100
run-satp-tests:
98101
needs: build-satp-dev
@@ -136,7 +139,8 @@ jobs:
136139
if: steps.cache.outputs.cache-hit != 'true'
137140
run: |
138141
curl -L https://foundry.paradigm.xyz | bash
139-
source $HOME/.bashrc && foundryup
142+
# shellcheck source=/dev/null
143+
source "${HOME}/.bashrc" && foundryup
140144
141145
- name: Install dependencies
142146
if: steps.cache.outputs.cache-hit != 'true'
@@ -153,7 +157,7 @@ jobs:
153157

154158
# Set Docker tags based on branch and commit information
155159
set-docker-tags:
156-
needs: run-satp-tests
160+
needs: run-satp-tests
157161
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/satp-dev')
158162
runs-on: ubuntu-22.04
159163
outputs:
@@ -163,18 +167,6 @@ jobs:
163167
ghcr_image: ${{ steps.set_tags.outputs.ghcr_image }}
164168
steps:
165169
- uses: actions/checkout@v4.1.7
166-
- name: Debug Build Info
167-
run: |
168-
PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').version)")
169-
echo "Debug: Current ref = ${{ github.ref }}"
170-
echo "Debug: Event name = ${{ github.event_name }}"
171-
echo "Debug: GitHub workspace = ${{ github.workspace }}"
172-
echo "Debug: Repository = ${{ github.repository }}"
173-
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
174-
echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}"
175-
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
176-
echo "Debug: Package version = ${PACKAGE_VERSION}"
177-
echo "Debug: Commit hash = $(git rev-parse --short HEAD)"
178170
- name: Set image tags
179171
id: set_tags
180172
run: |
@@ -183,16 +175,28 @@ jobs:
183175
DOCKERHUB_IMAGE="hyperledger/satp-hermes-gateway"
184176
GHCR_IMAGE="ghcr.io/hyperledger-cacti/satp-hermes-gateway"
185177
186-
echo "Debug: Setting tag suffix = ${TAG_SUFFIX}"
187-
echo "Debug: Setting tag version = ${TAG_VERSION}"
188-
echo "Debug: Setting dockerhub image = ${DOCKERHUB_IMAGE}"
189-
echo "Debug: Setting ghcr image = ${GHCR_IMAGE}"
190-
191-
echo "tag_suffix=${TAG_SUFFIX}" >> $GITHUB_OUTPUT
192-
echo "tag_version=${TAG_VERSION}" >> $GITHUB_OUTPUT
193-
echo "dockerhub_image=${DOCKERHUB_IMAGE}" >> $GITHUB_OUTPUT
194-
echo "ghcr_image=${GHCR_IMAGE}" >> $GITHUB_OUTPUT
195-
178+
{
179+
echo "tag_suffix=${TAG_SUFFIX}"
180+
echo "tag_version=${TAG_VERSION}"
181+
echo "dockerhub_image=${DOCKERHUB_IMAGE}"
182+
echo "ghcr_image=${GHCR_IMAGE}"
183+
} >> "$GITHUB_OUTPUT"
184+
185+
- name: Debug Build Info
186+
run: |
187+
PACKAGE_VERSION=$(node -e "console.log(require('./packages/cactus-plugin-satp-hermes/package.json').version)")
188+
{
189+
echo "Debug: Current ref = ${{ github.ref }}"
190+
echo "Debug: Event name = ${{ github.event_name }}"
191+
echo "Debug: GitHub workspace = ${{ github.workspace }}"
192+
echo "Debug: Repository = ${{ github.repository }}"
193+
echo "Debug: Building for tag version = ${{ steps.set_tags.outputs.tag_version }}"
194+
echo "Debug: Building for dockerhub image = ${{ steps.set_tags.outputs.dockerhub_image }}"
195+
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
196+
echo "Debug: Package version = ${PACKAGE_VERSION}"
197+
echo "Debug: Commit hash = $(git rev-parse --short HEAD)"
198+
}
199+
196200
# Build and push Docker image to Docker Hub
197201
build-and-push-dockerhub:
198202
needs: set-docker-tags
@@ -204,13 +208,15 @@ jobs:
204208
- uses: actions/checkout@v4.1.7
205209
- name: Debug Build Info
206210
run: |
207-
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
208-
echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}"
209-
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
210-
echo "Debug: Working directory content:"
211-
ls -la
212-
echo "Debug: SATP plugin directory content:"
213-
ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
211+
{
212+
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
213+
echo "Debug: Building for dockerhub image = ${{ needs.set-docker-tags.outputs.dockerhub_image }}"
214+
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
215+
echo "Debug: Working directory content:"
216+
ls -la
217+
echo "Debug: SATP plugin directory content:"
218+
ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
219+
}
214220
215221
- name: Use Node.js ${{ env.NODEJS_VERSION }}
216222
uses: actions/setup-node@v4.0.3
@@ -219,21 +225,25 @@ jobs:
219225

220226
- name: Configure and build bundle
221227
run: |
222-
echo "Debug: Starting bundle configuration and build"
223-
yarn configure
224-
echo "Debug: Yarn configure completed"
225-
yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
226-
echo "Debug: Bundle build completed"
228+
{
229+
echo "Debug: Starting bundle configuration and build"
230+
yarn configure
231+
echo "Debug: Yarn configure completed"
232+
yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
233+
echo "Debug: Bundle build completed"
234+
}
227235
228236
- name: Set up Docker Build
229237
uses: docker/setup-buildx-action@v3
230238

231239
- name: Debug Docker Info
232240
run: |
233-
echo "Debug: Docker version:"
234-
docker version
235-
echo "Debug: Docker info:"
236-
docker info
241+
{
242+
echo "Debug: Docker version:"
243+
docker version
244+
echo "Debug: Docker info:"
245+
docker info
246+
}
237247
238248
- name: Login to Docker Hub
239249
uses: docker/login-action@v3
@@ -260,9 +270,9 @@ jobs:
260270

261271
- name: Tag and push latest to Docker Hub
262272
run: |
263-
docker pull ${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }}
264-
docker tag ${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }} ${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest
265-
docker push ${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest
273+
docker pull "${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }}"
274+
docker tag "${{ needs.set-docker-tags.outputs.dockerhub_image }}:${{ needs.set-docker-tags.outputs.tag_version }}" "${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest"
275+
docker push "${{ needs.set-docker-tags.outputs.dockerhub_image }}:latest"
266276
267277
# Build and push Docker image to GitHub Container Registry
268278
build-and-push-ghcr:
@@ -275,13 +285,15 @@ jobs:
275285
- uses: actions/checkout@v4.1.7
276286
- name: Debug Build Info
277287
run: |
278-
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
279-
echo "Debug: Building for GHCR image = ${{ needs.set-docker-tags.outputs.ghcr_image }}"
280-
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
281-
echo "Debug: Working directory content:"
282-
ls -la
283-
echo "Debug: SATP plugin directory content:"
284-
ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
288+
{
289+
echo "Debug: Building for tag version = ${{ needs.set-docker-tags.outputs.tag_version }}"
290+
echo "Debug: Building for GHCR image = ${{ needs.set-docker-tags.outputs.ghcr_image }}"
291+
echo "Debug: Node.js version = ${{ env.NODEJS_VERSION }}"
292+
echo "Debug: Working directory content:"
293+
ls -la
294+
echo "Debug: SATP plugin directory content:"
295+
ls -la packages/cactus-plugin-satp-hermes/ || echo "Plugin directory not found"
296+
}
285297
286298
- name: Use Node.js ${{ env.NODEJS_VERSION }}
287299
uses: actions/setup-node@v4.0.3
@@ -290,21 +302,25 @@ jobs:
290302

291303
- name: Configure and build bundle
292304
run: |
293-
echo "Debug: Starting bundle configuration and build"
294-
yarn configure
295-
echo "Debug: Yarn configure completed"
296-
yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
297-
echo "Debug: Bundle build completed"
305+
{
306+
echo "Debug: Starting bundle configuration and build"
307+
yarn configure
308+
echo "Debug: Yarn configure completed"
309+
yarn lerna run build:bundle --scope=@hyperledger/cactus-plugin-satp-hermes
310+
echo "Debug: Bundle build completed"
311+
}
298312
299313
- name: Set up Docker Build
300314
uses: docker/setup-buildx-action@v3
301315

302316
- name: Debug Docker Info
303317
run: |
304-
echo "Debug: Docker version:"
305-
docker version
306-
echo "Debug: Docker info:"
307-
docker info
318+
{
319+
echo "Debug: Docker version:"
320+
docker version
321+
echo "Debug: Docker info:"
322+
docker info
323+
}
308324
309325
- name: Login to GHCR
310326
uses: docker/login-action@v3
@@ -332,6 +348,6 @@ jobs:
332348

333349
- name: Tag and push latest to GHCR
334350
run: |
335-
docker pull ${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}
336-
docker tag ${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }} ${{ needs.set-docker-tags.outputs.ghcr_image }}:latest
337-
docker push ${{ needs.set-docker-tags.outputs.ghcr_image }}:latest
351+
docker pull "${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}"
352+
docker tag "${{ needs.set-docker-tags.outputs.ghcr_image }}:${{ needs.set-docker-tags.outputs.tag_version }}" "${{ needs.set-docker-tags.outputs.ghcr_image }}:latest"
353+
docker push "${{ needs.set-docker-tags.outputs.ghcr_image }}:latest"

0 commit comments

Comments
 (0)