Skip to content

Update button color of "request ride" on FE #660

Update button color of "request ride" on FE

Update button color of "request ride" on FE #660

Workflow file for this run

name: Go
on:
push:
branches: [ main ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ main ]
env:
GO_VERSION: "1.21"
jobs:
# run change detection
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
location: ${{ steps.filter.outputs.location }}
driver: ${{ steps.filter.outputs.driver }}
frontend: ${{ steps.filter.outputs.frontend }}
route: ${{ steps.filter.outputs.route }}
steps:
# The paths-filter action requires a checkout step for push events.
- if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
location:
- 'services/location/**'
- 'cmd/location.go'
- 'pkg/**'
driver:
- 'services/driver/**'
- 'cmd/driver.go'
- 'pkg/**'
frontend:
- 'services/frontend/**'
- 'cmd/frontend.go'
- 'pkg/**'
route:
- 'services/route/**'
- 'cmd/route.go'
- 'pkg/**'
build:
runs-on: ubuntu-latest
needs: [ changes ]
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-mod-
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-build-
- name: Setup qemu
uses: docker/setup-qemu-action@v1
- name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
env:
RELEASE_TAG: ${{ github.sha }}
run: |
make push-docker
sandbox-route:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.route == 'true' }}
needs: [ build, changes ]
env:
SIGNADOT_ORG: signadot
SIGNADOT_API_KEY: ${{ secrets.SIGNADOT_API_KEY }}
SANDBOX_IMAGE_TAG: ${{ github.sha }}-linux-amd64
SANDBOX_NAME: pr-${{ github.event.number }}-route
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Signadot CLI
run: |
curl -sSLf https://raw.githubusercontent.com/signadot/cli/main/scripts/install.sh | sh
- name: Define Namespace
run: |
echo "Checking for labels..."
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
echo "Labels on PR: $LABELS"
if [[ "$LABELS" == *"istio"* ]]; then
echo "Found istio label"
NAMESPACE="hotrod-istio"
else
echo "istio label not found"
NAMESPACE="hotrod-devmesh"
fi
echo "Using namespace=${NAMESPACE}"
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
- name: Create Sandbox
run: |
echo "Creating sandbox ${SANDBOX_NAME}..."
signadot sandbox apply \
--set name=${SANDBOX_NAME} \
--set github-pr=${{ github.event.number }} \
--set image=signadot/hotrod:${SANDBOX_IMAGE_TAG} \
--set branch=${{ github.head_ref }} \
--set service=route \
--set namespace=${NAMESPACE} \
-f - \
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
- id: get-comment-body
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
run: |
body="https://app.signadot.com/sandbox/name/${SANDBOX_NAME}"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: Find Comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Route Sandbox
- name: Create or update comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body: |
Route Sandbox Ready!
${{ steps.get-comment-body.outputs.body }}
edit-mode: replace
- name: Run Tests
run: |
# Run the proxy
echo "Starting signadot proxy..."
signadot local proxy --sandbox ${SANDBOX_NAME} \
--map grpc://route.${NAMESPACE}:8083@localhost:38083 \
--map http://frontend.${NAMESPACE}:8080@localhost:38080 > /tmp/signadot-proxy.log &
PROXY_PID=$!
sleep 1
cat /tmp/signadot-proxy.log
# Run api tests
echo "Executing tests..."
go install github.com/jstemmer/go-junit-report/v2@latest
TEST_ROUTE_ADDR=localhost:38083 go test -v \
${GITHUB_WORKSPACE}/services/route/ | go-junit-report -set-exit-code -out api-report.xml
# Run integration tests
TEST_FRONTEND_ADDR=localhost:38080 TEST_TARGET_WORKLOAD=route TEST_SANDBOX_NAME=${SANDBOX_NAME} go test -v \
${GITHUB_WORKSPACE}/services/frontend/ | go-junit-report -set-exit-code -out integration-report.xml
# Stop the proxy
echo "Stopping signadot proxy..."
cat /tmp/signadot-proxy.log
kill ${PROXY_PID}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Route Test Results
files: |
*report.xml
sandbox-frontend:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.frontend == 'true' }}
needs: [ build, changes ]
env:
SIGNADOT_ORG: signadot
SIGNADOT_API_KEY: ${{ secrets.SIGNADOT_API_KEY }}
SANDBOX_IMAGE_TAG: ${{ github.sha }}-linux-amd64
SANDBOX_NAME: pr-${{ github.event.number }}-frontend
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Signadot CLI
run: |
curl -sSLf https://raw.githubusercontent.com/signadot/cli/main/scripts/install.sh | sh
- name: Define Namespace
run: |
echo "Checking for labels..."
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
echo "Labels on PR: $LABELS"
if [[ "$LABELS" == *"istio"* ]]; then
echo "Found istio label"
NAMESPACE="hotrod-istio"
else
echo "istio label not found"
NAMESPACE="hotrod-devmesh"
fi
echo "Using namespace=${NAMESPACE}"
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
- name: Create Sandbox
run: |
echo "Creating sandbox ${SANDBOX_NAME}..."
signadot sandbox apply \
--set name=${SANDBOX_NAME} \
--set github-pr=${{ github.event.number }} \
--set image=signadot/hotrod:${SANDBOX_IMAGE_TAG} \
--set branch=${{ github.head_ref }} \
--set service=frontend \
--set namespace=${NAMESPACE} \
-f - \
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
- id: get-comment-body
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
run: |
body="https://app.signadot.com/sandbox/name/${SANDBOX_NAME}"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: Find Comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Frontend Sandbox
- name: Create or update comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body: |
Frontend Sandbox Ready!
${{ steps.get-comment-body.outputs.body }}
edit-mode: replace
- name: Run Tests
run: |
# Run the proxy
echo "Starting signadot proxy..."
signadot local proxy --sandbox ${SANDBOX_NAME} \
--map http://frontend.${NAMESPACE}:8080@localhost:38080 > /tmp/signadot-proxy.log &
PROXY_PID=$!
sleep 1
cat /tmp/signadot-proxy.log
# Run integration tests
echo "Executing tests..."
go install github.com/jstemmer/go-junit-report/v2@latest
TEST_FRONTEND_ADDR=localhost:38080 TEST_TARGET_WORKLOAD=frontend TEST_SANDBOX_NAME=${SANDBOX_NAME} go test -v \
${GITHUB_WORKSPACE}/services/frontend/ | go-junit-report -set-exit-code -out integration-report.xml
# Stop the proxy
echo "Stopping signadot proxy..."
cat /tmp/signadot-proxy.log
kill ${PROXY_PID}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Frontend Test Results
files: |
*report.xml
sandbox-location:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.location == 'true' }}
needs: [ build, changes ]
env:
SIGNADOT_ORG: signadot
SIGNADOT_API_KEY: ${{ secrets.SIGNADOT_API_KEY }}
SANDBOX_IMAGE_TAG: ${{ github.sha }}-linux-amd64
SANDBOX_NAME: pr-${{ github.event.number }}-location
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Signadot CLI
run: |
curl -sSLf https://raw.githubusercontent.com/signadot/cli/main/scripts/install.sh | sh
- name: Define Namespace
run: |
echo "Checking for labels..."
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
echo "Labels on PR: $LABELS"
if [[ "$LABELS" == *"istio"* ]]; then
echo "Found istio label"
NAMESPACE="hotrod-istio"
else
echo "istio label not found"
NAMESPACE="hotrod-devmesh"
fi
echo "Using namespace=${NAMESPACE}"
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
- name: Create Sandbox
run: |
echo "Creating sandbox ${SANDBOX_NAME}..."
signadot sandbox apply \
--set name=${SANDBOX_NAME} \
--set github-pr=${{ github.event.number }} \
--set image=signadot/hotrod:${SANDBOX_IMAGE_TAG} \
--set branch=${{ github.head_ref }} \
--set service=location \
--set namespace=${NAMESPACE} \
-f - \
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
- id: get-comment-body
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
run: |
body="https://app.signadot.com/sandbox/name/${SANDBOX_NAME}"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: Find Comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Location Sandbox
- name: Create or update comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body: |
Location Sandbox Ready!
${{ steps.get-comment-body.outputs.body }}
edit-mode: replace
- name: Run Tests
run: |
# Run the proxy
echo "Starting signadot proxy..."
signadot local proxy --sandbox ${SANDBOX_NAME} \
--map http://location.${NAMESPACE}:8081@localhost:38081 \
--map http://frontend.${NAMESPACE}:8080@localhost:38080 > /tmp/signadot-proxy.log &
PROXY_PID=$!
sleep 1
cat /tmp/signadot-proxy.log
# Run api tests
echo "Executing tests..."
go install github.com/jstemmer/go-junit-report/v2@latest
TEST_LOCATION_ADDR=localhost:38081 go test -v \
${GITHUB_WORKSPACE}/services/location/ | go-junit-report -set-exit-code -out api-report.xml
# Run integration tests
TEST_FRONTEND_ADDR=localhost:38080 TEST_TARGET_WORKLOAD=location TEST_SANDBOX_NAME=${SANDBOX_NAME} go test -v \
${GITHUB_WORKSPACE}/services/frontend/ | go-junit-report -set-exit-code -out integration-report.xml
# Stop the proxy
echo "Stopping signadot proxy..."
cat /tmp/signadot-proxy.log
kill ${PROXY_PID}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Location Test Results
files: |
*report.xml
sandbox-driver:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.driver == 'true' }}
needs: [ build, changes ]
env:
SIGNADOT_ORG: signadot
SIGNADOT_API_KEY: ${{ secrets.SIGNADOT_API_KEY }}
SANDBOX_IMAGE_TAG: ${{ github.sha }}-linux-amd64
SANDBOX_NAME: pr-${{ github.event.number }}-driver
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Signadot CLI
run: |
curl -sSLf https://raw.githubusercontent.com/signadot/cli/main/scripts/install.sh | sh
- name: Define Namespace
run: |
echo "Checking for labels..."
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
echo "Labels on PR: $LABELS"
if [[ "$LABELS" == *"istio"* ]]; then
echo "Found istio label"
NAMESPACE="hotrod-istio"
else
echo "istio label not found"
NAMESPACE="hotrod-devmesh"
fi
echo "Using namespace=${NAMESPACE}"
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
- name: Create Sandbox
run: |
echo "Creating sandbox ${SANDBOX_NAME}..."
signadot sandbox apply \
--set name=${SANDBOX_NAME} \
--set github-pr=${{ github.event.number }} \
--set image=signadot/hotrod:${SANDBOX_IMAGE_TAG} \
--set branch=${{ github.head_ref }} \
--set service=driver \
--set namespace=${NAMESPACE} \
-f - \
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
- id: get-comment-body
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
run: |
body="https://app.signadot.com/sandbox/name/${SANDBOX_NAME}"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: Find Comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Driver Sandbox
- name: Create or update comment
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body: |
Driver Sandbox Ready!
${{ steps.get-comment-body.outputs.body }}
edit-mode: replace
- name: Run Tests
run: |
# Run the proxy
echo "Starting signadot proxy..."
signadot local proxy --sandbox ${SANDBOX_NAME} \
--map http://frontend.${NAMESPACE}:8080@localhost:38080 > /tmp/signadot-proxy.log &
PROXY_PID=$!
sleep 1
cat /tmp/signadot-proxy.log
# Run integration tests
echo "Executing tests..."
go install github.com/jstemmer/go-junit-report/v2@latest
TEST_FRONTEND_ADDR=localhost:38080 TEST_TARGET_WORKLOAD=driver TEST_SANDBOX_NAME=${SANDBOX_NAME} go test -v \
${GITHUB_WORKSPACE}/services/frontend/ | go-junit-report -set-exit-code -out integration-report.xml
# Stop the proxy
echo "Stopping signadot proxy..."
cat /tmp/signadot-proxy.log
kill ${PROXY_PID}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Driver Test Results
files: |
*report.xml