Skip to content

Commit

Permalink
Split build and func job
Browse files Browse the repository at this point in the history
  • Loading branch information
chanchiwai-ray committed Mar 4, 2025
1 parent d7e3d0a commit 4dd6fd2
Showing 1 changed file with 46 additions and 15 deletions.
61 changes: 46 additions & 15 deletions terraform-plans/templates/github/charm_check.yaml.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -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: ${runs_on}
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: canonical/craft-actions/charmcraft/pack@main
id: build
with:
verbosity: verbose
channel: "${ charmcraft_channel }"

- 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: ${ test_commands }
juju-channel: ${ juju_channels }
steps:

- uses: actions/checkout@v4
with:
submodules: true
Expand All @@ -109,15 +140,24 @@ jobs:
juju-channel: $${{ matrix.juju-channel }}
charmcraft-channel: "${ charmcraft_channel }"
- name: Determine system architecture
run: echo "SYSTEM_ARCH=$(uname -m)" >> $GITHUB_ENV
# This is used by zaza in the functional tests for non-amd64 architectures (if applicable)
- name: Set zaza juju model constraints for architecture
run: |
if [ "$(uname -m)" = "aarch64" ]; then
if [ "$${{ env.SYSTEM_ARCH }}" = "aarch64" ]; then
echo "TEST_MODEL_CONSTRAINTS=arch=arm64" >> "$GITHUB_ENV"
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: |
Expand All @@ -136,15 +176,6 @@ jobs:
TEST_JUJU3: "1" # https://github.com/openstack-charmers/zaza/pull/653
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: built_charms_$${{ env.SYSTEM_ARCH }}
path: ./*.charm
# Save output for debugging
- name: Generate debugging information
Expand Down

0 comments on commit 4dd6fd2

Please sign in to comment.