From d8740608074f84f87a1ac65e4820973063096d23 Mon Sep 17 00:00:00 2001 From: Chi Wai Chan Date: Tue, 4 Mar 2025 14:02:37 +0800 Subject: [PATCH] Split build job and func job --- .github/workflows/check.yaml | 61 +++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 3d1218b..6340a7b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -72,21 +72,52 @@ jobs: - name: Run unit tests run: tox -e unit - func: + build: needs: - lint - unit - name: functional tests + name: build charms runs-on: ${{ matrix.runs-on }} timeout-minutes: 120 strategy: fail-fast: false matrix: runs-on: [[ubuntu-22.04]] + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: canonical/craft-actions/charmcraft/pack@main + id: build + with: + verbosity: verbose + channel: "3.x/stable" + + - name: List the names of the built charms + run: echo "${{ steps.build.outputs.charms}}" + + - name: Determine system architecture + run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV + + - name: Upload the tested charms + uses: actions/upload-artifact@v4 + with: + name: built_charms_${{ env.SYSTEM_ARCH }} + path: ./*.charm + + func: + needs: + - build + name: functional tests + runs-on: ubuntu-24.04 + timeout-minutes: 120 + strategy: + fail-fast: false + matrix: test-command: ['tox -e func'] juju-channel: ["2.9/stable", "3.4/stable", "3.5/stable", "3.6/stable"] steps: - - uses: actions/checkout@v4 with: submodules: true @@ -120,18 +151,27 @@ jobs: # set default project to be nested-lxd project juju model-default project=nested-lxd + - name: Determine system architecture + run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV + # These environments are used by zaza in the functional tests (if applicable) - name: Set zaza related environments run: | - if [ "$(uname -m)" = "aarch64" ]; then + if [ "${{ env.SYSTEM_ARCH }}" = "aarch64" ]; then echo "TEST_MODEL_CONSTRAINTS=arch=arm64" >> "$GITHUB_ENV" fi if [[ "${{ matrix.juju-channel }}" =~ 3\.[0-9]+\/stable ]]; then echo "TEST_JUJU3=1" >> "$GITHUB_ENV" # https://github.com/openstack-charmers/zaza/pull/653 fi - - name: Build the charm - run: charmcraft -v pack + - name: Download the built charms + uses: actions/download-artifact@v4 + with: + name: built_charms_${{ env.SYSTEM_ARCH }} + + - name: List the names of the downloaded charms + run: | + ls *.charm - name: Run tests run: | @@ -151,15 +191,6 @@ jobs: env: TEST_JUJU_CHANNEL: ${{ matrix.juju-channel }} - - name: Determine system architecture - run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV - - - name: Upload the tested charms - uses: actions/upload-artifact@v4 - with: - name: charm_${{ env.SYSTEM_ARCH }} - path: ./*.charm - # Save output for debugging - name: Generate debugging information