name: NX Integration Test #description: Workflow to run NX assisted integration tests for Mage-OS projects. on: workflow_call: inputs: repository: type: string description: "Repository" required: true pr_head: type: string description: "head SHA" required: true pr_base: type: string description: "pr base SHA" required: true workflow_dispatch: inputs: repository: type: string description: "Repository" required: true pr_head: type: string description: "head SHA" required: true pr_base: type: string description: "pr base SHA" required: true jobs: debug: name: Debug runs-on: ubuntu-latest steps: - name: debug shell: bash env: repository: ${{ inputs.repository }} pr_head: ${{ inputs.pr_head }} pr_base: ${{ inputs.pr_base }} run: | echo "input was" echo "repository: ${repository}" echo "pr_head: ${pr_head}" echo "pr_base: ${pr_base}" matrix-calculator: outputs: php_versions: ${{ steps.calculate-matrix.outputs.php_versions }} database_versions: ${{ steps.calculate-matrix.outputs.database_versions }} search_versions: ${{ steps.calculate-matrix.outputs.search_versions }} message_queue_versions: ${{ steps.calculate-matrix.outputs.message_queue_versions }} cache_versions: ${{ steps.calculate-matrix.outputs.cache_versions }} http_cache_versions: ${{ steps.calculate-matrix.outputs.http_cache_versions }} runs-on: ubuntu-latest steps: - name: Run Matrix Calulator id: calculate-matrix uses: mage-os/github-actions/supported-services-matrix-calculator@main with: repository: ${{ inputs.repository }} ref: ${{ inputs.pr_head }} - name: Calculated Result shell: bash env: php_versions: ${{ steps.calculate-matrix.outputs.php_versions }} database_versions: ${{ steps.calculate-matrix.outputs.database_versions }} search_versions: ${{ steps.calculate-matrix.outputs.search_versions }} message_queue_versions: ${{ steps.calculate-matrix.outputs.message_queue_versions }} cache_versions: ${{ steps.calculate-matrix.outputs.cache_versions }} http_cache_versions: ${{ steps.calculate-matrix.outputs.http_cache_versions }} run: | echo "PHP Versions: $php_versions" echo "database_versions: $database_versions" echo "search_versions: $search_versions" echo "message_queue_versions: $message_queue_versions" echo "cache_versions: $cache_versions" echo "http_cache_versions: $http_cache_versions" nx-project-setup: runs-on: ubuntu-latest steps: - name: Run Nx Project Setup uses: mage-os/github-actions/nx-integration-tests-setup@main with: repository: ${{ inputs.repository }} ref: ${{ inputs.pr_head }} pr_base: ${{ inputs.pr_base }} integration-tests: needs: - matrix-calculator - nx-project-setup strategy: fail-fast: false matrix: php_version: ${{ fromJSON(needs.matrix-calculator.outputs.php_versions) }} database_version: ${{ fromJSON(needs.matrix-calculator.outputs.database_versions) }} search_version: ${{ fromJSON(needs.matrix-calculator.outputs.search_versions) }} message_queue_version: ${{ fromJSON(needs.matrix-calculator.outputs.message_queue_versions) }} cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.cache_versions) }} http_cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.http_cache_versions) }} runs-on: ubuntu-latest steps: - name: Project Cache uses: actions/cache/restore@v4 with: path: main key: ${{ runner.os }}-project-${{ inputs.ref }} # could probably swap this to a docker container in future - name: Install NX working-directory: ./main run: | npm install -g nx@^15.4 - name: Print Affected working-directory: ./main run: | AFFECTED_OUTPUT=/tmp/affect.json nx print-affected --head=HEAD --base=remotes/origin/${{ inputs.pr_base }} > ${AFFECTED_OUTPUT} cat ${AFFECTED_OUTPUT} echo "Affected Projects: $(jq .projects ${AFFECTED_OUTPUT})" - name: Setup Warden Environment uses: mage-os/github-actions/warden/setup-environment@main with: php_version: ${{ matrix.php_version }} database: ${{ matrix.database_version }} search: ${{ matrix.search_version }} rabbitmq: ${{ matrix.message_queue_version }} redis: ${{ matrix.cache_version }} varnish: ${{ matrix.http_cache_version }} base_directory: "./main" - name: Setup config for Integration tests uses: mage-os/github-actions/warden/integration-tests@main with: search: ${{ matrix.search_version }} rabbitmq: ${{ matrix.message_queue_version }} redis: ${{ matrix.cache_version }} run_memory_test: 0 run_magento_integration_tests: 0 run_magento_integration_tests_real_suite: 0 base_directory: "./main" - name: Run Integration Tests (Real) working-directory: ./main run: | export WARDEN="$(dirname $(pwd))/warden/bin/warden" nx affected --target=test:integration --head=HEAD --base=remotes/origin/${{ inputs.pr_base }}