Skip to content

Commit 478b8da

Browse files
committed
(3847) - Adding new workflow files
1 parent f07190e commit 478b8da

9 files changed

+669
-0
lines changed

.github/workflows/atlas-tests.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Github workflow to run atlas tests
2+
3+
name: Tests::Atlas
4+
5+
on:
6+
workflow_call:
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
## env vars are transferred to composite action steps
13+
env:
14+
BITCOIND_TEST: 1
15+
RUST_BACKTRACE: full
16+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
17+
RETRIES: 3
18+
RETRY_DELAY: 10000
19+
TEST_TIMEOUT: 30
20+
TEST_RETRIES: 2
21+
22+
concurrency:
23+
group: atlas-tests-${{ github.head_ref || github.ref || github.run_id}}
24+
## Only cancel in progress if this is for a PR
25+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26+
27+
jobs:
28+
# Atlas integration tests with code coverage
29+
atlas-tests:
30+
name: Atlas Test
31+
runs-on: ubuntu-latest
32+
strategy:
33+
## Continue with the test matrix even if we've had a failure
34+
fail-fast: false
35+
## Run a maximum of 2 concurrent tests from the test matrix
36+
max-parallel: 2
37+
matrix:
38+
test-name:
39+
- tests::neon_integrations::atlas_integration_test
40+
- tests::neon_integrations::atlas_stress_integration_test
41+
steps:
42+
## Setup test environment
43+
- name: Setup Test Environment
44+
id: setup_tests
45+
uses: stacks-network/actions/stacks-core/testenv@main
46+
47+
## Run test matrix using restored cache of archive file
48+
## - Test will timeout after env.TEST_TIMEOUT minutes
49+
- name: Run Tests
50+
id: run_tests
51+
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
52+
uses: stacks-network/actions/stacks-core/run-tests@main
53+
with:
54+
test-name: ${{ matrix.test-name }}
55+
56+
## Create and upload code coverage file
57+
- name: Code Coverage
58+
id: codecov
59+
uses: stacks-network/actions/codecov@main
60+
with:
61+
test-name: ${{ matrix.test-name }}

.github/workflows/create-cache.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## Github workflow to create reusable caches
2+
3+
name: Create Test Cache
4+
5+
on:
6+
workflow_dispatch:
7+
workflow_call:
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
## env vars are transferred to composite action steps
14+
env:
15+
RUSTFLAGS: "-Cinstrument-coverage -Awarnings"
16+
LLVM_PROFILE_FILE: "stacks-blockchain-%p-%m.profraw"
17+
BTC_VERSION: "0.20.0"
18+
19+
##
20+
## Cache will exist longer than workflow execution so other runners have access
21+
## ex: a failed job should have access to the cache for however long `cleanup.yml` is set to delete old caches
22+
## however, this is only relevant if the commit sha does not change between runs
23+
concurrency:
24+
group: create-cache-${{ github.head_ref || github.ref || github.run_id}}
25+
## Only cancel in progress if this is for a PR
26+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
27+
28+
jobs:
29+
## Cache cargo data
30+
cargo:
31+
name: Cargo
32+
runs-on: ubuntu-latest
33+
steps:
34+
## Perform a lookup to check if the cache already exists
35+
- name: Cargo Cache
36+
id: cargo-cache
37+
uses: stacks-network/actions/stacks-core/cache/cargo@main
38+
with:
39+
action: save
40+
41+
## Cache the bitcoin binary
42+
bitcoin-binary:
43+
name: Bitcoin Binary
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Bitcoin Cache
47+
id: bitcoin-cache
48+
uses: stacks-network/actions/stacks-core/cache/bitcoin@main
49+
with:
50+
action: save
51+
52+
## Cache nextest archives for tests
53+
nextest-archive:
54+
name: Test Archive
55+
runs-on: ubuntu-latest
56+
needs:
57+
- cargo
58+
steps:
59+
- name: Build Nexttest Cache
60+
id: nextest-cache
61+
uses: stacks-network/actions/stacks-core/cache/build-cache@main
62+
with:
63+
genesis: true
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
## Github workflow to create multiarch binaries from source
2+
3+
name: Create Binaries
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
tag:
9+
description: "Tag name of this release (x.y.z)"
10+
required: true
11+
type: string
12+
arch:
13+
description: "Stringified JSON object listing of platform matrix"
14+
required: false
15+
type: string
16+
default: >-
17+
["linux-glibc-x64", "linux-musl-x64", "linux-glibc-arm64", "linux-glibc-armv7", "linux-musl-arm64", "linux-musl-armv7", "macos-x64", "macos-arm64", "windows-x64"]
18+
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
## change the display name to the tag being built
24+
run-name: ${{ inputs.tag }}
25+
26+
concurrency:
27+
group: create-binary-${{ github.head_ref || github.ref || github.run_id}}
28+
## Only cancel in progress if this is for a PR
29+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
30+
31+
jobs:
32+
## Runs when the following is true:
33+
## - tag is provided
34+
## - workflow is building default branch (master)
35+
artifact:
36+
if: |
37+
inputs.tag != '' &&
38+
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
39+
name: Build Binaries
40+
runs-on: ubuntu-latest
41+
strategy:
42+
## Run a maximum of 10 builds concurrently, using the matrix defined in inputs.arch
43+
max-parallel: 10
44+
matrix:
45+
platform: ${{ fromJson(inputs.arch) }}
46+
steps:
47+
## Setup Docker for the builds
48+
- name: Docker setup
49+
uses: stacks-network/actions/docker@main
50+
51+
## Build the binaries using defined dockerfiles
52+
- name: Build Binary (${{ matrix.platform }})
53+
id: build_binaries
54+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # 5.0.0
55+
with:
56+
file: build-scripts/Dockerfile.${{ matrix.platform }}
57+
outputs: type=local,dest=./release/${{ matrix.platform }}
58+
build-args: |
59+
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
60+
OS_ARCH=${{ matrix.platform }}
61+
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
62+
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
63+
64+
## Compress the binary artifact
65+
- name: Compress artifact
66+
id: compress_artifact
67+
run: zip --junk-paths ${{ matrix.platform }} ./release/${{ matrix.platform }}/*
68+
69+
## Upload the binary artifact to the github action (used in `github-release.yml` to create a release)
70+
- name: Upload artifact
71+
id: upload_artifact
72+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
73+
with:
74+
path: ${{ matrix.platform }}.zip

.github/workflows/epoch-tests.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
## Github workflow to run epoch tests
2+
3+
name: Tests::Epoch
4+
5+
on:
6+
workflow_call:
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
## env vars are transferred to composite action steps
13+
env:
14+
BITCOIND_TEST: 1
15+
RUST_BACKTRACE: full
16+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
17+
RETRIES: 3
18+
RETRY_DELAY: 10000
19+
TEST_TIMEOUT: 30
20+
TEST_RETRIES: 2
21+
22+
concurrency:
23+
group: epoch-tests-${{ github.head_ref || github.ref || github.run_id }}
24+
## Only cancel in progress if this is for a PR
25+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26+
27+
jobs:
28+
# Epoch integration tests with code coverage
29+
epoch-tests:
30+
name: Epoch Tests
31+
runs-on: ubuntu-latest
32+
strategy:
33+
## Continue with the test matrix even if we've had a failure
34+
fail-fast: false
35+
## Run a maximum of 32 concurrent tests from the test matrix
36+
max-parallel: 32
37+
matrix:
38+
test-name:
39+
- tests::epoch_205::bigger_microblock_streams_in_2_05
40+
- tests::epoch_205::test_cost_limit_switch_version205
41+
- tests::epoch_205::test_dynamic_db_method_costs
42+
- tests::epoch_205::test_exact_block_costs
43+
- tests::epoch_205::transition_empty_blocks
44+
- tests::epoch_21::test_pox_missing_five_anchor_blocks
45+
- tests::epoch_21::test_pox_reorg_one_flap
46+
- tests::epoch_21::test_pox_reorgs_three_flaps
47+
- tests::epoch_21::test_sortition_divergence_pre_21
48+
- tests::epoch_21::test_v1_unlock_height_with_current_stackers
49+
- tests::epoch_21::test_v1_unlock_height_with_delay_and_current_stackers
50+
- tests::epoch_21::trait_invocation_cross_epoch
51+
- tests::epoch_21::transition_adds_burn_block_height
52+
- tests::epoch_21::transition_adds_get_pox_addr_recipients
53+
- tests::epoch_21::transition_adds_mining_from_segwit
54+
- tests::epoch_21::transition_adds_pay_to_contract
55+
- tests::epoch_21::transition_empty_blocks
56+
- tests::epoch_21::transition_fixes_bitcoin_rigidity
57+
- tests::epoch_21::transition_removes_pox_sunset
58+
- tests::epoch_22::disable_pox
59+
- tests::epoch_22::pox_2_unlock_all
60+
- tests::epoch_22::test_pox_reorg_one_flap
61+
- tests::epoch_23::trait_invocation_behavior
62+
- tests::epoch_24::fix_to_pox_contract
63+
- tests::epoch_24::verify_auto_unlock_behavior
64+
steps:
65+
## Setup test environment
66+
- name: Setup Test Environment
67+
id: setup_tests
68+
uses: stacks-network/actions/stacks-core/testenv@main
69+
70+
## Run test matrix using restored cache of archive file
71+
## - Test will timeout after env.TEST_TIMEOUT minutes
72+
- name: Run Tests
73+
id: run_tests
74+
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
75+
uses: stacks-network/actions/stacks-core/run-tests@main
76+
with:
77+
test-name: ${{ matrix.test-name }}
78+
threads: 1
79+
80+
## Create and upload code coverage file
81+
- name: Code Coverage
82+
id: codecov
83+
uses: stacks-network/actions/codecov@main
84+
with:
85+
test-name: ${{ matrix.test-name }}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
## Github workflow to build a multiarch docker image from pre-built binaries
2+
3+
name: Docker Image (Binary)
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
tag:
9+
required: true
10+
type: string
11+
description: "Version tag for alpine images"
12+
docker-org:
13+
required: false
14+
type: string
15+
description: "Docker repo org for uploading images (defaults to github org)"
16+
default: "${GITHUB_REPOSITORY_OWNER}"
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
## Define which docker arch to build for
23+
env:
24+
docker_platforms: "linux/arm64, linux/arm/v7, linux/amd64, linux/amd64/v2, linux/amd64/v3"
25+
docker-org: ${{ github.repository_owner }}
26+
27+
concurrency:
28+
group: docker-image-binary-${{ github.head_ref || github.ref || github.run_id }}
29+
## Always cancel duplicate jobs
30+
cancel-in-progress: true
31+
32+
run-name: ${{ inputs.tag }}
33+
34+
jobs:
35+
## Runs when the following is true:
36+
## - tag is provided
37+
## - workflow is building default branch (master)
38+
image:
39+
if: |
40+
inputs.tag != '' &&
41+
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
42+
name: Build Image
43+
runs-on: ubuntu-latest
44+
strategy:
45+
fail-fast: false
46+
## Build a maximum of 2 images concurrently based on matrix.dist
47+
max-parallel: 2
48+
matrix:
49+
dist:
50+
- alpine
51+
- debian
52+
steps:
53+
## Setup Docker for the builds
54+
- name: Docker setup
55+
uses: stacks-network/actions/docker@main
56+
with:
57+
username: ${{ secrets.DOCKERHUB_USERNAME }}
58+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
59+
60+
## Set docker metatdata
61+
## - depending on the matrix.dist, different tags will be enabled
62+
## ex. alpine will have this tag: `type=ref,event=tag,enable=${{ matrix.dist == 'alpine' }}`
63+
- name: Docker Metadata ( ${{matrix.dist}} )
64+
id: docker_metadata
65+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 #v5.0.0
66+
with:
67+
images: |
68+
${{env.docker-org}}/${{ github.event.repository.name }}
69+
${{env.docker-org}}/stacks-core
70+
tags: |
71+
type=raw,value=latest,enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'alpine' }}
72+
type=raw,value=${{ inputs.tag }}-${{ matrix.dist }},enable=${{ inputs.tag != '' && matrix.dist == 'alpine'}}
73+
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' && matrix.dist == 'alpine' }}
74+
type=ref,event=tag,enable=${{ matrix.dist == 'alpine' }}
75+
type=raw,value=latest-${{ matrix.dist }},enable=${{ inputs.tag != '' && (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) ) && matrix.dist == 'debian' }}
76+
type=raw,value=${{ inputs.tag }}-${{ matrix.dist }},enable=${{ inputs.tag != '' && matrix.dist == 'debian' }}
77+
78+
## Build docker image for release
79+
- name: Build and Push ( ${{matrix.dist}} )
80+
id: docker_build
81+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
82+
with:
83+
file: ./.github/actions/dockerfiles/Dockerfile.${{ matrix.dist }}-binary
84+
platforms: ${{ env.docker_platforms }}
85+
tags: ${{ steps.docker_metadata.outputs.tags }}
86+
labels: ${{ steps.docker_metadata.outputs.labels }}
87+
build-args: |
88+
REPO=${{ github.repository_owner }}/${{ github.event.repository.name }}
89+
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
90+
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
91+
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
92+
push: ${{ env.DOCKER_PUSH }}

0 commit comments

Comments
 (0)