Skip to content

Commit

Permalink
fixup: Further cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
maru-ava committed Jul 1, 2024
1 parent b86900a commit 8bf0318
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 64 deletions.
50 changes: 50 additions & 0 deletions .github/actions/run-monitored-tmpnet-cmd/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Run the provided command in an environment configured to monitor tmpnet networks'
description: 'Run the provided command in an environment configured to monitor tmpnet networks'

inputs:
run:
description: "the bash command to run"
required: true
repo:
default: ${{ github.repository }}
workflow:
default: ${{ github.workflow }}
run_id:
default: ${{ github.run_id }}
run_number:
default: ${{ github.run_number }}
run_attempt:
default: ${{ github.run_attempt }}
job_id:
default: ${{ github.job }}
prometheus_id:
required: true
prometheus_password:
required: true
loki_id:
required: true
loki_password:
required: true


runs:
using: composite
steps:
- name: Start monitoring tmpnet networks
# Only run for the original repo; a forked repo won't have access to the monitoring credentials
if: (inputs.prometheus_id != '')
uses: ./.github/actions/start-monitoring-tmpnet-networks
with:
prometheus_id: ${{ inputs.prometheus_id }}
prometheus_password: ${{ inputs.prometheus_password }}
loki_id: ${{ inputs.loki_id }}
loki_password: ${{ inputs.loki_password }}
- name: Run command
shell: bash
run: ${{ inputs.run }}
env:
GH_WORKFLOW: ${{ inputs.workflow }}
GH_RUN_ID: ${{ inputs.run_id }}
GH_RUN_NUMBER: ${{ inputs.run_number }}
GH_RUN_ATTEMPT: ${{ inputs.run_attempt }}
GH_JOB_ID: ${{ inputs.job }}
33 changes: 0 additions & 33 deletions .github/actions/run-with-gh-env/action.yml

This file was deleted.

46 changes: 15 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,14 @@ jobs:
- name: Build AvalancheGo Binary
shell: bash
run: ./scripts/build.sh -r
- name: Start monitoring tmpnet networks
# Only run for the original repo; a forked repo won't have access to the monitoring credentials
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
uses: ./.github/actions/start-monitoring-tmpnet-networks
with:
owner: avalanchego-e2e
prometheus_id: ${{ secrets.PROMETHEUS_ID }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD }}
loki_id: ${{ secrets.LOKI_ID }}
loki_password: ${{ secrets.LOKI_PASSWORD }}
- name: Run e2e tests
uses: ./.github/actions/run-with-gh-env
uses: ./.github/actions/run-monitored-tmpnet-cmd
with:
run: E2E_SERIAL=1 ./scripts/tests.e2e.sh --delay-network-shutdown
prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}
loki_id: ${{ secrets.LOKI_ID || '' }}
loki_password: ${{ secrets.LOKI_PASSWORD || '' }}
- name: Upload tmpnet network dir
uses: ./.github/actions/upload-tmpnet-artifact
if: always()
Expand All @@ -83,19 +77,14 @@ jobs:
- name: Build AvalancheGo Binary
shell: bash
run: ./scripts/build.sh -r
- name: Start monitoring tmpnet networks
# Only run for the original repo; a forked repo won't have access to the monitoring credentials
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
uses: ./.github/actions/start-monitoring-tmpnet-networks
with:
prometheus_id: ${{ secrets.PROMETHEUS_ID }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD }}
loki_id: ${{ secrets.LOKI_ID }}
loki_password: ${{ secrets.LOKI_PASSWORD }}
- name: Run e2e tests with existing network
uses: ./.github/actions/run-with-gh-env
uses: ./.github/actions/run-monitored-tmpnet-cmd
with:
run: E2E_SERIAL=1 ./scripts/tests.e2e.existing.sh --delay-network-shutdown
prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}
loki_id: ${{ secrets.LOKI_ID || '' }}
loki_password: ${{ secrets.LOKI_PASSWORD || '' }}
- name: Upload tmpnet network dir
uses: ./.github/actions/upload-tmpnet-artifact
if: always()
Expand All @@ -109,19 +98,14 @@ jobs:
- name: Build AvalancheGo Binary
shell: bash
run: ./scripts/build.sh
- name: Start monitoring tmpnet networks
# Only run for the original repo; a forked repo won't have access to the monitoring credentials
if: (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository)
uses: ./.github/actions/start-monitoring-tmpnet-networks
with:
prometheus_id: ${{ secrets.PROMETHEUS_ID }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD }}
loki_id: ${{ secrets.LOKI_ID }}
loki_password: ${{ secrets.LOKI_PASSWORD }}
- name: Run e2e tests
uses: ./.github/actions/run-with-gh-env
uses: ./.github/actions/run-monitored-tmpnet-cmd
with:
run: ./scripts/tests.upgrade.sh
prometheus_id: ${{ secrets.PROMETHEUS_ID || '' }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}
loki_id: ${{ secrets.LOKI_ID || '' }}
loki_password: ${{ secrets.LOKI_PASSWORD || '' }}
- name: Upload tmpnet network dir
uses: ./.github/actions/upload-tmpnet-artifact
if: always()
Expand Down

0 comments on commit 8bf0318

Please sign in to comment.