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