Skip to content

TEMP: TESET

TEMP: TESET #2

Workflow file for this run

# Copyright 2023 Democratized Data Foundation
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.txt.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0, included in the file
# licenses/APL.txt.
name: Release workflow
on:
push:
permissions:
contents: write
packages: write
issues: write
jobs:
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.21"
check-latest: true
cache: true
- name: Apply tag
run: git tag ${{ github.event.inputs.tag }}
- name: Build modules
run: make deps:modules
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
shell: bash
run: echo "sha_short=$(echo Hi1)" >> ${GITHUB_ENV}
- name: Log in to Docker Hub
if: matrix.os == 'ubuntu-latest'
shell: bash
run: echo "sha_short=$(echo Hi2)" >> ${GITHUB_ENV}
- name: Log in to the Container registry
if: matrix.os == 'ubuntu-latest'
shell: bash
run: echo "sha_short=$(echo Hi3)" >> ${GITHUB_ENV}
- name: Run command to get SHA environment
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV}
- name: Save cache on Linux
if: matrix.os == 'ubuntu-latest'
uses: actions/cache/save@v4
with:
path: dist/linux_amd64
key: linux-${{ env.sha_short }}
- name: Save cache on MacOS
if: matrix.os == 'macos-latest'
uses: actions/cache/save@v4
with:
path: dist/darwin_amd64
key: darwin-${{ env.sha_short }}
- name: Save cache on Windows
if: matrix.os == 'windows-latest'
uses: actions/cache/save@v4
with:
path: dist/windows_amd64
key: windows-${{ env.sha_short }}
enableCrossOsArchive: true
- name: Run GoReleaser
shell: bash
run: echo "sha_short=$(echo HiRunnReleaser)" >> ${GITHUB_ENV}
release:
runs-on: ubuntu-latest
needs: prepare
steps:
- name: Checkout code into the directory
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.21"
check-latest: true
cache: true
- name: Log in to Docker Hub
shell: bash
run: echo "sha_short=$(echo Hi11)" >> ${GITHUB_ENV}
- name: Run command to get SHA environment
shell: bash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> ${GITHUB_ENV}
# Restore the cashes that were prepared for all OS
- name: Restore from cache on Linux
id: restore-linux
uses: actions/cache/restore@v4
with:
path: dist/linux_amd64
key: linux-${{ env.sha_short }}
fail-on-cache-miss: true
- name: Save from cache on MacOS
id: restore-macos
uses: actions/cache/restore@v4
with:
path: dist/darwin_amd64
key: darwin-${{ env.sha_short }}
fail-on-cache-miss: true
- name: Restore from cache on Windows
id: restore-windows
uses: actions/cache/restore@v4
with:
path: dist/windows_amd64
key: windows-${{ env.sha_short }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Exit if failed to restore cache for any OS
if: |
steps.restore-linux.outputs.cache-hit != 'true' ||
steps.restore-macos.outputs.cache-hit != 'true' ||
steps.restore-windows.outputs.cache-hit != 'true'
run: exit 1
- name: Do the release, only if all OS caches were restored
shell: bash
run: echo "sha_short=$(echo Hi22)" >> ${GITHUB_ENV}
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
shell: bash
run: echo "sha_short=$(echo Hi33)" >> ${GITHUB_ENV}
- name: Pull Docker image
shell: bash
run: echo "sha_short=$(echo Hi44)" >> ${GITHUB_ENV}
- name: Test Docker image
shell: bash
run: echo "sha_short=$(echo Hi55)" >> ${GITHUB_ENV}