From 0b0806f19ffb151f5dce9572d7d91ccaa93934d4 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Sun, 14 Jan 2024 11:31:53 +0100 Subject: [PATCH] ci: add smoke test --- .github/workflows/smoke-test.yml | 56 ++++++++++++++++++++++++++++++++ cmd/extension/extension_build.go | 6 ++-- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/smoke-test.yml diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml new file mode 100644 index 00000000..6d97168f --- /dev/null +++ b/.github/workflows/smoke-test.yml @@ -0,0 +1,56 @@ +name: Smoke Test +on: + push: + branches: + - main + pull_request: + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" + cache: true + check-latest: true + + - name: Compile shopware-cli + run: go build + + - name: Checkout Plugin + uses: actions/checkout@v4 + with: + repository: 'FriendsOfShopware/FroshTools' + ref: '75e2013752fd4db7535e4b72b3e3e8d57e531002' + path: 'plugin' + + - name: Create Shopware + run: ./shopware-cli project create shopware 6.5.7.3 + + - name: Build asset of Plugin + run: ./shopware-cli extension zip plugin + + - name: Build asset of Plugin without Git + run: ./shopware-cli extension zip plugin --disable-git + + - name: Validate Plugin + run: ./shopware-cli extension validate FroshTools.zip + + - name: Get Changelog + run: ./shopware-cli extension get-changelog plugin + + - name: Build asset against custom PROJECT_ROOT + env: + SHOPWARE_PROJECT_ROOT: ${{ github.workspace }}/shopware + run: | + mv plugin/.shopware-extension.yml plugin/.shopware-extension-disable.yml + ./shopware-cli extension build plugin + mv plugin/.shopware-extension-disable.yml plugin/.shopware-extension.yml + + - name: Setup the project + run: ./shopware-cli project ci shopware \ No newline at end of file diff --git a/cmd/extension/extension_build.go b/cmd/extension/extension_build.go index 16fe14e6..267f3632 100644 --- a/cmd/extension/extension_build.go +++ b/cmd/extension/extension_build.go @@ -35,10 +35,10 @@ var extensionAssetBundleCmd = &cobra.Command{ validatedExtensions = append(validatedExtensions, ext) } - if os.Getenv("SHOPWARE_PROJECT_ROOT") == "" { - constraint, err := extension.GetShopwareProjectConstraint(os.Getenv("SHOPWARE_PROJECT_ROOT")) + if assetCfg.ShopwareRoot != "" { + constraint, err := extension.GetShopwareProjectConstraint(assetCfg.ShopwareRoot) if err != nil { - return fmt.Errorf("cannot get shopware version constraint from project %s: %w", os.Getenv("SHOPWARE_PROJECT_ROOT"), err) + return fmt.Errorf("cannot get shopware version constraint from project %s: %w", assetCfg.ShopwareRoot, err) } assetCfg.ShopwareVersion = constraint } else {