Added new doc - subnet participants #661
Workflow file for this run
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
name: CI | |
# Only run when: | |
# - PRs are opened | |
# - the workflow is started from the UI | |
on: | |
push: | |
branches: | |
- master | |
tags-ignore: | |
- '**' | |
paths-ignore: | |
- '**/CHANGELOG.md' | |
- '**/.releaserc' | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
# Only cancel in progress if this is for a PR | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
# Run unit tests with code coverage | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run units tests (with coverage) | |
env: | |
DOCKER_BUILDKIT: 1 | |
# Remove .dockerignore file so codecov has access to git info | |
run: | | |
rm .dockerignore | |
docker build -o coverage-output -f ./.github/actions/bitcoin-int-tests/Dockerfile.code-cov . | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage-output/lcov.info | |
name: unit_tests | |
fail_ci_if_error: false | |
# Build subnets image for tests that require stacks-node | |
build-layer-1-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build layer-1 integration testing image | |
env: | |
DOCKER_BUILDKIT: 1 | |
# Remove .dockerignore file so codecov has access to git info | |
run: | | |
rm .dockerignore | |
docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.generic.stacks-node -t subnet-node:integrations . | |
- name: Export docker image as tarball | |
run: docker save -o integration-image.tar subnet-node:integrations | |
- name: Upload built docker image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: integration-image.tar | |
path: integration-image.tar | |
compute-layer-1-tests: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Ubuntu packages | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: ruby-mustache | |
version: 1.0 | |
- name: Install `just` | |
uses: extractions/setup-just@v1 | |
- name: Process templates | |
run: just process-templates | |
- id: set-matrix | |
shell: bash | |
run: | | |
set -o pipefail; cargo test --workspace --bin=subnet-node -- l --list --format=terse | sed -e 's/: test//g' | jq -ncR '{"test-name": [inputs]}' > test_names.json | |
echo "::set-output name=matrix::$(cat test_names.json)" | |
# Run the tests that require stacks-node | |
layer-1-tests: | |
runs-on: ubuntu-latest | |
needs: | |
- build-layer-1-tests | |
- compute-layer-1-tests | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.compute-layer-1-tests.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download docker image | |
uses: actions/download-artifact@v3 | |
with: | |
name: integration-image.tar | |
- name: Load docker image | |
run: docker load -i integration-image.tar && rm integration-image.tar | |
- name: Run layer 1 tests | |
timeout-minutes: 30 | |
env: | |
DOCKER_BUILDKIT: 1 | |
TEST_NAME: ${{ matrix.test-name }} | |
run: docker build -o coverage-output --build-arg test_name=${{ matrix.test-name }} -f ./.github/actions/bitcoin-int-tests/Dockerfile.stacks-node . | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage-output/lcov.info | |
name: ${{ matrix.test-name }} | |
fail_ci_if_error: false | |
# Run integration tests | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run units tests (with coverage) | |
env: | |
DOCKER_BUILDKIT: 1 | |
# Remove .dockerignore file so codecov has access to git info | |
run: | | |
rm .dockerignore | |
docker build -o coverage-output -f ./.github/actions/bitcoin-int-tests/Dockerfile.integrations . | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage-output/lcov.info | |
name: integration_tests | |
fail_ci_if_error: false | |
open-api-validation: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run units tests (with coverage) | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: docker build -o dist/ -f .github/actions/open-api/Dockerfile.open-api-validate . | |
- name: Upload bundled html | |
uses: actions/upload-artifact@v3 | |
with: | |
name: open-api-bundle | |
path: | | |
dist | |
# rustfmt checking | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run rustfmt check | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.rustfmt . | |
clarinet-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Ubuntu packages | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: ruby-mustache | |
version: 1.0 | |
- name: Install `just` | |
uses: extractions/setup-just@v1 | |
- name: Process templates | |
run: just process-templates | |
- name: Execute unit tests | |
uses: docker://hirosystems/clarinet:develop # TODO: Replace with version tag once a release containing PR #1060 is made | |
with: | |
args: test --coverage --manifest-path=./core-contracts/Clarinet.toml --import-map=./core-contracts/import_map.json --allow-net --allow-read | |
- name: Export code coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.lcov | |
fail_ci_if_error: false | |
verbose: true | |
# Creates a new release depending on git commit messages following conventional commits: https://www.conventionalcommits.org/en/v1.0.0/#summary | |
# Builds and publishes a new Docker image with appropriate tags | |
build-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v3 | |
id: semantic | |
# Only run on non-PR events or only PRs that aren't from forks | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} | |
SEMANTIC_RELEASE_PACKAGE: ${{ github.event.repository.name }} | |
with: | |
semantic_version: 19 | |
extra_plugins: | | |
@semantic-release/changelog | |
@semantic-release/git | |
conventional-changelog-conventionalcommits | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker Meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
hirosystems/${{ github.event.repository.name }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
# Only run on non-PR events or only PRs that aren't from forks | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build/Tag/Push Image | |
uses: docker/build-push-action@v4 | |
with: | |
tags: ${{ steps.meta.outputs.tags }} | |
build-args: | | |
SUBNET_NODE_VERSION=${{ steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version || github.sha }} | |
GIT_BRANCH=${{ github.ref_name }} | |
GIT_COMMIT=${{ github.sha }} | |
# Only push on non-PR events or only PRs that aren't from forks | |
push: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} |