Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Workflow to Build Signer Releases #4968

Merged
merged 8 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/actions/dockerfiles/Dockerfile.alpine-binary
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,18 @@ RUN case ${TARGETPLATFORM} in \
&& unzip ${BIN_ARCH}.zip -d /out

FROM --platform=${TARGETPLATFORM} alpine
COPY --from=builder /out/stacks-node /out/stacks-signer /bin/
CMD ["stacks-node", "mainnet"]
COPY --from=builder /out/* /bin/
ARG TAG

RUN case "${TAG}" in \
signer-*) \
echo "/bin/stacks-signer run --config /signer-config.toml" > /tmp/command.sh \
;; \
*) \
echo "/bin/stacks-node mainnet" > /tmp/command.sh && \
rm /bin/blockstack-cli /bin/clarity-cli /bin/relay-server /bin/stacks-events /bin/stacks-inspect \
;; \
esac && \
chmod +x /tmp/command.sh

CMD ["sh", "-c", "/tmp/command.sh"]
CharlieC3 marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 15 additions & 2 deletions .github/actions/dockerfiles/Dockerfile.debian-binary
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,18 @@ RUN case ${TARGETPLATFORM} in \
&& unzip ${BIN_ARCH}.zip -d /out

FROM --platform=${TARGETPLATFORM} debian:bookworm
COPY --from=builder /out/stacks-node /out/stacks-signer /bin/
CMD ["stacks-node", "mainnet"]
COPY --from=builder /out/* /bin/
ARG TAG

RUN case "${TAG}" in \
signer-*) \
echo "/bin/stacks-signer run --config /signer-config.toml" > /tmp/command.sh \
;; \
*) \
echo "/bin/stacks-node mainnet" > /tmp/command.sh && \
rm /bin/blockstack-cli /bin/clarity-cli /bin/relay-server /bin/stacks-events /bin/stacks-inspect \
;; \
esac && \
chmod +x /tmp/command.sh

CMD ["sh", "-c", "/tmp/command.sh"]
134 changes: 75 additions & 59 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ on:
- "**.md"
- "**.yml"
workflow_dispatch:
inputs:
tag:
description: "The tag to create (optional)"
required: false
pull_request:
types:
- opened
Expand All @@ -34,7 +30,7 @@ concurrency:
## Always cancel duplicate jobs
cancel-in-progress: true

run-name: ${{ inputs.tag }}
run-name: ${{ github.ref_name }}

jobs:
##
Expand All @@ -54,149 +50,169 @@ jobs:
with:
alias: "fmt-stacks"

######################################################################################
## Check if the branch that this workflow is being run against is a release branch
check-release:
name: Check Release
needs:
- rustfmt
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.check_release.outputs.tag }}
docker_tag: ${{ steps.check_release.outputs.docker_tag }}
is_release: ${{ steps.check_release.outputs.is_release }}
steps:
- name: Check Release
id: check_release
uses: stacks-network/actions/stacks-core/check-release@main
with:
tag: ${{ github.ref_name }}

######################################################################################
## Create a tagged github release
##
## Runs when the following is true:
## - tag is provided
## Runs when:
## - it is a release run
create-release:
if: |
inputs.tag != ''
needs.check-release.outputs.is_release == 'true'
name: Create Release
needs:
- rustfmt
- check-release
uses: ./.github/workflows/github-release.yml
with:
tag: ${{ inputs.tag }}
tag: ${{ needs.check-release.outputs.tag }}
docker_tag: ${{ needs.check-release.outputs.docker_tag }}
secrets: inherit

## Build and push Debian image built from source
##
## Runs when:
## - tag is not provided
## - it is not a release run
docker-image:
if: |
inputs.tag == ''
needs.check-release.outputs.is_release != 'true'
name: Docker Image (Source)
uses: ./.github/workflows/image-build-source.yml
needs:
- rustfmt
- check-release
secrets: inherit

## Create a reusable cache for tests
##
## Runs when:
## - tag is provided
## - it is a release run
## or:
## - no tag provided
## - it is not a release run
## and any of:
## - this workflow is called manually
## - PR is opened
## - commit to either (development, master) branch
create-cache:
if: |
inputs.tag != '' || (
inputs.tag == '' && (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
name: Create Test Cache
needs:
- rustfmt
- check-release
uses: ./.github/workflows/create-cache.yml

## Tests to run regularly
##
## Runs when:
## - tag is provided
## - it is a release run
## or:
## - no tag provided
## - it is not a release run
## and any of:
## - this workflow is called manually
## - PR is opened
## - PR added to merge queue
## - commit to either (development, next, master) branch
stacks-core-tests:
if: |
inputs.tag != '' || (
inputs.tag == '' && (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
name: Stacks Core Tests
needs:
- rustfmt
- create-cache
- check-release
uses: ./.github/workflows/stacks-core-tests.yml

bitcoin-tests:
if: |
inputs.tag != '' || (
inputs.tag == '' && (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
needs.check-release.outputs.is_release == 'true' || (
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'merge_group' ||
(
contains('
refs/heads/master
refs/heads/develop
refs/heads/next
', github.event.pull_request.head.ref) &&
github.event_name == 'push'
)
)
name: Bitcoin Tests
needs:
- rustfmt
- create-cache
- check-release
uses: ./.github/workflows/bitcoin-tests.yml

## Test to run on a tagged release
##
## Runs when:
## - tag is provided
## - it is a release run
atlas-tests:
if: inputs.tag != ''
if: needs.check-release.outputs.is_release == 'true'
name: Atlas Tests
needs:
- rustfmt
- create-cache
- check-release
uses: ./.github/workflows/atlas-tests.yml

epoch-tests:
if: inputs.tag != ''
if: needs.check-release.outputs.is_release == 'true'
name: Epoch Tests
needs:
- rustfmt
- create-cache
- check-release
uses: ./.github/workflows/epoch-tests.yml

slow-tests:
if: inputs.tag != ''
if: needs.check-release.outputs.is_release == 'true'
name: Slow Tests
needs:
- rustfmt
- create-cache
- check-release
uses: ./.github/workflows/slow-tests.yml

9 changes: 7 additions & 2 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
description: "Release Tag"
required: true
type: string
docker_tag:
description: "Docker Release Tag"
required: true
type: string
secrets:
GH_TOKEN:
required: true
Expand Down Expand Up @@ -68,8 +72,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
name: Release ${{ github.event.inputs.tag || github.ref }}
tag_name: ${{ github.event.inputs.tag || github.ref }}
name: Release ${{ inputs.tag || github.ref }}
tag_name: ${{ inputs.tag || github.ref }}
draft: false
prerelease: true
fail_on_unmatched_files: true
Expand All @@ -94,4 +98,5 @@ jobs:
- create-release
with:
tag: ${{ inputs.tag }}
docker_tag: ${{ inputs.docker_tag }}
secrets: inherit
Loading