Skip to content

Commit

Permalink
test arm64 download
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielcocenza committed May 13, 2024
1 parent fce62c1 commit e8c3eec
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 68 deletions.
129 changes: 66 additions & 63 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ name: Check workflow running linter, unit and functional tests

on:
workflow_call:
outputs:
snap-arm64:
description: "Filename of the built arm64 snap artifact"
value: ${{ jobs.build-arm64.outputs.snap }}

workflow_dispatch:
pull_request:
types: [ opened, synchronize, reopened ]
Expand Down Expand Up @@ -70,8 +65,39 @@ jobs:
- name: Run mocked-plans tests
run: tox -e mocked-plans

build-amd64:
name: Build snap amd64
# build-amd64:
# name: Build snap amd64
# needs: lint-unit
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# - name: Install tox
# run: |
# python -m pip install --upgrade pip
# python -m pip install tox
# - name: Setup LXD
# uses: canonical/[email protected]
# with:
# channel: latest/stable
# - name: Install snapcraft
# run: sudo snap install snapcraft --classic
# - name: Build snap
# run: make build
# - name: Upload the built snap as an artifact
# uses: actions/upload-artifact@v4
# with:
# name: SNAP_FILE
# path: charmed-openstack-upgrader_amd64.snap

build-arm64:
name: Build snap arm64
needs: lint-unit
runs-on: ubuntu-latest
timeout-minutes: 30
Expand Down Expand Up @@ -99,58 +125,39 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: SNAP_FILE
path: charmed-openstack-upgrader.snap
path: charmed-openstack-upgrader_arm64.snap

build-arm64:
needs: lint-unit
name: Build snap arm64
runs-on: [self-hosted, ARM64]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build snap locally
uses: snapcore/action-build@v1
id: snapcraft

- name: Upload locally built snap artifact
uses: actions/upload-artifact@v4
with:
name: local-${{ steps.snapcraft.outputs.snap }}
path: ${{ steps.snapcraft.outputs.snap }}


func-amd64:
name: Functional tests amd64
needs: build-amd64
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup Juju 2.9/stable environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
juju-channel: 2.9/stable
- name: Remove tox install by actions-operator
run: sudo apt remove tox -y
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Download snap file artifact
uses: actions/download-artifact@v4
with:
name: SNAP_FILE
- name: Run func tests
run: TEST_SNAP=$GITHUB_WORKSPACE/charmed-openstack-upgrader.snap tox -e func
# func-amd64:
# name: Functional tests amd64
# needs: build-amd64
# runs-on: ubuntu-latest
# timeout-minutes: 120
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.10'
# - name: Setup Juju 2.9/stable environment
# uses: charmed-kubernetes/actions-operator@main
# with:
# provider: lxd
# juju-channel: 2.9/stable
# - name: Remove tox install by actions-operator
# run: sudo apt remove tox -y
# - name: Install tox
# run: |
# python -m pip install --upgrade pip
# python -m pip install tox
# - name: Download snap file artifact
# uses: actions/download-artifact@v4
# with:
# name: SNAP_FILE
# - name: Run func tests
# run: TEST_SNAP=$GITHUB_WORKSPACE/charmed-openstack-upgrader_amd64.snap tox -e func

func-arm64:
name: Functional tests arm64
Expand All @@ -161,10 +168,6 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install jq
run: sudo snap install jq
- name: Install juju-crashdump
run: sudo snap install juju-crashdump --classic
- name: Setup Juju 2.9/stable environment
uses: charmed-kubernetes/actions-operator@main
with:
Expand All @@ -179,6 +182,6 @@ jobs:
- name: Download snap file artifact
uses: actions/download-artifact@v4
with:
name: local-${{ needs.build-arm64.outputs.snap }}
name: SNAP_FILE
- name: Run func tests
run: TEST_SNAP=$GITHUB_WORKSPACE/local-${{ needs.build-arm64.outputs.snap }} tox -e func
run: TEST_SNAP=$GITHUB_WORKSPACE/charmed-openstack-upgrader_arm64.snap tox -e func
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PYTHON := /usr/bin/python3

PROJECTPATH=$(dir $(realpath ${MAKEFILE_LIST}))
SNAP_NAME=$(shell cat ${PROJECTPATH}/snap/snapcraft.yaml | grep -E '^name:' | awk '{print $$2}')
SNAP_FILE=${PROJECTPATH}/${SNAP_NAME}.snap
SNAP_FILE=$(shell ls *.snap)

help:
@echo "This project supports the following targets"
Expand Down Expand Up @@ -47,6 +47,7 @@ clean:
@echo "Cleaning snap"
@snapcraft clean --use-lxd
@echo "Cleaning existing snap builds"
@echo "${SNAP_FILE}"
@rm -rf ${SNAP_FILE}

dev-environment:
Expand Down
10 changes: 6 additions & 4 deletions rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
# This file is managed by bootstack-charms-spec and should not be modified
# within individual snap repos. https://launchpad.net/bootstack-charms-spec

file_name=$(ls *.snap)
snap=$(grep -E "^name:" snap/snapcraft.yaml | awk '{print $2}')
echo "renaming ${snap}_*.snap to ${snap}.snap"
arch=$(echo "$file_name" | awk -F'_' '{print $NF}' | awk -F'.' '{print $(NF-1)}')
echo "renaming ${file_name} to ${snap}_${arch}.snap"
echo -n "pwd: "
pwd
ls -al
echo "Removing previous snap if it exists"
if [[ -e "${snap}.snap" ]];
if [[ -e "${snap}_${arch}.snap" ]];
then
rm "${snap}.snap"
rm "${snap}_${arch}.snap"
fi
echo "Renaming snap here."
mv ${snap}_*.snap ${snap}.snap
mv ${file_name} ${snap}_${arch}.snap

0 comments on commit e8c3eec

Please sign in to comment.