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

Release pipeline #245

Merged
merged 75 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4d4d58a
Update CONTRIBUTING.md
guergabo Mar 18, 2024
ef6ad93
Merge pull request #1 from guergabo/guergabo-patch-1
guergabo Mar 18, 2024
d22cf71
Update release.yaml
guergabo Mar 18, 2024
759b908
Update CONTRIBUTING.md
guergabo Mar 18, 2024
69e14ce
Update release.yaml
guergabo Mar 18, 2024
dec87d6
Update release.yaml
guergabo Mar 18, 2024
4cadc82
Update release.yaml
guergabo Mar 18, 2024
895b65c
Update CONTRIBUTING.md
guergabo Mar 18, 2024
3023551
Update release.yaml
guergabo Mar 18, 2024
729e035
Update release.yaml
guergabo Mar 18, 2024
ac7147d
Update release.yaml
guergabo Mar 18, 2024
597211b
Update release.yaml
guergabo Mar 18, 2024
aa4bce3
Update release.yaml
guergabo Mar 18, 2024
b49e0fb
Update release.yaml
guergabo Mar 18, 2024
224e957
Update and rename release.yaml to publish_github_release.yaml
guergabo Mar 18, 2024
3561864
Update and rename publish.yml to publish_github_image.yml
guergabo Mar 18, 2024
964b9fc
Create release.yml
guergabo Mar 18, 2024
465e402
Update publish_github_image.yml
guergabo Mar 18, 2024
86028d0
Update publish_github_release.yaml
guergabo Mar 18, 2024
f4dc214
Rename publish_github_image.yml to publish_github_image.yaml
guergabo Mar 18, 2024
d19aa8f
Update and rename release.yml to release.yaml
guergabo Mar 18, 2024
f382592
Rename publish_github_image.yaml to release_publish_github_image.yaml
guergabo Mar 18, 2024
2432f63
Rename publish_github_release.yaml to release_publish_github_release.…
guergabo Mar 18, 2024
45bd229
Update release.yaml
guergabo Mar 18, 2024
2e61b53
Create release_test_artifacts.yaml
guergabo Mar 18, 2024
a18efe5
Update release.yaml
guergabo Mar 18, 2024
e262f8e
Rename release_test_artifacts.yaml to release_verify_artifacts.yaml
guergabo Mar 18, 2024
f82dc45
Update release.yaml
guergabo Mar 18, 2024
5494f31
Update release_verify_artifacts.yaml
guergabo Mar 18, 2024
3ab4bf4
Update release.yaml
guergabo Mar 18, 2024
831aea7
Update release_verify_artifacts.yaml
guergabo Mar 18, 2024
a4edcf5
Update release.yaml
guergabo Mar 18, 2024
158a262
Update release_verify_artifacts.yaml
guergabo Mar 18, 2024
fb6a7c4
Update release.yaml
guergabo Mar 18, 2024
53603c1
Update release_verify_artifacts.yaml
guergabo Mar 18, 2024
7aaa2d8
Update release_verify_artifacts.yaml
guergabo Mar 18, 2024
f91aaa7
Update release.yaml
guergabo Mar 18, 2024
620ed45
Update release_verify_artifacts.yaml
guergabo Mar 19, 2024
4832276
Update release_publish_github_image.yaml
guergabo Mar 19, 2024
7509a87
Update release.yaml
guergabo Mar 19, 2024
e78f086
Update release_publish_github_image.yaml
guergabo Mar 19, 2024
acbf8b9
Update release_publish_github_release.yaml
guergabo Mar 19, 2024
97a0c23
Update release.yaml
guergabo Mar 19, 2024
4c4a691
Update release_verify_artifacts.yaml
guergabo Mar 19, 2024
2fc0749
Update release.yaml
guergabo Mar 19, 2024
e88f9be
Update release_verify_artifacts.yaml
guergabo Mar 19, 2024
f86d343
Update release.yaml
guergabo Mar 19, 2024
92f4bd9
Update release_publish_github_release.yaml
guergabo Mar 19, 2024
c943a3b
Update release.yaml
guergabo Mar 19, 2024
1d9a9cc
Update and rename cicd.yaml to ci.yaml
guergabo Mar 19, 2024
a9ecded
Update ci.yaml
guergabo Mar 19, 2024
f792e43
Update release_publish_github_image.yaml
guergabo Mar 19, 2024
999991c
Update release.yaml
guergabo Mar 19, 2024
8629c68
Update release_verify_artifacts.yaml
guergabo Mar 19, 2024
e813ff0
Update release.yaml
guergabo Mar 19, 2024
57f4457
Update release_verify_artifacts.yaml
guergabo Mar 19, 2024
c309f9b
Update release.yaml
guergabo Mar 19, 2024
d7d448a
Update release_publish_github_image.yaml
guergabo Mar 19, 2024
fa1ec14
Update release.yaml
guergabo Mar 19, 2024
e9afb60
Update release.yaml
guergabo Mar 19, 2024
19da50b
patch release.yaml
guergabo Mar 19, 2024
e8512e3
patch(test): Update release.yaml
guergabo Mar 19, 2024
be0dbd0
Update release.yaml
guergabo Mar 19, 2024
36ac81b
Update release.yaml
guergabo Mar 19, 2024
fd07bf0
patch(test): Update release.yaml
guergabo Mar 19, 2024
9ddad1c
Update release.yaml
guergabo Mar 19, 2024
19ad8e9
Update release.yaml
guergabo Mar 19, 2024
091d892
Update release.yaml
guergabo Mar 19, 2024
d387cd1
Update release.yaml
guergabo Mar 19, 2024
39dad46
fix(cleanup)
Apr 12, 2024
ddf5c45
fix(cleanup): X2
Apr 12, 2024
8eb292c
fix(cleanup): X3
Apr 12, 2024
f318739
fix(cleanup): X4
Apr 12, 2024
b06380a
fix(cleanup): X5
Apr 12, 2024
68298e0
fix(cleanup): X6
Apr 12, 2024
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
73 changes: 18 additions & 55 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,25 @@
name: Release
# Release workflow is the main workflow that coordinates various GitHub workflows involved in a release of Resonate.
name: Release Workflow

on:
release:
types:
- created

permissions:
contents: write
- published
workflow_dispatch:

jobs:
release-linux-artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Install cross-compiler for linux/arm64
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build for both amd64 and arm64
run: |
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o ./bin/linux-x86_64/ ./...
CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -o ./bin/linux-aarch64/ ./...
chmod +x ./bin/linux-x86_64/resonate
chmod +x ./bin/linux-aarch64/resonate
mv ./bin/linux-x86_64/resonate ./bin/resonate_linux_x86_64
mv ./bin/linux-aarch64/resonate ./bin/resonate_linux_aarch64
- name: Upload Artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.event.release.tag_name }} ./bin/resonate_linux_x86_64 --clobber
gh release upload ${{ github.event.release.tag_name }} ./bin/resonate_linux_aarch64 --clobber
publish-github-image:
uses: ./.github/workflows/release_publish_github_image.yaml
with:
tag: ${{ github.ref_name }}

publish-github-artifacts:
uses: ./.github/workflows/release_publish_github_artifacts.yaml
with:
tag: ${{ github.ref_name }}

release-darwin-artifact:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Build for both amd64 and arm64
run: |
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o ./bin/darwin-x86_64/ ./...
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o ./bin/darwin-aarch64/ ./...
chmod +x ./bin/darwin-x86_64/resonate
chmod +x ./bin/darwin-aarch64/resonate
mv ./bin/darwin-x86_64/resonate ./bin/resonate_darwin_x86_64
mv ./bin/darwin-aarch64/resonate ./bin/resonate_darwin_aarch64
- name: Upload Artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.event.release.tag_name }} ./bin/resonate_darwin_x86_64 --clobber
gh release upload ${{ github.event.release.tag_name }} ./bin/resonate_darwin_aarch64 --clobber
verify-github-artifacts:
needs: [publish-github-image, publish-github-artifacts]
uses: ./.github/workflows/release_verify_artifacts.yaml
with:
tag: ${{ github.ref_name }}
89 changes: 89 additions & 0 deletions .github/workflows/release_publish_github_artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Publish GitHub Release

on:
workflow_call:
inputs:
tag:
description: "The tag version to use for verification"
required: true
type: string

workflow_dispatch:

permissions:
contents: write

jobs:
release-linux-artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Install cross-compiler for linux/arm64
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build for both amd64 and arm64
run: |
# Build resonate binaries
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o ./bin/linux-x86_64/ ./...
CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -o ./bin/linux-aarch64/ ./...

# Change permissions
chmod +x ./bin/linux-x86_64/resonate
chmod +x ./bin/linux-aarch64/resonate

# Compress binaries
tar -czvf resonate_linux_x86_64.tar.gz ./bin/linux-x86_64/resonate
tar -czvf resonate_linux_aarch64.tar.gz ./bin/linux-aarch64/resonate

# Create checksums
sha256sum resonate_linux_x86_64.tar.gz > resonate_linux_x86_64.tar.gz.sha256
sha256sum resonate_linux_aarch64.tar.gz > resonate_linux_aarch64.tar.gz.sha256
- name: Upload Artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ inputs.tag }} resonate_linux_x86_64.tar.gz --clobber
gh release upload ${{ inputs.tag }} resonate_linux_x86_64.tar.gz.sha256 --clobber
gh release upload ${{ inputs.tag }} resonate_linux_aarch64.tar.gz --clobber
gh release upload ${{ inputs.tag }} resonate_linux_aarch64.tar.gz.sha256 --clobber

release-darwin-artifact:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Build for both amd64 and arm64
run: |
# Build resonate binaries
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o ./bin/darwin-x86_64/ ./...
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o ./bin/darwin-aarch64/ ./...

# Change permissions
chmod +x ./bin/darwin-x86_64/resonate
chmod +x ./bin/darwin-aarch64/resonate

# Compress binaries
tar -czvf resonate_darwin_x86_64.tar.gz ./bin/darwin-x86_64/resonate
tar -czvf resonate_darwin_aarch64.tar.gz ./bin/darwin-aarch64/resonate

# Create checksums
shasum -a 256 resonate_darwin_x86_64.tar.gz > resonate_darwin_x86_64.tar.gz.sha256
shasum -a 256 resonate_darwin_aarch64.tar.gz > resonate_darwin_aarch64.tar.gz.sha256
- name: Upload Artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ inputs.tag }} resonate_darwin_x86_64.tar.gz --clobber
gh release upload ${{ inputs.tag }} resonate_darwin_x86_64.tar.gz.sha256 --clobber
gh release upload ${{ inputs.tag }} resonate_darwin_aarch64.tar.gz --clobber
gh release upload ${{ inputs.tag }} resonate_darwin_aarch64.tar.gz.sha256 --clobber
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token
name: Create and publish a Docker image
name: Publish GitHub Docker image

# Configures this workflow to run every time a change is pushed to the branch called `release-*`.
# This aligns with the release branching change coming in v1.0.0 for hot fixes.
on:
push:
branches: ["release-*"]
workflow_call:
inputs:
tag:
description: 'The tag version to use for the release'
required: true
type: string

workflow_dispatch:

# Defines two custom environment variables for the workflow. These are used for the Container
# registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# Add support for more platforms with QEMU (optional)
# Add support for more platforms with QEMU
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -52,13 +52,14 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# This step uses the `docker/build-push-action` action to build the image, based on your
tags: |
type=raw,value=${{ inputs.tag }}
type=raw,value=latest

# This step uses the `docker/build-push-action` action to build the image, based on our
# repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located
# in the specified path. For more information,
# see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the
# `docker/build-push-action` repository. It uses the `tags` and `labels` parameters to tag
# in the specified path. It uses the `tags` and `labels` parameters to tag
# and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@v5
Expand All @@ -68,3 +69,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: true
sbom: true
61 changes: 61 additions & 0 deletions .github/workflows/release_verify_artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Verify GitHub Artifacts

on:
workflow_call:
inputs:
tag:
description: 'The tag version to use for verification'
required: true
type: string

workflow_dispatch:

permissions:
contents: read
packages: read

jobs:
seed:
runs-on: ubuntu-latest
steps:
- id: seed
name: Set random seed
run: echo seed=$RANDOM >> $GITHUB_OUTPUT
outputs:
seed: ${{ inputs.seed || steps.seed.outputs.seed }}


verify-github-image:
runs-on: ubuntu-latest
needs: [seed]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download and test GHCR image
run: |
# Login to GHCR
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

# Pull the test image
docker pull ghcr.io/guergabo/resonate:${{ inputs.tag }}

# Run the test image
docker run --rm ghcr.io/guergabo/resonate:${{ inputs.tag }} dst run --seed ${{ needs.seed.outputs.seed }} --aio-store sqlite


verify-github-release:
runs-on: ubuntu-latest
needs: [seed]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download and test GH release
run: |
# Download the release artifact
curl -L -O "https://github.com/guergabo/resonate/releases/download/${{ inputs.tag }}/resonate_linux_x86_64.tar.gz"

# Extract the artifact
tar -xzf resonate_linux_x86_64.tar.gz

# Run the extracted artifact
./bin/linux-x86_64/resonate dst run --seed ${{ needs.seed.outputs.seed }} --aio-store sqlite
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ Here are some areas where your contributions would be valuable:
* Enhancements to our testing and reliability efforts.
* Add support for the following databases: MySQL, Elasticsearch, MongoDB.

Thank you for your contributions and support in building a better Resonate! 🚀
Thank you for your contributions and support in building a better Resonate! 🚀