[DPE-2841] Update rockcraft.yaml to use latest rockcraft revision #31
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build ROCK | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
workflow_call: | |
outputs: | |
rock: | |
description: "The rock output of build process." | |
value: ${{ jobs.build.outputs.rock }} | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install tox | |
run: python3 -m pip install tox | |
- name: YAML Lint | |
run: tox -e lint | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
needs: | |
- lint | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup LXD | |
uses: canonical/setup-lxd@main | |
- name: Install dependencies | |
id: install | |
run: | | |
sudo snap install yq | |
sudo snap install rockcraft --classic --edge | |
- name: Build ROCK | |
id: build | |
run: | | |
VERSION=$(yq '.version' rockcraft.yaml) | |
rockcraft pack --verbose | |
echo "rock=charmed-zookeeper_${VERSION}_amd64.rock" >> $GITHUB_OUTPUT | |
- name: Upload locally built ROCK artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: charmed-zookeeper | |
path: ${{ steps.build.outputs.rock }} | |
outputs: | |
rock: ${{ steps.build.outputs.rock }} | |
test: | |
name: Test Image | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Docker | |
run: | | |
sudo snap install docker | |
sudo addgroup --system docker; sudo adduser $USER docker | |
newgrp docker | |
sudo snap disable docker; sudo snap enable docker | |
- name: Install skopeo | |
run: | | |
sudo snap install --devmode --channel edge skopeo | |
- uses: actions/download-artifact@v3 | |
with: | |
name: charmed-zookeeper | |
- name: Test Image | |
run: | | |
sudo skopeo --insecure-policy copy \ | |
oci-archive:${{ needs.build.outputs.rock }} \ | |
docker-daemon:charmed-zookeeper:latest | |
docker run -d -p 2181:2181 charmed-zookeeper:latest | |
sleep 10 | |
CHECK=$(echo srvr | nc localhost 2181 | grep "Mode" | wc -l) | |
if [[ $CHECK != 1 ]]; | |
then | |
echo "Zookeeper service possibly not running" | |
exit 1; | |
else | |
echo "Zookeeper service up and running!" | |
fi |