Skip to content

Commit

Permalink
Merge pull request #2232 from sourcenetwork/release/0.9.0
Browse files Browse the repository at this point in the history
Release v0.9.0
  • Loading branch information
fredcarle authored Jan 18, 2024
2 parents 177ca01 + 3261c51 commit 316c8d7
Show file tree
Hide file tree
Showing 454 changed files with 17,322 additions and 7,534 deletions.
125 changes: 115 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,17 @@ permissions:
issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
prepare:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code into the directory
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go environment explicitly
uses: actions/setup-go@v3
with:
go-version: "1.20"
check-latest: true

- name: Apply tag
run: git tag ${{ github.event.inputs.tag }}

Expand All @@ -45,27 +42,135 @@ jobs:

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.os == 'ubuntu-latest'

- name: Log in to Docker Hub
uses: docker/login-action@v2
if: matrix.os == 'ubuntu-latest'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@v2
if: matrix.os == 'ubuntu-latest'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Go environment explicitly
uses: actions/setup-go@v3
with:
go-version: "1.20"
check-latest: true
cache: true

- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@v4
if: matrix.os == 'ubuntu-latest'
with:
path: dist/linux_amd64
key: linux-${{ env.sha_short }}
- uses: actions/cache@v4
if: matrix.os == 'macos-latest'
with:
path: dist/darwin_amd64
key: darwin-${{ env.sha_short }}
- uses: actions/cache@v4
if: matrix.os == 'windows-latest'
with:
path: dist/windows_amd64
key: windows-${{ env.sha_short }}
enableCrossOsArchive: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser-pro
version: latest
args: release --clean
args: release --clean --split ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

release:
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Apply tag
run: git tag ${{ github.event.inputs.tag }}

- name: Setup Go environment explicitly
uses: actions/setup-go@v3
with:
go-version: "1.20"
check-latest: true
cache: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# copy the cashes from prepare
- shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: dist/linux_amd64
key: linux-${{ env.sha_short }}
- uses: actions/cache@v4
with:
path: dist/darwin_amd64
key: darwin-${{ env.sha_short }}
- uses: actions/cache@v4
with:
path: dist/windows_amd64
key: windows-${{ env.sha_short }}
enableCrossOsArchive: true


# release
- uses: goreleaser/goreleaser-action@v5
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
with:
distribution: goreleaser-pro
version: latest
args: continue --merge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

pull-docker-image:
name: Pull docker image job
runs-on: ubuntu-latest
needs: prepare

strategy:
fail-fast: false
matrix:
image_tag:
- sourcenetwork/defradb:latest
- ghcr.io/sourcenetwork/defradb:latest

steps:
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Pull Docker image
run: docker pull ${{ matrix.image_tag }}

- name: Test Docker image
run: docker run --rm ${{ matrix.image_tag }}
25 changes: 21 additions & 4 deletions .github/workflows/test-and-upload-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
name: Run tests matrix job

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
client-type: [go, http, cli]
Expand All @@ -45,10 +46,21 @@ jobs:
database-type: badger-memory
mutation-type: collection-save
detect-changes: false
- os: windows-latest
client-type: go
database-type: badger-memory
mutation-type: collection-save
detect-changes: false

runs-on: ${{ matrix.os }}

# We run all runners via the bash shell to provide us with a consistent set of env variables and commands
defaults:
run:
shell: bash

env:
CGO_ENABLED: 1
DEFRA_CLIENT_GO: ${{ matrix.client-type == 'go' }}
DEFRA_CLIENT_HTTP: ${{ matrix.client-type == 'http' }}
DEFRA_CLIENT_CLI: ${{ matrix.client-type == 'cli' }}
Expand Down Expand Up @@ -83,18 +95,23 @@ jobs:
if: ${{ !matrix.detect-changes }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.client-type }}_${{ matrix.database-type }}_${{ matrix.mutation-type }}
name: ${{ matrix.os }}_${{ matrix.client-type }}_${{ matrix.database-type }}_${{ matrix.mutation-type }}
path: coverage.txt
if-no-files-found: error
retention-days: 1
retention-days: 7

upload-coverage:
name: Upload test code coverage job

runs-on: ubuntu-latest

needs: run-tests

# Important to know:
# - We didn't use `if: always()` here, so this job doesn't run if we manually canceled.
# - `if: success()` is always implied unless `always()` or `failure()` is specified.
if: success() || failure()

runs-on: ubuntu-latest

steps:
- name: Checkout code into the directory
uses: actions/checkout@v3
Expand Down
12 changes: 4 additions & 8 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
version: 1

dist: ./build

before:
hooks:
- go mod tidy
- make deps:playground

after:
hooks:
- cmd: docker pull {{ .Env.GITHUB_REPOSITORY }}:latest
- cmd: docker run --rm {{ .Env.GITHUB_REPOSITORY }}:latest

builds:
- id: "defradb"
main: ./cmd/defradb
Expand All @@ -34,6 +27,9 @@ builds:
goarch:
- amd64
- arm64

partial:
by: target

archives:
- id: defradb_playground
Expand All @@ -54,7 +50,7 @@ release:
header: |
DefraDB v{{ .Major }}.{{ .Minor }} is a major pre-production release. Until the stable version 1.0 is reached, the SemVer minor patch number will denote notable releases, which will give the project freedom to experiment and explore potentially breaking changes.
To get a full outline of the changes, we invite you to review the official changelog below. This release does include a Breaking Change to existing v{{ .Major }}.{{ .Minor }}.x databases. If you need help migrating an existing deployment, reach out at [email protected] or join our Discord at https://discord.source.network/.
To get a full outline of the changes, we invite you to review the official changelog below. This release does include a Breaking Change to existing v{{ .Major }}.{{ .Minor }}.x databases. If you need help migrating an existing deployment, reach out at [email protected] or join our Discord at https://discord.gg/w7jYQVJ/.
name_template: "v{{ .Version }} Release"

changelog:
Expand Down
Loading

0 comments on commit 316c8d7

Please sign in to comment.