Skip to content

Commit

Permalink
ci: add matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Jun 13, 2024
1 parent b507f47 commit e6079c9
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
49 changes: 48 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Login into Github Docker Registery
- name: Login into Docker Registery
run: echo "${{ secrets.QUAY_ROBOT_PASSWORD }}" | docker login quay.io -u friendsofshopware+devcontainer_gh_actions --password-stdin

- name: Install and configure Namespace CLI
Expand All @@ -48,3 +48,50 @@ jobs:
PHP_VERSION=${{ matrix.version }}
push: true
provenance: false

generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate Matrix
id: generate-matrix
run: |
MATRIX=$(node matrix.mjs)
echo "matrix<<EOF" >> $GITHUB_OUTPUT
echo "$MATRIX" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
build-shopware:
runs-on: ubuntu-latest
needs: generate-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login into Docker Registery
run: echo "${{ secrets.QUAY_ROBOT_PASSWORD }}" | docker login quay.io -u friendsofshopware+devcontainer_gh_actions --password-stdin

- name: Install and configure Namespace CLI
uses: namespacelabs/nscloud-setup@v0

- name: Configure Namespace powered Buildx
uses: namespacelabs/nscloud-setup-buildx-action@v0

- uses: docker/build-push-action@v5
with:
tags: quay.io/friendsofshopware/devcontainer:${{ matrix.swVersion }}-${{ matrix.phpVersion }}
platforms: linux/amd64,linux/arm64
file: Dockerfile.php
build-args: |
PHP_VERSION=${{ matrix.phpVersion }}
SHOPWARE_VERSION=${{ matrix.swVersion }}
push: true
provenance: false
18 changes: 18 additions & 0 deletions matrix.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const swToPHP = await (await fetch('https://raw.githubusercontent.com/FriendsOfShopware/shopware-static-data/main/data/all-supported-php-versions-by-shopware-version.json')).json();

const matrix = [];

for (const swVersion of Object.keys(swToPHP)) {
if (swVersion.indexOf('6.6') !== 0 || swVersion.indexOf('RC') !== -1) {
continue;
}

for (const phpVersion of swToPHP[swVersion]) {
matrix.push({
swVersion,
phpVersion,
});
}
}

console.log(JSON.stringify(matrix, null, 2));

0 comments on commit e6079c9

Please sign in to comment.