mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
set webapp cache delete job wo run only, if needed jobs were successful
This commit is contained in:
parent
b712e3084e
commit
715ab9d0cb
195
.github/workflows/test-webapp.yml
vendored
195
.github/workflows/test-webapp.yml
vendored
@ -1,115 +1,118 @@
|
||||
# name: ocelot.social webapp test CI
|
||||
name: ocelot.social webapp test CI
|
||||
|
||||
|
||||
# on: [push]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- fix-runner
|
||||
|
||||
# jobs:
|
||||
# files-changed:
|
||||
# name: Detect File Changes - Webapp
|
||||
# runs-on: ubuntu-latest
|
||||
# outputs:
|
||||
# docker: ${{ steps.changes.outputs.docker }}
|
||||
# webapp: ${{ steps.changes.outputs.webapp }}
|
||||
# steps:
|
||||
# - uses: actions/checkout@v3.3.0
|
||||
jobs:
|
||||
files-changed:
|
||||
name: Detect File Changes - Webapp
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
docker: ${{ steps.changes.outputs.docker }}
|
||||
webapp: ${{ steps.changes.outputs.webapp }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.3.0
|
||||
|
||||
# - name: Check for frontend file changes
|
||||
# uses: dorny/paths-filter@v2.11.1
|
||||
# id: changes
|
||||
# with:
|
||||
# token: ${{ github.token }}
|
||||
# filters: .github/file-filters.yml
|
||||
# list-files: shell
|
||||
- name: Check for frontend file changes
|
||||
uses: dorny/paths-filter@v2.11.1
|
||||
id: changes
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
filters: .github/file-filters.yml
|
||||
list-files: shell
|
||||
|
||||
# prepare:
|
||||
# name: Prepare
|
||||
# if: needs.files-changed.outputs.webapp == 'true'
|
||||
# needs: files-changed
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v3
|
||||
prepare:
|
||||
name: Prepare
|
||||
if: needs.files-changed.outputs.webapp == 'true'
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# - name: Check translation files
|
||||
# run: |
|
||||
# scripts/translations/sort.sh
|
||||
# scripts/translations/missing-keys.sh
|
||||
- name: Check translation files
|
||||
run: |
|
||||
scripts/translations/sort.sh
|
||||
scripts/translations/missing-keys.sh
|
||||
|
||||
# build_test_webapp:
|
||||
# name: Docker Build Test - Webapp
|
||||
# if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||
# needs: [files-changed, prepare]
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v3
|
||||
build_test_webapp:
|
||||
name: Docker Build Test - Webapp
|
||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||
needs: [files-changed, prepare]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# - name: Webapp | Build 'test' image
|
||||
# run: |
|
||||
# docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
||||
# docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar
|
||||
- name: Webapp | Build 'test' image
|
||||
run: |
|
||||
docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
||||
docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar
|
||||
|
||||
# - name: Cache docker image
|
||||
# uses: actions/cache/save@v3.3.1
|
||||
# with:
|
||||
# path: /tmp/webapp.tar
|
||||
# key: ${{ github.run_id }}-webapp-cache
|
||||
- name: Cache docker image
|
||||
uses: actions/cache/save@v3.3.1
|
||||
with:
|
||||
path: /tmp/webapp.tar
|
||||
key: ${{ github.run_id }}-webapp-cache
|
||||
|
||||
# lint_webapp:
|
||||
# name: Lint Webapp
|
||||
# if: needs.files-changed.outputs.webapp == 'true'
|
||||
# needs: files-changed
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v3
|
||||
lint_webapp:
|
||||
name: Lint Webapp
|
||||
if: needs.files-changed.outputs.webapp == 'true'
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# - name: webapp | Lint
|
||||
# run: cd webapp && yarn && yarn run lint
|
||||
- name: webapp | Lint
|
||||
run: cd webapp && yarn && yarn run lint
|
||||
|
||||
# unit_test_webapp:
|
||||
# name: Unit Tests - Webapp
|
||||
# if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||
# needs: [files-changed, build_test_webapp]
|
||||
# runs-on: ubuntu-latest
|
||||
# permissions:
|
||||
# checks: write
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@v3
|
||||
unit_test_webapp:
|
||||
name: Unit Tests - Webapp
|
||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||
needs: [files-changed, build_test_webapp]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
checks: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# - name: Restore webapp cache
|
||||
# uses: actions/cache/restore@v3.3.1
|
||||
# with:
|
||||
# path: /tmp/webapp.tar
|
||||
# key: ${{ github.run_id }}-webapp-cache
|
||||
- name: Restore webapp cache
|
||||
uses: actions/cache/restore@v3.3.1
|
||||
with:
|
||||
path: /tmp/webapp.tar
|
||||
key: ${{ github.run_id }}-webapp-cache
|
||||
|
||||
# - name: Load Docker Image
|
||||
# run: docker load < /tmp/webapp.tar
|
||||
- name: Load Docker Image
|
||||
run: docker load < /tmp/webapp.tar
|
||||
|
||||
# - name: Copy env files
|
||||
# run: |
|
||||
# cp webapp/.env.template webapp/.env
|
||||
# cp backend/.env.template backend/.env
|
||||
- name: Copy env files
|
||||
run: |
|
||||
cp webapp/.env.template webapp/.env
|
||||
cp backend/.env.template backend/.env
|
||||
|
||||
# - name: backend | docker-compose
|
||||
# run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp
|
||||
- name: backend | docker-compose
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp
|
||||
|
||||
# - name: webapp | Unit tests incl. coverage check
|
||||
# run: docker-compose exec -T webapp yarn test
|
||||
- name: webapp | Unit tests incl. coverage check
|
||||
run: docker-compose exec -T webapp yarn test
|
||||
|
||||
# cleanup:
|
||||
# name: Cleanup
|
||||
# if: (needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true') || success()
|
||||
# needs: [files-changed, unit_test_webapp]
|
||||
# runs-on: ubuntu-latest
|
||||
# continue-on-error: true
|
||||
# steps:
|
||||
# - name: Delete cache
|
||||
# env:
|
||||
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# run: |
|
||||
# gh extension install actions/gh-actions-cache
|
||||
# KEY="${{ github.run_id }}-webapp-cache"
|
||||
# gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
|
||||
cleanup:
|
||||
name: Cleanup
|
||||
if: ${{ needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true' }}
|
||||
needs: [files-changed, unit_test_webapp]
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Delete cache
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
KEY="${{ github.run_id }}-webapp-cache"
|
||||
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user