From 05a51306f98ac7fcb759d80124acfb0d464855c7 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Wed, 2 Aug 2023 17:33:04 +0200 Subject: [PATCH] ci: fix misuse of env --- .github/workflows/_pr_entrypoint.yaml | 59 ++++++++++++++++----- .github/workflows/build_slim_packages.yaml | 22 ++++++-- .github/workflows/check_deps_integrity.yaml | 11 +++- .github/workflows/elixir_release.yaml | 11 +++- .github/workflows/run_conf_tests.yaml | 23 ++++---- .github/workflows/run_docker_tests.yaml | 7 ++- .github/workflows/run_jmeter_tests.yaml | 15 +++--- .github/workflows/run_relup_tests.yaml | 11 +++- .github/workflows/run_test_cases.yaml | 18 ++++--- .github/workflows/spellcheck.yaml | 6 ++- .github/workflows/static_checks.yaml | 8 ++- 11 files changed, 142 insertions(+), 49 deletions(-) diff --git a/.github/workflows/_pr_entrypoint.yaml b/.github/workflows/_pr_entrypoint.yaml index f3d1eaa27..fad8206e9 100644 --- a/.github/workflows/_pr_entrypoint.yaml +++ b/.github/workflows/_pr_entrypoint.yaml @@ -8,19 +8,22 @@ env: OTP_VSN: "25.3.2-1" ELIXIR_VSN: "1.14.5" BUILDER_VSN: "25.3.2-1" - BUILDER: "ghcr.io/emqx/emqx-builder/5.1-3:1.14.5-25.3.2-1-ubuntu22.04" - RUNNER: ${{ github.repository_owner == 'emqx' && 'aws-amd64' || 'ubuntu-22.04' }} jobs: sanity-checks: - runs-on: ${{ env.RUNNER }} - container: ${{ env.BUILDER }} + runs-on: ${{ github.repository_owner == 'emqx' && 'aws-amd64' || 'ubuntu-22.04' }} + container: "ghcr.io/emqx/emqx-builder/5.1-3:1.14.5-25.3.2-1-ubuntu22.04" outputs: ct-matrix: ${{ steps.matrix.outputs.ct-matrix }} ct-host: ${{ steps.matrix.outputs.ct-host }} ct-docker: ${{ steps.matrix.outputs.ct-docker }} version-emqx: ${{ steps.matrix.outputs.version-emqx }} version-emqx-enterprise: ${{ steps.matrix.outputs.version-emqx-enterprise }} + runner: ${{ github.repository_owner == 'emqx' && 'aws-amd64' || 'ubuntu-22.04' }} + builder: "ghcr.io/emqx/emqx-builder/5.1-3:1.14.5-25.3.2-1-ubuntu22.04" + builder_vsn: "25.3.2-1" + otp_vsn: "25.3.2-1" + elixir_vsn: "1.14.5" steps: - uses: actions/checkout@v3 @@ -56,8 +59,8 @@ jobs: echo "version-emqx-enterprise=$(./pkg-vsn.sh emqx-enterprise)" | tee -a $GITHUB_OUTPUT compile: - runs-on: ${{ env.RUNNER }} - container: ${{ env.BUILDER }} + runs-on: ${{ needs.sanity-checks.outputs.runner }} + container: ${{ needs.sanity-checks.outputs.builder }} needs: - sanity-checks strategy: @@ -92,6 +95,8 @@ jobs: - compile uses: ./.github/workflows/run_test_cases.yaml with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} ct-matrix: ${{ needs.sanity-checks.outputs.ct-matrix }} ct-host: ${{ needs.sanity-checks.outputs.ct-host }} ct-docker: ${{ needs.sanity-checks.outputs.ct-docker }} @@ -102,48 +107,72 @@ jobs: - compile uses: ./.github/workflows/static_checks.yaml with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} ct-matrix: ${{ needs.sanity-checks.outputs.ct-matrix }} - # build_slim_packages: - # needs: - # - sanity-checks - # uses: ./.github/workflows/build_slim_packages.yaml + build_slim_packages: + needs: + - sanity-checks + uses: ./.github/workflows/build_slim_packages.yaml + with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} + builder_vsn: ${{ needs.sanity-checks.outputs.builder_vsn }} + otp_vsn: ${{ needs.sanity-checks.outputs.otp_vsn }} + elixir_vsn: ${{ needs.sanity-checks.outputs.elixir_vsn }} build_docker_for_test: needs: - sanity-checks uses: ./.github/workflows/build_docker_for_test.yaml with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} version-emqx: ${{ needs.sanity-checks.outputs.version-emqx }} version-emqx-enterprise: ${{ needs.sanity-checks.outputs.version-emqx-enterprise }} - # spellcheck: - # needs: - # - build_slim_packages - # uses: ./.github/workflows/spellcheck.yaml + spellcheck: + needs: + - build_slim_packages + uses: ./.github/workflows/spellcheck.yaml + with: + runner: ${{ needs.sanity-checks.outputs.runner }} run_conf_tests: needs: - sanity-checks - compile uses: ./.github/workflows/run_conf_tests.yaml + with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} check_deps_integrity: needs: - sanity-checks uses: ./.github/workflows/check_deps_integrity.yaml + with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} elixir_release: needs: - sanity-checks - compile uses: ./.github/workflows/elixir_release.yaml + with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} run_relup_tests: needs: - sanity-checks - compile uses: ./.github/workflows/run_relup_tests.yaml + with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} run_jmeter_tests: needs: @@ -151,6 +180,7 @@ jobs: - build_docker_for_test uses: ./.github/workflows/run_jmeter_tests.yaml with: + runner: ${{ needs.sanity-checks.outputs.runner }} version-emqx: ${{ needs.sanity-checks.outputs.version-emqx }} run_docker_tests: @@ -159,6 +189,7 @@ jobs: - build_docker_for_test uses: ./.github/workflows/run_docker_tests.yaml with: + runner: ${{ needs.sanity-checks.outputs.runner }} version-emqx: ${{ needs.sanity-checks.outputs.version-emqx }} version-emqx-enterprise: ${{ needs.sanity-checks.outputs.version-emqx-enterprise }} diff --git a/.github/workflows/build_slim_packages.yaml b/.github/workflows/build_slim_packages.yaml index 1c1d751ad..573294c60 100644 --- a/.github/workflows/build_slim_packages.yaml +++ b/.github/workflows/build_slim_packages.yaml @@ -6,6 +6,22 @@ concurrency: on: workflow_call: + inputs: + runner: + required: true + type: string + builder: + required: true + type: string + builder_vsn: + required: true + type: string + otp_vsn: + required: true + type: string + elixir_vsn: + required: true + type: string # on: # push: # branches: @@ -26,7 +42,7 @@ on: jobs: linux: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} env: EMQX_NAME: ${{ matrix.profile[0] }} @@ -39,7 +55,7 @@ jobs: - ["emqx-enterprise", "25.3.2-1", "amzn2023", "erlang"] - ["emqx-enterprise", "25.3.2-1", "ubuntu20.04", "erlang"] - container: "ghcr.io/emqx/emqx-builder/${{ env.BUILDER }}:${{ env.ELIXIR }}-${{ matrix.profile[1] }}-${{ matrix.profile[2] }}" + container: "ghcr.io/emqx/emqx-builder/${{ inputs.builder_vsn }}:${{ inputs.elixir_vsn }}-${{ matrix.profile[1] }}-${{ matrix.profile[2] }}" steps: - uses: AutoModality/action-clean@v1 @@ -138,7 +154,7 @@ jobs: - emqx - emqx-enterprise otp: - - ${{ env.OTP_VSN }} + - ${{ inputs.otp_vsn }} os: - macos-12-arm64 - macos-13 diff --git a/.github/workflows/check_deps_integrity.yaml b/.github/workflows/check_deps_integrity.yaml index 154c1894a..cb1193edb 100644 --- a/.github/workflows/check_deps_integrity.yaml +++ b/.github/workflows/check_deps_integrity.yaml @@ -2,11 +2,18 @@ name: Check integrity of rebar and mix dependencies on: workflow_call: + inputs: + runner: + required: true + ty pe: string + builder: + required: true + type: string jobs: check_deps_integrity: - runs-on: ${{ env.RUNNER }} - container: ${{ env.BUILDER }} + runs-on: ${{ inputs.runner }} + container: ${{ inputs.builder }} steps: - uses: actions/checkout@v3 - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" diff --git a/.github/workflows/elixir_release.yaml b/.github/workflows/elixir_release.yaml index 1e5a82967..d0b53872d 100644 --- a/.github/workflows/elixir_release.yaml +++ b/.github/workflows/elixir_release.yaml @@ -7,14 +7,21 @@ concurrency: on: workflow_call: + inputs: + runner: + required: true + type: string + builder: + required: true + type: string # on: # pull_request: # workflow_dispatch: jobs: elixir_release_build: - runs-on: ${{ env.RUNNER }} - container: ${{ env.BUILDER }} + runs-on: ${{ inputs.runner }} + container: ${{ inputs.builder }} strategy: matrix: profile: diff --git a/.github/workflows/run_conf_tests.yaml b/.github/workflows/run_conf_tests.yaml index 79162c6a3..8b2388c79 100644 --- a/.github/workflows/run_conf_tests.yaml +++ b/.github/workflows/run_conf_tests.yaml @@ -6,6 +6,13 @@ concurrency: on: workflow_call: + inputs: + runner: + required: true + type: string + builder: + required: true + type: string # on: # push: @@ -19,8 +26,10 @@ on: jobs: run_conf_tests: - runs-on: ${{ env.RUNNER }} - container: ${{ env.BUILDER }} + runs-on: ${{ inputs.runner }} + container: ${{ inputs.builder }} + env: + PROFILE: ${{ matrix.profile }} strategy: fail-fast: false matrix: @@ -36,14 +45,8 @@ jobs: run: | unzip -o -q ${{ matrix.profile }}.zip git config --global --add safe.directory "$GITHUB_WORKSPACE" - - name: check example config files - env: - PROFILE: ${{ matrix.profile }} - run: ./scripts/test/check-example-configs.sh - - name: run conf tests - env: - PROFILE: ${{ matrix.profile }} - run: ./scripts/conf-test/run.sh + - run: ./scripts/test/check-example-configs.sh + - run: ./scripts/conf-test/run.sh - name: print erlang log if: failure() run: | diff --git a/.github/workflows/run_docker_tests.yaml b/.github/workflows/run_docker_tests.yaml index a4eb8bbba..556527c45 100644 --- a/.github/workflows/run_docker_tests.yaml +++ b/.github/workflows/run_docker_tests.yaml @@ -7,6 +7,9 @@ concurrency: on: workflow_call: inputs: + runner: + required: true + type: string version-emqx: required: true type: string @@ -25,7 +28,7 @@ on: jobs: basic-tests: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false @@ -68,7 +71,7 @@ jobs: docker compose rm -fs pytest: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} env: EMQX_NAME: ${{ matrix.profile }} PKG_VSN: ${{ matrix.profile == 'emqx-enterprise' && inputs.version-emqx-enterprise || inputs.version-emqx }} diff --git a/.github/workflows/run_jmeter_tests.yaml b/.github/workflows/run_jmeter_tests.yaml index 1635ddf3a..153f21a39 100644 --- a/.github/workflows/run_jmeter_tests.yaml +++ b/.github/workflows/run_jmeter_tests.yaml @@ -3,6 +3,9 @@ name: JMeter integration tests on: workflow_call: inputs: + runner: + required: true + type: string version-emqx: required: true type: string @@ -16,7 +19,7 @@ on: jobs: jmeter_artifact: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} steps: - uses: AutoModality/action-clean@v1 - name: Cache Jmeter @@ -46,7 +49,7 @@ jobs: path: /tmp/apache-jmeter.tgz advanced_feat: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false @@ -103,7 +106,7 @@ jobs: path: ./jmeter_logs pgsql_authn_authz: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false @@ -181,7 +184,7 @@ jobs: path: ./jmeter_logs mysql_authn_authz: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false @@ -252,7 +255,7 @@ jobs: path: ./jmeter_logs JWT_authn: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false @@ -315,7 +318,7 @@ jobs: path: ./jmeter_logs built_in_database_authn_authz: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false diff --git a/.github/workflows/run_relup_tests.yaml b/.github/workflows/run_relup_tests.yaml index 86e936a1e..3912fc698 100644 --- a/.github/workflows/run_relup_tests.yaml +++ b/.github/workflows/run_relup_tests.yaml @@ -6,6 +6,13 @@ concurrency: on: workflow_call: + inputs: + runner: + required: true + type: string + builder: + required: true + type: string # on: # push: # branches: @@ -16,8 +23,8 @@ on: jobs: relup_test_plan: - runs-on: ${{ env.RUNNER }} - container: ${{ env.BUILDER }} + runs-on: ${{ inputs.runner }} + container: ${{ inputs.builder }} outputs: CUR_EE_VSN: ${{ steps.find-versions.outputs.CUR_EE_VSN }} OLD_VERSIONS: ${{ steps.find-versions.outputs.OLD_VERSIONS }} diff --git a/.github/workflows/run_test_cases.yaml b/.github/workflows/run_test_cases.yaml index 7d3ef8610..e2d2a0abf 100644 --- a/.github/workflows/run_test_cases.yaml +++ b/.github/workflows/run_test_cases.yaml @@ -7,6 +7,12 @@ concurrency: on: workflow_call: inputs: + runner: + required: true + type: string + builder: + required: true + type: string ct-matrix: required: true type: string @@ -32,7 +38,7 @@ env: jobs: eunit_and_proper: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false matrix: @@ -72,7 +78,7 @@ jobs: path: _build/test/cover ct_docker: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false matrix: @@ -119,7 +125,7 @@ jobs: path: _build/test/logs ct: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false matrix: @@ -164,8 +170,8 @@ jobs: - eunit_and_proper - ct - ct_docker - runs-on: ${{ env.RUNNER }} - container: ${{ env.BUILDER }} + runs-on: ${{ inputs.runner }} + container: ${{ inputs.builder }} strategy: fail-fast: false matrix: @@ -205,7 +211,7 @@ jobs: # do this in a separate job upload_coverdata: needs: make_cover - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} steps: - name: Coveralls Finished env: diff --git a/.github/workflows/spellcheck.yaml b/.github/workflows/spellcheck.yaml index 877543152..07308e1a6 100644 --- a/.github/workflows/spellcheck.yaml +++ b/.github/workflows/spellcheck.yaml @@ -6,6 +6,10 @@ concurrency: on: workflow_call: + inputs: + runner: + required: true + type: string # on: # push: # branches: @@ -31,7 +35,7 @@ jobs: profile: - emqx - emqx-enterprise - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} steps: - uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/static_checks.yaml b/.github/workflows/static_checks.yaml index 00bcd4c79..b7fc2444b 100644 --- a/.github/workflows/static_checks.yaml +++ b/.github/workflows/static_checks.yaml @@ -7,6 +7,12 @@ concurrency: on: workflow_call: inputs: + runner: + required: true + type: string + builder: + required: true + type: string ct-matrix: required: true type: string @@ -26,7 +32,7 @@ env: jobs: static_checks: - runs-on: ${{ env.RUNNER }} + runs-on: ${{ inputs.runner }} strategy: fail-fast: false matrix: