Cache page assets during CI/CD
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 3m39s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m24s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 3m30s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 3m39s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m24s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 3m30s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
This commit is contained in:
parent
e7b1f845da
commit
536d8a8b71
@ -6,32 +6,38 @@ env:
|
|||||||
DOCKER_HOST: tcp://127.0.0.1:2375
|
DOCKER_HOST: tcp://127.0.0.1:2375
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# test:
|
test:
|
||||||
# strategy:
|
strategy:
|
||||||
# matrix:
|
matrix:
|
||||||
# arch:
|
arch:
|
||||||
# - x86_64
|
- x86_64
|
||||||
# # arm64
|
# arm64
|
||||||
#
|
|
||||||
# name: Test Application
|
name: Test Application
|
||||||
# runs-on: docker-${{ matrix.arch }}
|
runs-on: docker-${{ matrix.arch }}
|
||||||
# container:
|
container:
|
||||||
# image: docker:dind
|
image: docker:dind
|
||||||
# privileged: true
|
privileged: true
|
||||||
#
|
|
||||||
# steps:
|
steps:
|
||||||
# - name: Environment Setup
|
- name: Environment Setup
|
||||||
# run: |
|
run: |
|
||||||
# # If we have a proxy use it
|
# If we have a proxy use it
|
||||||
# if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
|
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
|
||||||
# # Some pre-reqs
|
# Some pre-reqs
|
||||||
# apk add git nodejs npm
|
apk add git nodejs npm tar zstd
|
||||||
# ## Some debugging info
|
## Some debugging info
|
||||||
# # env|sort
|
# env|sort
|
||||||
#
|
|
||||||
# - name: Code Checkout
|
- name: Code Checkout
|
||||||
# uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
#
|
|
||||||
|
- name: Build Assets
|
||||||
|
run: |
|
||||||
|
# Build assets
|
||||||
|
npm i
|
||||||
|
npm run prod
|
||||||
|
|
||||||
# - name: Run Tests
|
# - name: Run Tests
|
||||||
# run: |
|
# run: |
|
||||||
# mv .env.testing .env
|
# mv .env.testing .env
|
||||||
@ -43,19 +49,32 @@ jobs:
|
|||||||
# php artisan key:generate
|
# php artisan key:generate
|
||||||
# php artisan migrate
|
# php artisan migrate
|
||||||
# php artisan db:seed
|
# php artisan db:seed
|
||||||
# # Build assets
|
|
||||||
# npm i
|
|
||||||
# npm run prod
|
|
||||||
# # run laravel tests
|
# # run laravel tests
|
||||||
# # XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text --colors=never
|
# # XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text --colors=never
|
||||||
|
|
||||||
|
- name: Cache page assets
|
||||||
|
id: cache-page-assets
|
||||||
|
uses: actions/cache@v3
|
||||||
|
# env:
|
||||||
|
# cache-name: page-assets
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
public/css/app.css
|
||||||
|
public/js/app.js
|
||||||
|
public/js/manifest.js
|
||||||
|
public/js/vendor.js
|
||||||
|
#key: build-pla-page-assets-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
key: build-pla-page-assets
|
||||||
|
#restore-keys: |
|
||||||
|
# build-pla-page-assets-
|
||||||
|
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
arch:
|
arch:
|
||||||
- x86_64
|
- x86_64
|
||||||
- arm64
|
- arm64
|
||||||
# needs: [test]
|
needs: [test]
|
||||||
|
|
||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
runs-on: docker-${{ matrix.arch }}
|
runs-on: docker-${{ matrix.arch }}
|
||||||
@ -72,7 +91,7 @@ jobs:
|
|||||||
# If we have a proxy use it
|
# If we have a proxy use it
|
||||||
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
|
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
|
||||||
# Some pre-reqs
|
# Some pre-reqs
|
||||||
apk add git curl nodejs npm
|
apk add git curl nodejs npm tar zstd
|
||||||
# Start docker
|
# Start docker
|
||||||
( dockerd --host=tcp://0.0.0.0:2375 --tls=false & ) && sleep 3
|
( dockerd --host=tcp://0.0.0.0:2375 --tls=false & ) && sleep 3
|
||||||
## Some debugging info
|
## Some debugging info
|
||||||
@ -95,16 +114,36 @@ jobs:
|
|||||||
- name: Code Checkout
|
- name: Code Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Cache page assets
|
||||||
|
id: cache-page-assets
|
||||||
|
uses: actions/cache@v3
|
||||||
|
# env:
|
||||||
|
# cache-name: page-assets
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
public/css/app.css
|
||||||
|
public/js/app.js
|
||||||
|
public/js/manifest.js
|
||||||
|
public/js/vendor.js
|
||||||
|
#key: build-pla-page-assets-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
key: build-pla-page-assets
|
||||||
|
#restore-keys: |
|
||||||
|
# build-pla-page-assets-
|
||||||
|
|
||||||
|
- if: ${{ steps.cache-page-assets.outputs.cache-hit != 'true' }}
|
||||||
|
name: List the state of page assets
|
||||||
|
continue-on-error: false
|
||||||
run: |
|
run: |
|
||||||
# Build assets
|
echo CACHE-HIT:${{ steps.cache-page-assets.outputs.cache-hit }}
|
||||||
npm i
|
ls -al public/css/
|
||||||
npm run prod
|
ls -al public/js/
|
||||||
|
|
||||||
- name: Record version and Delete Unnecessary files
|
- name: Record version and Delete Unnecessary files
|
||||||
run: |
|
run: |
|
||||||
echo ${GITHUB_SHA::8} > VERSION
|
echo ${GITHUB_SHA::8} > VERSION
|
||||||
rm -rf .git* tests/ storage/app/test/
|
rm -rf .git* tests/ storage/app/test/
|
||||||
|
ls -al public/css/
|
||||||
|
ls -al public/js/
|
||||||
|
|
||||||
- name: Build and Push Docker Image
|
- name: Build and Push Docker Image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
|
Loading…
Reference in New Issue
Block a user