Skip to content

Commit

Permalink
add some caching
Browse files Browse the repository at this point in the history
  • Loading branch information
ubermanu committed Sep 8, 2023
1 parent 63838e3 commit 04ba3e5
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,26 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
magento-version: [ '2.4.6' ]

env:
MAGENTO_MARKETPLACE_USERNAME: ${{ secrets.MAGENTO_MARKETPLACE_USERNAME }}
MAGENTO_MARKETPLACE_PASSWORD: ${{ secrets.MAGENTO_MARKETPLACE_PASSWORD }}

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2
with:
node-version: '19.x'
registry-url: 'https://registry.npmjs.org'
version: 8

- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
version: 8.2.0
node-version: 19
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -42,26 +47,24 @@ jobs:
run: |
composer global config http-basic.repo.magento.com "${MAGENTO_MARKETPLACE_USERNAME}" "${MAGENTO_MARKETPLACE_PASSWORD}"
- name: Define Magento ROOT for tests
run: echo "Set Magento root to $WORKSPACE"
env:
MAGEFRONT_TEST_MAGENTO_ROOT: ${{ github.workspace }}/magento
- name: Create Magento Project
run: |
composer create-project --no-install --repository-url=https://repo.magento.com/ magento/project-community-edition=${{ matrix.magento-version }} "$GITHUB_WORKSPACE/magento"
- name: Cache Composer packages
uses: actions/cache@v3
- name: Cache Magento Project
id: cache
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
path: ${{ github.workspace }}/magento
key: magento-${{ runner.os }}-${{ matrix.magento-version }}

- name: Create Magento Project
id: create-project
run: |
if [ ! -d "$GITHUB_WORKSPACE/magento/vendor" ]; then
composer create-project --ignore-platform-reqs --repository-url=https://repo.magento.com/ magento/project-community-edition "$GITHUB_WORKSPACE/magento"
cp .github/_fixtures/config.php.dist "$GITHUB_WORKSPACE/magento/app/etc/config.php"
fi
- name: Install Composer Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: composer install --ignore-platform-reqs --no-interaction
working-directory: ${{ github.workspace }}/magento

- name: Add config.php file to Magento
run: cp .github/_fixtures/config.php.dist "$GITHUB_WORKSPACE/magento/app/etc/config.php"

- run: pnpm i
- run: pnpm build
Expand Down

0 comments on commit 04ba3e5

Please sign in to comment.