Skip to content

Commit

Permalink
changes to ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
deantchi committed Aug 30, 2023
1 parent fe4222e commit 1d4823b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
51 changes: 25 additions & 26 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ on:
workflow_dispatch:

jobs:

build:
runs-on: ubuntu-latest
outputs:
version_output: ${{ steps.version_output.outputs.version }}
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -25,7 +26,7 @@ jobs:
persist-credentials: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Docker Meta
id: meta
Expand Down Expand Up @@ -57,16 +58,10 @@ jobs:
name: docker-image
path: /tmp/artifacts/myimage.tar

- name: Create Version Artifact
- name: Create Version output
run: |
echo "${{ steps.meta.outputs.Version }}" > version.txt
id: create_artifact

- name: Upload Version Artifact
uses: actions/upload-artifact@v2
with:
name: version-artifact
path: version.txt
echo "versions=${{ steps.meta.outputs.Version }}" >> "$GITHUB_OUTPUT"
id: version_output

k8s-tests:
runs-on: ubuntu-latest
Expand All @@ -80,8 +75,10 @@ jobs:
path: artifacts

- name: Read version into env var
env:
version: ${{ needs.build.outputs.version_output }}
run: |
echo "version_tag=$(cat artifacts/version.txt)" >> $GITHUB_ENV
echo "version_tag=${{ version }}" >> $GITHUB_ENV
echo "Extracted version tag: $version_tag"
- name: Checkout repository
Expand All @@ -103,21 +100,23 @@ jobs:
- name: Load image
run: |
docker load --input /tmp/artifacts/myimage.tar
docker tag hirosystems/stacks-devnet-api:$version_tag hirosystems/stacks-devnet-api:latest
docker tag hirosystems/stacks-devnet-api:$version_tag hirosystems/stacks-devnet-api:ci
docker image ls -a
- run: k3d image import hirosystems/stacks-devnet-api:latest -c k3d-kube
- run: kubectl create namespace devnet
- run: kubectl create configmap stacks-devnet-api-conf --from-file=./Config.toml --namespace devnet
- run: kubectl apply -f ./templates/ci/stacks-devnet-api.template.yaml

- name: Sleep for 30 seconds
run: sleep 30s
shell: bash

- run: kubectl get all --all-namespaces
- run: kubectl -n devnet get cm
- run: kubectl -n devnet describe po stacks-devnet-api
- name: Deploy k8s manifests
run: |
k3d image import hirosystems/stacks-devnet-api:ci -c k3d-kube
kubectl create namespace devnet
kubectl create configmap stacks-devnet-api-conf --from-file=./Config.toml --namespace devnet
kubectl apply -f ./templates/ci/stacks-devnet-api.template.yaml
echo "sleep for 30 sec"
sleep 30
- name: Sanity check on k8s resources deployed
run: |
kubectl get all --all-namespaces
kubectl -n devnet get cm
kubectl -n devnet describe po stacks-devnet-api
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -164,7 +163,7 @@ jobs:
[email protected]
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Docker Meta
id: meta
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:bullseye as builder
FROM rust:bookworm as builder
WORKDIR /src
COPY . /src

Expand Down
2 changes: 1 addition & 1 deletion templates/ci/stacks-devnet-api.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
containers:
- command: ["stacks-devnet-api"]
name: stacks-devnet-api-container
image: hirosystems/stacks-devnet-api:latest
image: hirosystems/stacks-devnet-api:ci
imagePullPolicy: Never
ports:
- containerPort: 8477
Expand Down

0 comments on commit 1d4823b

Please sign in to comment.