diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index d12ac6d..5e1d756 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -72,10 +72,43 @@ jobs: - name: Run unit tests run: tox -e unit - func: + build: needs: - lint - unit + 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: ${{ matrix.runs-on }} timeout-minutes: 120 @@ -86,7 +119,6 @@ jobs: 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 +152,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: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ac1dc5c..74deeec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,26 +18,27 @@ jobs: release: needs: check - runs-on: ${{ matrix.runs-on }} - strategy: - fail-fast: false - matrix: - runs-on: [[ubuntu-22.04]] + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 with: submodules: true - - name: Initialize lxd # This should dropped once it's implemented on charming-actions itself. https://github.com/canonical/charming-actions/issues/140 - # revision is latest main at time of writing; using because it contains a fix to https://github.com/canonical/setup-lxd/issues/19 - uses: canonical/setup-lxd@2aa6f7caf7d1484298a64192f7f63a6684e648a4 + - name: Download the tested charms + uses: actions/download-artifact@v4 + with: + pattern: charm_* + merge-multiple: true + + - name: List the names of the tested charms + run: | + echo "CHARM_NAMES=$(ls *.charm | paste -sd ,)" >> "$GITHUB_ENV" + echo "${{ env.CHARM_NAMES }}" - - name: Pack and upload to charmhub - uses: canonical/charming-actions/upload-charm@2.6.2 + - name: Upload the tested charms to charmhub + uses: canonical/charming-actions/upload-charm@2.7.0 with: - charmcraft-channel: "3.x/stable" credentials: "${{ secrets.CHARMHUB_TOKEN }}" github-token: "${{ secrets.GITHUB_TOKEN }}" - # Ensure the charm is built in an isolated environment and on the correct base in an lxd container. - destructive-mode: false + built-charm-path: "${{ env.CHARM_NAMES }}"