mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-18 13:00:10 -05:00
Bumps [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) from 0.3 to 0.4.0. - [Release notes](https://github.com/google-github-actions/setup-gcloud/releases) - [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/master/CHANGELOG.md) - [Commits](https://github.com/google-github-actions/setup-gcloud/compare/v0.3...v0.4.0) --- updated-dependencies: - dependency-name: google-github-actions/setup-gcloud dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
206 lines
6.0 KiB
YAML
206 lines
6.0 KiB
YAML
name: Steampipe Release
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: "The branch that will be built"
|
|
required: true
|
|
tag:
|
|
description: "The release tag that will be set"
|
|
required: true
|
|
|
|
env:
|
|
PROJECT_ID: steampipe
|
|
STEAMPIPE_UPDATE_CHECK: false
|
|
|
|
jobs:
|
|
goreleaser:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
- name: Unshallow
|
|
run: git fetch
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
|
|
- name: Hook private repo
|
|
run: git config --global url."https://${{ secrets.GH_ACCESS_TOKEN }}:x-oauth-basic@github.com".insteadOf "https://github.com"
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v2
|
|
with:
|
|
version: latest
|
|
args: release --snapshot --rm-dist --skip-publish
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Move build artifacts
|
|
run: |
|
|
mkdir ~/artifacts
|
|
mv $GITHUB_WORKSPACE/dist/steampipe_linux_amd64.tar.gz ~/artifacts/linux.tar.gz
|
|
mv $GITHUB_WORKSPACE/dist/steampipe_darwin_amd64.zip ~/artifacts/darwin.zip
|
|
|
|
- name: List Build Artifacts
|
|
run: ls -l ~/artifacts
|
|
|
|
- name: Save Linux Build Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: build-artifact-linux
|
|
path: ~/artifacts/linux.tar.gz
|
|
if-no-files-found: error
|
|
|
|
- name: Save MacOS Build Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: build-artifact-darwin
|
|
path: ~/artifacts/darwin.zip
|
|
if-no-files-found: error
|
|
|
|
acceptance_test:
|
|
name: Acceptance tests
|
|
needs: goreleaser
|
|
strategy:
|
|
matrix:
|
|
platform: [ubuntu-latest]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
- name: Setup BATS
|
|
uses: mig4/setup-bats@v1
|
|
with:
|
|
bats-version: 1.2.1
|
|
|
|
- name: Prepare for downloads
|
|
id: prepare-for-downloads
|
|
run: |
|
|
mkdir ~/artifacts
|
|
|
|
- name: Download Linux Build Artifacts
|
|
uses: actions/download-artifact@v2
|
|
if: ${{ matrix.platform == 'ubuntu-latest' }}
|
|
with:
|
|
name: build-artifact-linux
|
|
path: ~/artifacts
|
|
|
|
- name: Download Darwin Build Artifacts
|
|
uses: actions/download-artifact@v2
|
|
if: ${{ matrix.platform == 'macos-latest' }}
|
|
with:
|
|
name: build-artifact-darwin
|
|
path: ~/artifacts
|
|
|
|
- name: Extract Darwin Artifacts and Install Binary
|
|
if: ${{ matrix.platform == 'macos-latest' }}
|
|
run: |
|
|
mkdir ~/build
|
|
unzip ~/artifacts/darwin.zip -d ~/build
|
|
|
|
- name: Extract Ubuntu Artifacts and Install Binary
|
|
if: ${{ matrix.platform == 'ubuntu-latest' }}
|
|
run: |
|
|
mkdir ~/build
|
|
tar -xf ~/artifacts/linux.tar.gz -C ~/build
|
|
|
|
- name: Set PATH
|
|
run: |
|
|
echo "PATH=$PATH:$HOME/build:$GTIHUB_WORKSPACE/tests/acceptance/lib/bats/bin" >> $GITHUB_ENV
|
|
|
|
- name: Install DB
|
|
run: |
|
|
steampipe service start
|
|
steampipe plugin install chaos
|
|
steampipe service stop --force
|
|
|
|
- name: Run Test Suite
|
|
timeout-minutes: 5
|
|
run: |
|
|
chmod +x $GITHUB_WORKSPACE/tests/acceptance/run.sh
|
|
$GITHUB_WORKSPACE/tests/acceptance/run.sh
|
|
steampipe service stop --force
|
|
|
|
create_release:
|
|
name: Release
|
|
needs: [goreleaser, acceptance_test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
- name: Unshallow
|
|
run: git fetch --prune --unshallow
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
|
|
- name: Hook private repo
|
|
run: git config --global url."https://${{ secrets.GH_ACCESS_TOKEN }}:x-oauth-basic@github.com".insteadOf "https://github.com"
|
|
|
|
- name: Tag Release
|
|
run: |
|
|
git config user.name "Steampipe GitHub Actions Bot"
|
|
git config user.email noreply@github.com
|
|
git tag ${{ github.event.inputs.tag }}
|
|
git push origin ${{ github.event.inputs.tag }}
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v2
|
|
with:
|
|
version: latest
|
|
args: release --rm-dist
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: google-github-actions/setup-gcloud@v0.4.0
|
|
with:
|
|
service_account_key: ${{ secrets.GCP_GITHUB_ACTION_PUSH_ARTIFACTS }}
|
|
project_id: ${{ env.PROJECT_ID }}
|
|
export_default_credentials: true
|
|
|
|
- run: gcloud config list
|
|
|
|
- run: gcloud components install beta
|
|
|
|
- name: Upload rpm and deb packages to artifact registry
|
|
run: |
|
|
gcloud beta artifacts yum upload steampipe-yum-repo --location=us --source=$GITHUB_WORKSPACE/dist/steampipe_linux_amd64.rpm --project steampipe
|
|
gcloud beta artifacts apt upload steampipe-apt-repo --location=us --source=$GITHUB_WORKSPACE/dist/steampipe_linux_amd64.deb --project steampipe
|
|
|
|
clean_up:
|
|
# let's clean up the artifacts.
|
|
# incase this step isn't reached,
|
|
# artifacts automatically expire after 90 days anyway
|
|
# refer:
|
|
# https://docs.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts#downloading-and-deleting-artifacts-after-a-workflow-run-is-complete
|
|
name: Clean Up Artifacts
|
|
needs: create_release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clean up Linux Build
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: build-artifact-linux
|
|
|
|
- name: Clean up Darwin Build
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: build-artifact-darwin
|