Skip to content

Commit

Permalink
Check for variables
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroCabeza committed Aug 22, 2024
1 parent b694815 commit 8cb70b0
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 98 deletions.
118 changes: 63 additions & 55 deletions .github/actions/run-transport-interop-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,22 @@ runs:
using: "composite"
steps:

- name: Restore image from cache
id: deps-cache
uses: actions/cache@v3
with:
path: nimbledeps
# Using nim.branch as a simple way to differentiate between nimble using the "pkgs" or "pkgs2" directories.
# The change happened on Nimble v0.14.0.
key: nimbledeps-${{ matrix.nim.branch }}-${{ hashFiles('.pinned') }} # hashFiles returns a different value on windows
- name: Get values
run: |
echo ${{ github.api_url }}
echo ${{ github.event_name }}
echo ${{ github.repository }}
echo ${{ github.repositoryUrl }}
echo ${github.token:0:4}$(printf '%*s' $((${#secret}-4)) | tr ' ' '*')
# - name: Restore image from cache
# id: deps-cache
# uses: actions/cache@v3
# with:
# path: nimbledeps
# # Using nim.branch as a simple way to differentiate between nimble using the "pkgs" or "pkgs2" directories.
# # The change happened on Nimble v0.14.0.
# key: nimbledeps-${{ matrix.nim.branch }}-${{ hashFiles('.pinned') }} # hashFiles returns a different value on windows

# -----< CACHED STEPS >-----

Expand All @@ -54,8 +62,8 @@ runs:
# echo "PUSH_CACHE=true" >> $GITHUB_ENV
# shell: bash

# This depends on where this file is within this repository. This walks up
# from here to the transport-interop folder
# # This depends on where this file is within this repository. This walks up
# # from here to the transport-interop folder
# - run: |
# WORK_DIR=$(realpath "$GITHUB_ACTION_PATH/../../../transport-interop")
# echo "WORK_DIR=$WORK_DIR" >> $GITHUB_OUTPUT
Expand All @@ -66,10 +74,10 @@ runs:
# with:
# node-version: 18

# Existence of /etc/buildkit/buildkitd.toml indicates that this is a
# self-hosted runner. If so, we need to pass the config to the buildx
# action. The config enables docker.io proxy which is required to
# work around docker hub rate limiting.
# # Existence of /etc/buildkit/buildkitd.toml indicates that this is a
# # self-hosted runner. If so, we need to pass the config to the buildx
# # action. The config enables docker.io proxy which is required to
# # work around docker hub rate limiting.
# - run: |
# if test -f /etc/buildkit/buildkitd.toml; then
# echo "config=/etc/buildkit/buildkitd.toml" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -116,44 +124,44 @@ runs:

# -----< CACHED STEPS >-----

- name: Run the test
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
env:
WORKER_COUNT: ${{ inputs.worker-count }}
EXTRA_VERSION: ${{ inputs.extra-versions }}
NAME_FILTER: ${{ inputs.test-filter }}
NAME_IGNORE: ${{ inputs.test-ignore }}
run: npm run test -- --extra-version=$EXTRA_VERSION --name-filter=$NAME_FILTER --name-ignore=$NAME_IGNORE
shell: bash

- name: Print the results
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: cat results.csv
shell: bash

- name: Render results
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: npm run renderResults > ./dashboard.md
shell: bash

- name: Show Dashboard Output
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: cat ./dashboard.md >> $GITHUB_STEP_SUMMARY
shell: bash

- name: Exit with Error
working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
run: |
if grep -q ":red_circle:" ./dashboard.md; then
exit 1
else
exit 0
fi
shell: bash

- uses: actions/upload-artifact@v3
with:
name: test-plans-output
path: |
${{ steps.find-workdir.outputs.WORK_DIR }}/results.csv
${{ steps.find-workdir.outputs.WORK_DIR }}/dashboard.md
# - name: Run the test
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# env:
# WORKER_COUNT: ${{ inputs.worker-count }}
# EXTRA_VERSION: ${{ inputs.extra-versions }}
# NAME_FILTER: ${{ inputs.test-filter }}
# NAME_IGNORE: ${{ inputs.test-ignore }}
# run: npm run test -- --extra-version=$EXTRA_VERSION --name-filter=$NAME_FILTER --name-ignore=$NAME_IGNORE
# shell: bash

# - name: Print the results
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: cat results.csv
# shell: bash

# - name: Render results
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: npm run renderResults > ./dashboard.md
# shell: bash

# - name: Show Dashboard Output
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: cat ./dashboard.md >> $GITHUB_STEP_SUMMARY
# shell: bash

# - name: Exit with Error
# working-directory: ${{ steps.find-workdir.outputs.WORK_DIR }}
# run: |
# if grep -q ":red_circle:" ./dashboard.md; then
# exit 1
# else
# exit 0
# fi
# shell: bash

# - uses: actions/upload-artifact@v3
# with:
# name: test-plans-output
# path: |
# ${{ steps.find-workdir.outputs.WORK_DIR }}/results.csv
# ${{ steps.find-workdir.outputs.WORK_DIR }}/dashboard.md
88 changes: 45 additions & 43 deletions .github/workflows/transport-interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ on:
name: libp2p transport interop test

jobs:
# run-transport-interop:
# runs-on: ['self-hosted', 'linux', 'x64', '4xlarge'] # https://github.com/pl-strflt/tf-aws-gh-runner/blob/main/runners.tf
# steps:
# - uses: actions/checkout@v3
# - uses: ./.github/actions/run-transport-interop-test
# with:
# s3-cache-bucket: libp2p-by-tf-aws-bootstrap
# s3-access-key-id: ${{ vars.S3_AWS_ACCESS_KEY_ID }}
# s3-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }}
# worker-count: 16
run-transport-interop:
runs-on: ['self-hosted', 'linux', 'x64', '4xlarge'] # https://github.com/pl-strflt/tf-aws-gh-runner/blob/main/runners.tf
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/run-transport-interop-test
with:
s3-cache-bucket: libp2p-by-tf-aws-bootstrap
s3-access-key-id: ${{ vars.S3_AWS_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }}
worker-count: 16

# build-without-secrets:
# runs-on: ubuntu-latest
# steps:
Expand All @@ -32,42 +33,43 @@ jobs:
# # It's okay to not run the tests, we only care to check if the tests build without cache.

# test-filter: '"no test matches this, skip all"'
build-docker-container-and-cache:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

# build-docker-container-and-cache:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

- name: Compute file hash
run: |
echo "Computing file hash"
# echo "File hash: ${{ hashFiles('**') }}"
ARCH=docker info -f "{{.Architecture}}"
echo $ARCH
ls /var/lib/docker
# - name: Compute file hash
# run: |
# echo "Computing file hash"
# # echo "File hash: ${{ hashFiles('**') }}"
# ARCH=docker info -f "{{.Architecture}}"
# echo $ARCH
# ls /var/lib/docker

# - name: Fetch cache
# uses: actions/cache@v4
# id: fetch-cache
# with:
# path: /tmp/cache
# key: ${{ runner.os }}-docker-${{ hashFiles('**') }}
# # - name: Fetch cache
# # uses: actions/cache@v4
# # id: fetch-cache
# # with:
# # path: /tmp/cache
# # key: ${{ runner.os }}-docker-${{ hashFiles('**') }}

# - name: Build docker container
# if: steps.cache.outputs.cache-hit != 'true'
# id: docker-build
# run: |
# echo "Building docker container"
# # - name: Build docker container
# # if: steps.cache.outputs.cache-hit != 'true'
# # id: docker-build
# # run: |
# # echo "Building docker container"

# - name: Dump docker container
# if: steps.docker-build.conclusion == 'success'
# run: |
# echo "Dumping docker container"
# # - name: Dump docker container
# # if: steps.docker-build.conclusion == 'success'
# # run: |
# # echo "Dumping docker container"

- name: Load docker container
run: |
echo "Loading docker container"
# - name: Load docker container
# run: |
# echo "Loading docker container"

- name: Hello world
run: |
echo "Hello, World!"
# - name: Hello world
# run: |
# echo "Hello, World!"

0 comments on commit 8cb70b0

Please sign in to comment.