Skip to content
Draft
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
43 changes: 14 additions & 29 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,39 +239,24 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}

# When building images in CI runner
- name: Retrieve build output from external workflow
if: github.event_name == 'workflow_dispatch'
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ needs.init.outputs.current-branch }}
workflow: ${{ env.CI_WORKFLOW }}
name: ${{ env.BUILD_ARTIFACTS }}
path: ${{ env.BUILD_FOLDER }}
if_no_artifact_found: warn
- name: Get Nx apps to build
id: build-apps
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "list=$(yarn get:apps)" >> $GITHUB_OUTPUT
else
echo "list=$(yarn affected:apps | tr -d ' ')" >> $GITHUB_OUTPUT
fi

- name: Check build outputs presence
uses: xSAVIKx/artifact-exists-action@v0
id: check-build-artifact
with:
name: ${{ env.BUILD_ARTIFACTS }}
- name: Build apps
run: npx nx run-many --target=build --parallel=4 --projects=${{ steps.build-apps.outputs.list }} --verbose

- name: Retrieve build output from current workflow
if: github.event_name != 'workflow_dispatch' && steps.check-build-artifact.outputs.exists == 'true'
uses: actions/download-artifact@v4
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACTS }}
path: ${{ env.BUILD_FOLDER }}

- name: Check build artifact existence
id: check-build
uses: andstor/file-existence-action@v2
with:
files: ${{ env.BUILD_FOLDER }}

- if: steps.check-build.outputs.files_exists != 'true'
run: exit 1
retention-days: 5

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -292,7 +277,7 @@ jobs:
use: true

- name: Run Docker build
run: yarn nx run-many --target=docker-build-remote --projects=$(yarn get:apps) --parallel=4 --verbose
run: yarn nx run-many --target=docker-build --conf=development --tag=dev --projects=$(yarn get:apps) --parallel=2 --verbose
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
24 changes: 1 addition & 23 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -445,23 +445,8 @@ jobs:

- run: npx nx-cloud start-ci-run

- name: Get Nx apps to build
id: build-apps
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "list=$(yarn get:apps)" >> $GITHUB_OUTPUT
else
echo "list=$(yarn affected:apps | tr -d ' ')" >> $GITHUB_OUTPUT
fi

- name: Run verifications for affected apps
uses: jameshenry/parallel-bash-commands@v1
with:
cmd1: yarn affected:lint --parallel=4 --exclude=workspace --verbose
cmd2: yarn affected:test --parallel=4 --exclude=workspace --ci --verbose
cmd3: npx nx run-many --target=build --parallel=4 --projects=${{ steps.build-apps.outputs.list }} --verbose
# running e2e tests in parallel create conflicts in DB
# cmd4: NX_CLOUD_DISTRIBUTED_EXECUTION=false yarn affected:e2e:backend --ci --verbose
run: yarn affected -t lint,test,build --parallel=2 --exclude=workspace --ci --verbose

- name: Stop Nx agents
if: always()
Expand All @@ -477,13 +462,6 @@ jobs:
# path: .code-pushup
# retention-days: 5

- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_ARTIFACTS }}
path: ${{ env.BUILD_FOLDER }}
retention-days: 5

- name: Check libs coverage reports existence
id: check-libs-coverage
uses: andstor/file-existence-action@v3
Expand Down
2 changes: 1 addition & 1 deletion apps/auth/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"node ./tools/deploy/build-docker.js -p auth -c {args.conf} -t {args.tag} -f {args.file}"
"node ./tools/deploy/build-docker.js -p auth -c {args.conf} -t {args.tag} -f infra/docker/Dockerfile.backend"
],
"parallel": false
}
Expand Down
2 changes: 1 addition & 1 deletion apps/expiration/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"node ./tools/deploy/build-docker.js -p expiration -c {args.conf} -t {args.tag} -f {args.file}"
"node ./tools/deploy/build-docker.js -p expiration -c {args.conf} -t {args.tag} -f infra/docker/Dockerfile.backend"
],
"parallel": false
}
Expand Down
2 changes: 1 addition & 1 deletion apps/ng-client/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"node ./tools/deploy/build-docker.js -p 'ng-client' -c {args.conf} -t {args.tag} -f {args.file}"
"node ./tools/deploy/build-docker.js -p 'ng-client' -c {args.conf} -t {args.tag} -f infra/docker/Dockerfile.frontend"
],
"parallel": false
}
Expand Down
2 changes: 1 addition & 1 deletion apps/orders/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"node ./tools/deploy/build-docker.js -p orders -c {args.conf} -t {args.tag} -f {args.file}"
"node ./tools/deploy/build-docker.js -p orders -c {args.conf} -t {args.tag} -f infra/docker/Dockerfile.backend"
],
"parallel": false
}
Expand Down
2 changes: 1 addition & 1 deletion apps/payments/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"node ./tools/deploy/build-docker.js -p payments -c {args.conf} -t {args.tag} -f {args.file}"
"node ./tools/deploy/build-docker.js -p payments -c {args.conf} -t {args.tag} -f infra/docker/Dockerfile.backend"
],
"parallel": false
}
Expand Down
2 changes: 1 addition & 1 deletion apps/tickets/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"node ./tools/deploy/build-docker.js -p tickets -c {args.conf} -t {args.tag} -f {args.file}"
"node ./tools/deploy/build-docker.js -p tickets -c {args.conf} -t {args.tag} -f infra/docker/Dockerfile.backend"
],
"parallel": false
}
Expand Down