mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
replace artefact download by caching in backend unit test job
This commit is contained in:
parent
7e171fb521
commit
4ec4b36590
46
.github/workflows/test-backend.yml
vendored
46
.github/workflows/test-backend.yml
vendored
@ -10,6 +10,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
backend: ${{ steps.changes.outputs.backend }}
|
backend: ${{ steps.changes.outputs.backend }}
|
||||||
docker: ${{ steps.changes.outputs.docker }}
|
docker: ${{ steps.changes.outputs.docker }}
|
||||||
|
pr-number: ${{ steps.pr.outputs.number }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.3.0
|
- uses: actions/checkout@v3.3.0
|
||||||
|
|
||||||
@ -21,6 +22,10 @@ jobs:
|
|||||||
filters: .github/file-filters.yml
|
filters: .github/file-filters.yml
|
||||||
list-files: shell
|
list-files: shell
|
||||||
|
|
||||||
|
- name: Get pr number
|
||||||
|
id: pr
|
||||||
|
uses: 8BitJonny/gh-get-current-pr@2.2.0
|
||||||
|
|
||||||
build_test_neo4j:
|
build_test_neo4j:
|
||||||
name: Docker Build Test - Neo4J
|
name: Docker Build Test - Neo4J
|
||||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true'
|
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true'
|
||||||
@ -34,17 +39,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker build --target community -t "ocelotsocialnetwork/neo4j-community:test" neo4j/
|
docker build --target community -t "ocelotsocialnetwork/neo4j-community:test" neo4j/
|
||||||
docker save "ocelotsocialnetwork/neo4j-community:test" > /tmp/neo4j.tar
|
docker save "ocelotsocialnetwork/neo4j-community:test" > /tmp/neo4j.tar
|
||||||
|
|
||||||
- name: Get pr number
|
|
||||||
id: pr
|
|
||||||
uses: 8BitJonny/gh-get-current-pr@2.2.0
|
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
id: cache-neo4j
|
id: cache-neo4j
|
||||||
uses: actions/cache/save@v3.3.1
|
uses: actions/cache/save@v3.3.1
|
||||||
with:
|
with:
|
||||||
path: /tmp/neo4j.tar
|
path: /tmp/neo4j.tar
|
||||||
key: backend-neo4j-cache-pr${{ steps.pr.outputs.number }}
|
key: backend-neo4j-cache-pr${{ needs.files-changed.outputs.pr-number }}
|
||||||
|
|
||||||
build_test_backend:
|
build_test_backend:
|
||||||
name: Docker Build Test - Backend
|
name: Docker Build Test - Backend
|
||||||
@ -59,17 +60,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker build --target test -t "ocelotsocialnetwork/backend:test" backend/
|
docker build --target test -t "ocelotsocialnetwork/backend:test" backend/
|
||||||
docker save "ocelotsocialnetwork/backend:test" > /tmp/backend.tar
|
docker save "ocelotsocialnetwork/backend:test" > /tmp/backend.tar
|
||||||
|
|
||||||
- name: Get pr number
|
|
||||||
id: pr
|
|
||||||
uses: 8BitJonny/gh-get-current-pr@2.2.0
|
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
id: cache-backend
|
id: cache-backend
|
||||||
uses: actions/cache/save@v3.3.1
|
uses: actions/cache/save@v3.3.1
|
||||||
with:
|
with:
|
||||||
path: /tmp/backend.tar
|
path: /tmp/backend.tar
|
||||||
key: backend-cache-pr${{ steps.pr.outputs.number }}
|
key: backend-cache-pr${{ needs.files-changed.outputs.pr-number }}
|
||||||
|
|
||||||
lint_backend:
|
lint_backend:
|
||||||
name: Lint Backend
|
name: Lint Backend
|
||||||
@ -94,23 +91,24 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Download Docker Image (Neo4J)
|
- name: Restore Neo4J cache
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/cache/restore@v3.3.1
|
||||||
with:
|
with:
|
||||||
name: docker-neo4j-image
|
path: /tmp/neo4j.tar
|
||||||
path: /tmp
|
key: backend-neo4j-cache-pr${{ needs.files-changed.outputs.pr-number }}
|
||||||
|
fail-on-cache-miss: true
|
||||||
|
|
||||||
- name: Load Docker Image
|
- name: Restore Backend cache
|
||||||
run: docker load < /tmp/neo4j.tar
|
uses: actions/cache/restore@v3.3.1
|
||||||
|
with:
|
||||||
|
path: /tmp/backend.tar
|
||||||
|
key: backend-cache-pr${{ needs.files-changed.outputs.pr-number }}
|
||||||
|
fail-on-cache-miss: true
|
||||||
|
|
||||||
# - name: Download Docker Image (Backend)
|
- name: Load Docker Images
|
||||||
# uses: actions/download-artifact@v3
|
run: |
|
||||||
# with:
|
docker load < /tmp/neo4j.tar
|
||||||
# name: docker-backend-test
|
docker load < /tmp/backend.tar
|
||||||
# path: /tmp
|
|
||||||
|
|
||||||
- name: Load Docker Image
|
|
||||||
run: docker load < /tmp/backend.tar
|
|
||||||
|
|
||||||
- name: backend | copy env files webapp
|
- name: backend | copy env files webapp
|
||||||
run: cp webapp/.env.template webapp/.env
|
run: cp webapp/.env.template webapp/.env
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user