Skip to content

Commit

Permalink
Add build rock and charm steps to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmartinspt committed Jan 11, 2024
1 parent 4a15b9b commit 4325bc1
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 18 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Deploy

on:
pull_request:
branches:
- main

env:
CHARMCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS: true
ROCKCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS: true

jobs:
pack-charm:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup LXD
uses: canonical/setup-lxd@main

- name: Setup Charmcraft
run: sudo snap install charmcraft --classic --channel=edge/12f

- name: Pack charm
run: charmcraft pack -v --project-dir ./charm

- name: Upload charm
uses: actions/upload-artifact@v3
with:
name: dqlite-io-charm
path: ./*.charm

pack-rock:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3

- name: Build Assets
run: |
yarn install
yarn run build-css
yarn run build-js
- name: Setup LXD
uses: canonical/setup-lxd@main

- name: Setup Rockcraft
run: sudo snap install rockcraft --classic --channel=edge/12f

- name: Pack Rock
run: rockcraft pack

- name: Upload Rock
uses: actions/upload-artifact@v3
with:
name: dqlite-io-rock
path: ./*.rock

publish-image:
runs-on: ubuntu-latest
needs: pack-rock
outputs:
image_url: ${{ steps.set_image_url.outputs.image_url }}
steps:
- name: Get Rock
uses: actions/dowload-artifact@v3
with:
name: dqlite-io-rock

- name: Set image URL
id: set_image_url
run: echo "image-url=ghcr.io/canonical/dqlite.io:$(date +%s)-${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT

- name: Push to GHCR
run: skopeo --insecure-policy copy oci-archive:$(ls *.rock) docker://${{ steps.set_image_url.outputs.image_url }} --dest-creds "canonical:${{ secrets.GITHUB_TOKEN }}"

deploy:
runs-on: ubuntu-latest
needs: publish-image
steps:
- name: Workflow run ID
run : echo ${{ github.run_id }}
- name: Image URL
run : echo ${{ needs.publish-image.outputs.image_url }}
18 changes: 0 additions & 18 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,6 @@ env:
SECRET_KEY: insecure_test_key

jobs:
run-dotrun:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install dotrun
uses: canonical/install-dotrun@main

- name: Install dependencies
run: dotrun install

- name: Build assets
run: dotrun build

- name: Test site
run: dotrun & curl --head --fail --retry-delay 1 --retry 30 --retry-connrefused http://localhost:8037

lint-python:
runs-on: ubuntu-latest

Expand Down

0 comments on commit 4325bc1

Please sign in to comment.