CLI flag for installing Dapr from mcr instead of docker.io (#133) #635
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
# Copyright 2024 The Drasi Authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- release/* | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
- feature/* | |
- release/* | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-query-container: | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [ | |
{ | |
label: 'Query Host', | |
path: 'query-container/query-host', | |
name: 'query-container-query-host' | |
}, | |
{ | |
label: 'Publish API', | |
path: 'query-container/publish-api', | |
name: 'query-container-publish-api' | |
}, | |
{ | |
label: 'View Service', | |
path: 'query-container/view-svc', | |
name: 'query-container-view-svc' | |
} | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
submodules: true | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
with: | |
install: true | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: buildx-${{ matrix.component.name }} | |
restore-keys: | | |
buildx-${{ matrix.component.name }} | |
- name: Build | |
run: | | |
cd ${{ matrix.component.path }} | |
DOCKERX_OPTS="--output type=docker,dest=${{ github.workspace }}/${{ matrix.component.name }}.tar --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" make | |
- name: Upload artifact | |
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
with: | |
name: image-${{ matrix.component.name }} | |
path: ${{ github.workspace }}/${{ matrix.component.name }}.tar | |
build-control-plane: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
component: [ | |
{ | |
label: 'Management API', | |
path: 'control-planes/mgmt_api', | |
name: 'api' | |
}, | |
{ | |
label: 'k8s Resource Provider', | |
path: 'control-planes/kubernetes_provider', | |
name: 'kubernetes-provider' | |
} | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
with: | |
install: true | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: buildx-${{ matrix.component.name }} | |
restore-keys: | | |
buildx-${{ matrix.component.name }} | |
- name: Build | |
run: | | |
cd ${{ matrix.component.path }} | |
DOCKERX_OPTS="--output type=docker,dest=${{ github.workspace }}/${{ matrix.component.name }}.tar --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" make | |
- name: Upload artifact | |
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
with: | |
name: image-${{ matrix.component.name }} | |
path: ${{ github.workspace }}/${{ matrix.component.name }}.tar | |
build-sources: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
component: [ | |
{ | |
label: 'Change Router', | |
path: 'sources/shared/change-router', | |
name: 'source-change-router' | |
}, | |
{ | |
label: 'Change Dispatcher', | |
path: 'sources/shared/change-dispatcher', | |
name: 'source-change-dispatcher' | |
}, | |
{ | |
label: 'Query API', | |
path: 'sources/shared/query-api', | |
name: 'source-query-api' | |
}, | |
{ | |
label: 'Debezium Reactivator', | |
path: 'sources/relational/debezium-reactivator', | |
name: 'source-debezium-reactivator' | |
}, | |
{ | |
label: 'SQL Proxy', | |
path: 'sources/relational/sql-proxy', | |
name: 'source-sql-proxy' | |
}, | |
{ | |
label: 'CosmosDB Reactivator', | |
path: './sources/cosmosdb/cosmosdb-ffcf-reactivator', | |
name: 'source-cosmosdb-reactivator' | |
}, | |
{ | |
label: 'Gremlin Proxy', | |
path: 'sources/cosmosdb/gremlin-proxy', | |
name: 'source-gremlin-proxy' | |
}, | |
{ | |
label: 'Dataverse Reactivator', | |
path: './sources/dataverse/dataverse-reactivator', | |
name: 'source-dataverse-reactivator' | |
}, | |
{ | |
label: 'Dataverse Proxy', | |
path: './sources/dataverse/dataverse-proxy', | |
name: 'source-dataverse-proxy' | |
}, | |
{ | |
label: 'EventHub Reactivator', | |
path: './sources/eventhub/eventhub-reactivator', | |
name: 'source-eventhub-reactivator' | |
}, | |
{ | |
label: 'EventHub Proxy', | |
path: './sources/eventhub/eventhub-proxy', | |
name: 'source-eventhub-proxy' | |
} | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
with: | |
install: true | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: buildx-${{ matrix.component.name }} | |
restore-keys: | | |
buildx-${{ matrix.component.name }} | |
- name: Build | |
run: | | |
cd ${{ matrix.component.path }} | |
DOCKERX_OPTS="--output type=docker,dest=${{ github.workspace }}/${{ matrix.component.name }}.tar --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" make | |
- name: Upload artifact | |
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
with: | |
name: image-${{ matrix.component.name }} | |
path: ${{ github.workspace }}/${{ matrix.component.name }}.tar | |
build-reactions: | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [ | |
{ | |
label: 'SignalR', | |
path: 'reactions/signalr/signalr-reaction', | |
name: 'reaction-signalr' | |
}, | |
{ | |
label: 'Dataverse', | |
path: './reactions/power-platform/dataverse/dataverse-reaction', | |
name: 'reaction-dataverse' | |
}, | |
{ | |
label: 'Debezium', | |
path: './reactions/debezium/debezium-reaction', | |
name: 'reaction-debezium' | |
}, | |
{ | |
label: 'Debug', | |
path: './reactions/platform/debug-reaction', | |
name: 'reaction-debug' | |
}, | |
{ | |
label: 'EventGrid', | |
path: './reactions/azure/eventgrid-reaction', | |
name: 'reaction-eventgrid' | |
}, | |
{ | |
label: 'Gremlin', | |
path: './reactions/gremlin/gremlin-reaction', | |
name: 'reaction-gremlin' | |
}, | |
{ | |
label: 'Result', | |
path: './reactions/platform/result-reaction', | |
name: 'reaction-result' | |
}, | |
{ | |
label: 'StorageQueue', | |
path: './reactions/azure/storagequeue-reaction', | |
name: 'reaction-storagequeue' | |
}, | |
{ | |
label: 'StoredProc', | |
path: './reactions/sql/storedproc-reaction', | |
name: 'reaction-storedproc' | |
} | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
with: | |
install: true | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: buildx-${{ matrix.component.name }} | |
restore-keys: | | |
buildx-${{ matrix.component.name }} | |
- name: Build | |
run: | | |
cd ${{ matrix.component.path }} | |
DOCKERX_OPTS="--output type=docker,dest=${{ github.workspace }}/${{ matrix.component.name }}.tar --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" make | |
- name: Upload artifact | |
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
with: | |
name: image-${{ matrix.component.name }} | |
path: ${{ github.workspace }}/${{ matrix.component.name }}.tar | |
build-cli: | |
permissions: | |
packages: write | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: '1.21' | |
- name: Cache Go modules | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build | |
working-directory: cli | |
run: make | |
- name: Upload artifact | |
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
with: | |
name: cli | |
path: cli/bin | |
e2e-tests: | |
permissions: | |
packages: write | |
contents: read | |
runs-on: e2e-tester | |
needs: | |
- build-query-container | |
- build-control-plane | |
- build-sources | |
- build-reactions | |
- build-cli | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Download CLI | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: cli | |
path: cli | |
- name: Install Drasi CLI | |
run: | | |
chmod +x ./cli/linux-x64/drasi | |
sudo mv ./cli/linux-x64/drasi /usr/local/bin/drasi | |
- name: Download images | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
path: images | |
pattern: image-* | |
merge-multiple: true | |
- name: Load Docker images | |
run: | | |
find ./images -name "*.tar" | while read -r FILE; do | |
echo "Processing $FILE..." | |
docker load -i $FILE | |
echo "Loaded $(basename "$FILE" .gz) into Docker." | |
done | |
- name: Install Kind | |
run: | | |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.17.0/kind-linux-amd64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
- name: Install Kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x ./kubectl | |
sudo mv ./kubectl /usr/local/bin/kubectl | |
- name: npm install | |
working-directory: e2e-tests | |
run: npm install | |
- name: Run e2e tests | |
working-directory: e2e-tests | |
run: npm test | |