mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
refactor(workflow): use docker cache (#9294)
This commit is contained in:
parent
b72a7c29dd
commit
fc5d3aca8e
8
.github/workflows/check-documentation.yml
vendored
8
.github/workflows/check-documentation.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
documentation: ${{ steps.changes.outputs.documentation }}
|
documentation: ${{ steps.changes.outputs.documentation }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Check for markdown file changes
|
- name: Check for markdown file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -28,7 +28,7 @@ jobs:
|
|||||||
if: needs.files-changed.outputs.markdown == 'true'
|
if: needs.files-changed.outputs.markdown == 'true'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Remove uncheckable documentation files
|
- name: Remove uncheckable documentation files
|
||||||
run: rm -rf ./CHANGELOG.md # workaround until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/183 has been done
|
run: rm -rf ./CHANGELOG.md # workaround until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/183 has been done
|
||||||
@ -51,10 +51,10 @@ jobs:
|
|||||||
if: needs.files-changed.outputs.documentation == 'true'
|
if: needs.files-changed.outputs.documentation == 'true'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Setup Node 20
|
- name: Setup Node 20
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
|
|||||||
6
.github/workflows/deploy-documentation.yml
vendored
6
.github/workflows/deploy-documentation.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
documentation: ${{ steps.changes.outputs.documentation }}
|
documentation: ${{ steps.changes.outputs.documentation }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Check for file changes
|
- name: Check for file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -27,10 +27,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Setup Node 20
|
- name: Setup Node 20
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
|
|
||||||
|
|||||||
8
.github/workflows/docker-push.yml
vendored
8
.github/workflows/docker-push.yml
vendored
@ -59,7 +59,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
|
||||||
with:
|
with:
|
||||||
@ -81,7 +83,7 @@ jobs:
|
|||||||
type=sha
|
type=sha
|
||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
id: push
|
id: push
|
||||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
with:
|
with:
|
||||||
context: ${{ matrix.app.context }}
|
context: ${{ matrix.app.context }}
|
||||||
target: ${{ matrix.app.target }}
|
target: ${{ matrix.app.target }}
|
||||||
@ -89,3 +91,5 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha,scope=${{ matrix.app.name }}
|
||||||
|
cache-to: type=gha,mode=max,scope=${{ matrix.app.name }}
|
||||||
|
|||||||
8
.github/workflows/publish.yml
vendored
8
.github/workflows/publish.yml
vendored
@ -14,11 +14,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Fetch full History for changelog
|
fetch-depth: 0 # Fetch full History for changelog
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- name: Setup env
|
- name: Setup env
|
||||||
@ -58,11 +58,11 @@ jobs:
|
|||||||
needs: [github_tag]
|
needs: [github_tag]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Fetch full History for changelog
|
fetch-depth: 0 # Fetch full History for changelog
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- name: Setup env
|
- name: Setup env
|
||||||
|
|||||||
56
.github/workflows/test-backend.yml
vendored
56
.github/workflows/test-backend.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
backend: ${{ steps.changes.outputs.backend }}
|
backend: ${{ steps.changes.outputs.backend }}
|
||||||
docker: ${{ steps.changes.outputs.docker }}
|
docker: ${{ steps.changes.outputs.docker }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Check for backend file changes
|
- name: Check for backend file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -28,13 +28,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||||
|
|
||||||
- name: Neo4J | Build 'community' image
|
- name: Neo4J | Build 'community' image
|
||||||
run: |
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
docker compose -f docker-compose.yml -f docker-compose.test.yml build neo4j
|
with:
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
context: neo4j
|
||||||
|
file: neo4j/Dockerfile
|
||||||
|
target: community
|
||||||
|
load: true
|
||||||
|
tags: ghcr.io/ocelot-social-community/ocelot-social/neo4j:community
|
||||||
|
cache-from: type=gha,scope=neo4j
|
||||||
|
cache-to: type=gha,mode=max,scope=neo4j
|
||||||
|
|
||||||
|
- name: Save image for test job
|
||||||
|
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
id: cache-neo4j
|
id: cache-neo4j
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
@ -49,13 +61,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||||
|
|
||||||
- name: backend | Build 'test' image
|
- name: backend | Build 'test' image
|
||||||
run: |
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
docker compose -f docker-compose.yml -f docker-compose.test.yml build backend
|
with:
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
context: backend
|
||||||
|
file: backend/Dockerfile
|
||||||
|
target: test
|
||||||
|
load: true
|
||||||
|
tags: ghcr.io/ocelot-social-community/ocelot-social/backend:test
|
||||||
|
cache-from: type=gha,scope=backend-test
|
||||||
|
cache-to: type=gha,mode=max,scope=backend-test
|
||||||
|
|
||||||
|
- name: Save image for test job
|
||||||
|
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
id: cache-backend
|
id: cache-backend
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
@ -70,15 +94,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version-file: 'backend/.nvmrc'
|
node-version-file: 'backend/.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
cache-dependency-path: 'backend/yarn.lock'
|
||||||
|
|
||||||
- name: backend | Lint
|
- name: backend | Lint
|
||||||
run: cd backend && yarn && yarn run lint
|
run: cd backend && yarn --frozen-lockfile && yarn run lint
|
||||||
|
|
||||||
unit_test_backend:
|
unit_test_backend:
|
||||||
name: Unit tests - Backend
|
name: Unit tests - Backend
|
||||||
@ -89,7 +115,7 @@ jobs:
|
|||||||
checks: write
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Restore Neo4J cache
|
- name: Restore Neo4J cache
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
|
|||||||
96
.github/workflows/test-e2e.yml
vendored
96
.github/workflows/test-e2e.yml
vendored
@ -8,28 +8,52 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||||
|
|
||||||
- name: Copy backend env file
|
- name: Copy backend env file
|
||||||
run: |
|
run: |
|
||||||
cp backend/.env.test_e2e backend/.env
|
cp backend/.env.test_e2e backend/.env
|
||||||
cp webapp/.env.template webapp/.env
|
cp webapp/.env.template webapp/.env
|
||||||
|
|
||||||
- name: Build backend and dependencies
|
- name: Neo4J | Build image
|
||||||
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
|
with:
|
||||||
|
context: neo4j
|
||||||
|
file: neo4j/Dockerfile
|
||||||
|
target: community
|
||||||
|
load: true
|
||||||
|
tags: ghcr.io/ocelot-social-community/ocelot-social/neo4j:community
|
||||||
|
cache-from: type=gha,scope=neo4j
|
||||||
|
cache-to: type=gha,mode=max,scope=neo4j
|
||||||
|
|
||||||
|
- name: Backend | Build image
|
||||||
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
|
with:
|
||||||
|
context: backend
|
||||||
|
file: backend/Dockerfile
|
||||||
|
target: test
|
||||||
|
load: true
|
||||||
|
tags: ghcr.io/ocelot-social-community/ocelot-social/backend:test
|
||||||
|
cache-from: type=gha,scope=backend-test
|
||||||
|
cache-to: type=gha,mode=max,scope=backend-test
|
||||||
|
|
||||||
|
- name: Pull third-party images
|
||||||
run: |
|
run: |
|
||||||
# Build and start all required images for backend
|
docker pull quay.io/minio/minio:latest
|
||||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach neo4j backend --build
|
docker pull quay.io/minio/mc:latest
|
||||||
|
docker pull maildev/maildev:latest
|
||||||
# Save the build images
|
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
- name: Save all images
|
||||||
|
run: |
|
||||||
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
||||||
docker save "quay.io/minio/minio:latest" > /tmp/minio.tar
|
docker save "quay.io/minio/minio:latest" > /tmp/minio.tar
|
||||||
docker save "quay.io/minio/mc:latest" > /tmp/minio-mc.tar
|
docker save "quay.io/minio/mc:latest" > /tmp/minio-mc.tar
|
||||||
docker save "maildev/maildev:latest" > /tmp/mailserver.tar
|
docker save "maildev/maildev:latest" > /tmp/mailserver.tar
|
||||||
|
|
||||||
# Stop the containers
|
|
||||||
docker compose -f docker-compose.yml -f docker-compose.test.yml down
|
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
with:
|
with:
|
||||||
@ -46,19 +70,26 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Copy backend env file
|
- name: Set up Docker Buildx
|
||||||
run: |
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||||
cp backend/.env.test_e2e backend/.env
|
|
||||||
cp webapp/.env.template webapp/.env
|
- name: Webapp | Build 'test' image
|
||||||
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
- name: Build docker image
|
with:
|
||||||
run: |
|
context: .
|
||||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach webapp --build --no-deps
|
file: webapp/Dockerfile
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
target: test
|
||||||
|
load: true
|
||||||
- name: Cache docker image
|
tags: ghcr.io/ocelot-social-community/ocelot-social/webapp:test
|
||||||
|
cache-from: type=gha,scope=webapp-test
|
||||||
|
cache-to: type=gha,mode=max,scope=webapp-test
|
||||||
|
|
||||||
|
- name: Save image for test jobs
|
||||||
|
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
||||||
|
|
||||||
|
- name: Cache docker image
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
with:
|
with:
|
||||||
path: /tmp/webapp.tar
|
path: /tmp/webapp.tar
|
||||||
@ -72,10 +103,10 @@ jobs:
|
|||||||
run: rm -rf /opt/hostedtoolcache
|
run: rm -rf /opt/hostedtoolcache
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.4.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version-file: 'backend/.nvmrc'
|
node-version-file: 'backend/.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
@ -112,7 +143,7 @@ jobs:
|
|||||||
features: ${{ steps.list.outputs.features }}
|
features: ${{ steps.list.outputs.features }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: List feature files
|
- name: List feature files
|
||||||
id: list
|
id: list
|
||||||
@ -134,10 +165,10 @@ jobs:
|
|||||||
run: rm -rf /opt/hostedtoolcache
|
run: rm -rf /opt/hostedtoolcache
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.4.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version-file: 'backend/.nvmrc'
|
node-version-file: 'backend/.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
@ -180,7 +211,14 @@ jobs:
|
|||||||
docker load < /tmp/mailserver.tar
|
docker load < /tmp/mailserver.tar
|
||||||
docker load < /tmp/webapp.tar
|
docker load < /tmp/webapp.tar
|
||||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend mailserver webapp
|
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend mailserver webapp
|
||||||
sleep 90s
|
|
||||||
|
echo "Waiting for backend (max 120s)..."
|
||||||
|
timeout 120 bash -c 'until curl -sf -X POST -H "Content-Type: application/json" -d "{\"query\":\"{__typename}\"}" http://localhost:4000 > /dev/null 2>&1; do sleep 5; done'
|
||||||
|
echo "Backend is ready."
|
||||||
|
|
||||||
|
echo "Waiting for webapp (max 120s)..."
|
||||||
|
timeout 120 bash -c 'until curl -sf http://localhost:3000 > /dev/null 2>&1; do sleep 5; done'
|
||||||
|
echo "Webapp is ready."
|
||||||
|
|
||||||
- name: Full stack tests | run tests
|
- name: Full stack tests | run tests
|
||||||
id: e2e-tests
|
id: e2e-tests
|
||||||
|
|||||||
38
.github/workflows/test-webapp.yml
vendored
38
.github/workflows/test-webapp.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
docker: ${{ steps.changes.outputs.docker }}
|
docker: ${{ steps.changes.outputs.docker }}
|
||||||
webapp: ${{ steps.changes.outputs.webapp }}
|
webapp: ${{ steps.changes.outputs.webapp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Check for frontend file changes
|
- name: Check for frontend file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -28,10 +28,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version-file: 'webapp/.nvmrc'
|
node-version-file: 'webapp/.nvmrc'
|
||||||
|
|
||||||
@ -43,16 +43,28 @@ jobs:
|
|||||||
build_test_webapp:
|
build_test_webapp:
|
||||||
name: Docker Build Test - Webapp
|
name: Docker Build Test - Webapp
|
||||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||||
needs: [files-changed, prepare]
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||||
|
|
||||||
- name: Webapp | Build 'test' image
|
- name: Webapp | Build 'test' image
|
||||||
run: |
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
docker build --target test -f webapp/Dockerfile -t "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" .
|
with:
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
context: .
|
||||||
|
file: webapp/Dockerfile
|
||||||
|
target: test
|
||||||
|
load: true
|
||||||
|
tags: ghcr.io/ocelot-social-community/ocelot-social/webapp:test
|
||||||
|
cache-from: type=gha,scope=webapp-test
|
||||||
|
cache-to: type=gha,mode=max,scope=webapp-test
|
||||||
|
|
||||||
|
- name: Save image for test job
|
||||||
|
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
||||||
|
|
||||||
- name: Cache docker image
|
- name: Cache docker image
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
@ -67,15 +79,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||||
with:
|
with:
|
||||||
node-version-file: 'webapp/.nvmrc'
|
node-version-file: 'webapp/.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
cache-dependency-path: 'webapp/yarn.lock'
|
||||||
|
|
||||||
- name: webapp | Lint
|
- name: webapp | Lint
|
||||||
run: cd webapp && yarn && yarn run lint
|
run: cd webapp && yarn --frozen-lockfile && yarn run lint
|
||||||
|
|
||||||
unit_test_webapp:
|
unit_test_webapp:
|
||||||
name: Unit Tests - Webapp
|
name: Unit Tests - Webapp
|
||||||
@ -86,7 +100,7 @@ jobs:
|
|||||||
checks: write
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Restore webapp cache
|
- name: Restore webapp cache
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
|
|||||||
14
.github/workflows/ui-docker.yml
vendored
14
.github/workflows/ui-docker.yml
vendored
@ -34,26 +34,26 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||||
|
|
||||||
- name: Build development image
|
- name: Build development image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
with:
|
with:
|
||||||
context: ./packages/ui
|
context: ./packages/ui
|
||||||
file: ./packages/ui/Dockerfile
|
file: ./packages/ui/Dockerfile
|
||||||
target: development
|
target: development
|
||||||
push: false
|
push: false
|
||||||
tags: ocelot-social/ui:development
|
tags: ocelot-social/ui:development
|
||||||
cache-from: type=gha
|
cache-from: type=gha,scope=ui-development
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max,scope=ui-development
|
||||||
|
|
||||||
- name: Build production image
|
- name: Build production image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
||||||
with:
|
with:
|
||||||
context: ./packages/ui
|
context: ./packages/ui
|
||||||
file: ./packages/ui/Dockerfile
|
file: ./packages/ui/Dockerfile
|
||||||
target: production
|
target: production
|
||||||
push: false
|
push: false
|
||||||
tags: ocelot-social/ui:latest
|
tags: ocelot-social/ui:latest
|
||||||
cache-from: type=gha
|
cache-from: type=gha,scope=ui-production
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max,scope=ui-production
|
||||||
|
|||||||
@ -3,17 +3,20 @@ FROM node:25.6.1-alpine AS styleguide
|
|||||||
RUN apk --no-cache add git python3 make g++
|
RUN apk --no-cache add git python3 make g++
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY styleguide .
|
COPY styleguide/package.json styleguide/yarn.lock ./
|
||||||
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
||||||
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
||||||
|
COPY styleguide/. .
|
||||||
RUN yarn run build:lib
|
RUN yarn run build:lib
|
||||||
|
|
||||||
FROM node:25.6.1-alpine AS ui-library
|
FROM node:25.6.1-alpine AS ui-library
|
||||||
RUN apk --no-cache add git python3 make g++
|
RUN apk --no-cache add git python3 make g++
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY packages/ui .
|
COPY packages/ui/package.json packages/ui/package-lock.json ./
|
||||||
RUN npm ci
|
RUN --mount=type=cache,target=/root/.npm,sharing=locked \
|
||||||
|
npm ci
|
||||||
|
COPY packages/ui/. .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:25.6.1-alpine AS base
|
FROM node:25.6.1-alpine AS base
|
||||||
@ -47,37 +50,22 @@ ONBUILD RUN tools/merge-locales.sh
|
|||||||
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
||||||
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
||||||
ONBUILD RUN yarn run build
|
ONBUILD RUN yarn run build
|
||||||
ONBUILD RUN mkdir /build
|
ONBUILD RUN mkdir /build && \
|
||||||
ONBUILD RUN cp -r ./.nuxt /build
|
cp -r ./.nuxt ./nuxt.config.js ./config ./constants ./static ./locales ./package.json ./yarn.lock ./scripts /build
|
||||||
ONBUILD RUN cp -r ./nuxt.config.js /build
|
|
||||||
# Copy static files
|
|
||||||
# TODO - this seems not be needed anymore for the new rebranding
|
|
||||||
# TODO - this should be one Folder containing all stuff needed to be copied
|
|
||||||
ONBUILD RUN cp -r ./config/ /build
|
|
||||||
ONBUILD RUN cp -r ./constants /build
|
|
||||||
ONBUILD RUN cp -r ./static /build
|
|
||||||
ONBUILD RUN cp -r ./locales /build
|
|
||||||
ONBUILD RUN cp -r ./package.json ./yarn.lock /build
|
|
||||||
ONBUILD RUN cp -r ./scripts /build
|
|
||||||
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
ONBUILD RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
||||||
cd /build && yarn install --production=true --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
cd /build && yarn install --production=true --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
||||||
|
|
||||||
FROM base AS test_build
|
FROM base AS test_build
|
||||||
ENV NODE_ENV=test
|
ENV NODE_ENV=test
|
||||||
COPY webapp/. .
|
COPY webapp/package.json webapp/yarn.lock ./
|
||||||
RUN tools/merge-locales.sh
|
COPY webapp/scripts ./scripts/
|
||||||
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
||||||
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
yarn install --production=false --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
||||||
|
COPY webapp/. .
|
||||||
|
RUN tools/merge-locales.sh
|
||||||
RUN yarn run build
|
RUN yarn run build
|
||||||
RUN mkdir /build
|
RUN mkdir /build && \
|
||||||
RUN cp -r ./.nuxt /build
|
cp -r ./.nuxt ./nuxt.config.js ./config ./constants ./static ./locales ./package.json ./yarn.lock ./scripts /build
|
||||||
RUN cp -r ./nuxt.config.js /build
|
|
||||||
RUN cp -r ./config/ /build
|
|
||||||
RUN cp -r ./constants /build
|
|
||||||
RUN cp -r ./static /build
|
|
||||||
RUN cp -r ./locales /build
|
|
||||||
RUN cp -r ./package.json ./yarn.lock /build
|
|
||||||
RUN cp -r ./scripts /build
|
|
||||||
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
RUN --mount=type=cache,target=/yarn-cache,sharing=locked \
|
||||||
cd /build && yarn install --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
cd /build && yarn install --frozen-lockfile --non-interactive --cache-folder /yarn-cache
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user