Skip to content

Commit

Permalink
ci: upgrade validation workflow
Browse files Browse the repository at this point in the history
Signed-off-by: mikeee <[email protected]>
  • Loading branch information
mikeee committed Jun 14, 2024
1 parent 33180dd commit 380e1b3
Showing 1 changed file with 35 additions and 14 deletions.
49 changes: 35 additions & 14 deletions .github/workflows/validate_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ jobs:
outputs:
DAPR_INSTALL_URL: ${{ env.DAPR_INSTALL_URL }}
DAPR_CLI_VER: ${{ steps.outputs.outputs.DAPR_CLI_VER }}
DAPR_CLI_REF: ${{ steps.outputs.outputs.DAPR_CLI_REF }}
DAPR_RUNTIME_VER: ${{ steps.outputs.outputs.DAPR_RUNTIME_VER }}
CHECKOUT_REPO: ${{ steps.outputs.outputs.CHECKOUT_REPO }}
CHECKOUT_REF: ${{ steps.outputs.outputs.CHECKOUT_REF }}
DAPR_REF: ${{ steps.outputs.outputs.DAPR_REF }}
GITHUB_SHA: ${{ steps.outputs.outputs.GITHUB_SHA }}
steps:
- name: Parse repository_dispatch payload
if: github.event_name == 'repository_dispatch'
Expand Down Expand Up @@ -79,9 +81,6 @@ jobs:
echo "DAPR_CLI_VER=$CLI_VERSION" >> $GITHUB_ENV
echo "Found $CLI_VERSION"
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}

- name: Checkout Dapr CLI repo to override dapr command.
uses: actions/checkout@v4
if: env.DAPR_CLI_REF != ''
Expand All @@ -98,29 +97,39 @@ jobs:
ref: ${{ env.DAPR_REF }}
path: dapr_runtime

- name: Build dapr cli with referenced commit.
- name: Build dapr cli with referenced commit and override version
if: env.DAPR_CLI_REF != ''
run: |
cd cli
make
echo "artifactPath=$HOME/artifacts/$GITHUB_SHA" >> $GITHUB_ENV
mkdir -p $HOME/artifacts/$GITHUB_SHA/
sudo cp dist/linux_amd64/release/dapr $HOME/artifacts/$GITHUB_SHA/dapr
sudo cp dist/linux_amd64/release/dapr $artifactpath/dapr
CLI_VERSION=edge
echo "DAPR_CLI_VER=$CLI_VERSION" >> $GITHUB_ENV
- name: Build daprd and placement with referenced commit.
- name: Build dapr services with referenced commit and override version
if: env.DAPR_REF != ''
run: |
cd dapr_runtime
make
mkdir -p $HOME/artifacts/$GITHUB_SHA/
cp dist/linux_amd64/release/daprd $HOME/artifacts/$GITHUB_SHA/daprd
cp dist/linux_amd64/release/placement $HOME/artifacts/$GITHUB_SHA/placement
mkdir -p $artifactPath
cp dist/linux_amd64/release/* $artifactPath
RUNTIME_VERSION=edge
echo "DAPR_RUNTIME_VER=$RUNTIME_VERSION" >> $GITHUB_ENV
- name: Build Docker Image
if: env.DAPR_REF != ''
run: |
cd dapr_runtime
docker build --build-arg "PKG_FILES=*" -f ./docker/Dockerfile ./dist/linux_amd64/release -t daprio/dapr:edge-linux-amd64 --output type=tar,dest=$artifactPath/dapr_docker.tar
- name: Upload dapr-artifacts
uses: actions/upload-artifact@v4
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
with:
name: dapr-artifacts
path: $HOME/artifacts/$GITHUB_SHA/
path: ${{ env.artifactPath }}
if-no-files-found: error
retention-days: 1
compression-level: 0
Expand All @@ -130,10 +139,12 @@ jobs:
run: |
echo "DAPR_INSTALL_URL=$DAPR_INSTALL_URL"
echo "DAPR_CLI_VER=$DAPR_CLI_VER" >> "$GITHUB_OUTPUT"
echo "DAPR_CLI_REF=$DAPR_CLI_REF" >> "$GITHUB_OUTPUT"
echo "DAPR_RUNTIME_VER=$DAPR_RUNTIME_VER" >> "$GITHUB_OUTPUT"
echo "CHECKOUT_REPO=$CHECKOUT_REPO" >> "$GITHUB_OUTPUT"
echo "CHECKOUT_REF=$CHECKOUT_REF" >> "$GITHUB_OUTPUT"
echo "DAPR_REF=$DAPR_REF" >> "$GITHUB_OUTPUT"
echo "GITHUB_SHA=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
validate-example:
needs: setup
Expand All @@ -150,6 +161,7 @@ jobs:
DAPR_REF: ${{ github.event.inputs.daprdapr_commit }}
CHECKOUT_REPO: ${{ needs.setup.outputs.CHECKOUT_REPO }}
CHECKOUT_REF: ${{ needs.setup.outputs.CHECKOUT_REF }}
GITHUB_SHA: ${{ needs.setup.outputs.GITHUB_SHA }}

strategy:
fail-fast: false
Expand Down Expand Up @@ -186,16 +198,27 @@ jobs:
name: dapr-artifacts
path: $HOME/artifacts/$GITHUB_SHA/

- name: Display downloaded artifacts
if: env.DAPR_CLI_REF != '' || env.DAPR_REF != ''
run: |
ls ~/artifacts/$GITHUB_SHA
- name: Set up Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Import Dapr Image (edge)
if: env.DAPR_RUNTIME_VER == 'edge'
run: |
cat $HOME/artifacts/$GITHUB_SHA/dapr_docker.tar | docker import - daprio/dapr:edge
- name: Set up Dapr CLI
if: env.DAPR_CLI_REF == ''
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}

- name: Override dapr cli with referenced commit.
- name: Set up Dapr CLI (edge)
if: env.DAPR_CLI_REF != ''
run: |
sudo cp $HOME/artifacts/$GITHUB_SHA/dapr /usr/local/bin/dapr
Expand All @@ -205,13 +228,11 @@ jobs:
dapr uninstall --all
dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}
- name: Override daprd and placement service with referenced commit.
- name: Override daprd with referenced commit.
if: env.DAPR_REF != ''
run: |
mkdir -p $HOME/.dapr/bin/
cp $HOME/artifacts/$GITHUB_SHA/daprd $HOME/.dapr/bin/daprd
docker stop dapr_placement
$HOME/artifacts/$GITHUB_SHA/placement --healthz-port 9091 &
- name: Set up Python ${{ env.PYTHON_VER }}
uses: actions/setup-python@v5
Expand Down

0 comments on commit 380e1b3

Please sign in to comment.