mirror of
https://github.com/turbot/steampipe.git
synced 2026-04-12 19:00:08 -04:00
Clean up release workflows. Closes #2369
This commit is contained in:
393
.github/workflows/release_cli.yml
vendored
393
.github/workflows/release_cli.yml
vendored
@@ -1,393 +0,0 @@
|
||||
name: Steampipe Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: "The branch that will be built"
|
||||
required: true
|
||||
version:
|
||||
description: "The version to release (must be prefixed with 'v')"
|
||||
required: true
|
||||
|
||||
env:
|
||||
PROJECT_ID: steampipe
|
||||
STEAMPIPE_UPDATE_CHECK: false
|
||||
VERSION: ${{ github.event.inputs.version }}
|
||||
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
|
||||
- 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@v3
|
||||
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@v3
|
||||
with:
|
||||
name: build-artifact-linux
|
||||
path: ~/artifacts/linux.tar.gz
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Save MacOS Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-artifact-darwin
|
||||
path: ~/artifacts/darwin.zip
|
||||
if-no-files-found: error
|
||||
|
||||
acceptance_test:
|
||||
name: Acceptance tests
|
||||
needs: goreleaser
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [macos-latest]
|
||||
test_block:
|
||||
- "migration"
|
||||
- "service_and_plugin"
|
||||
- "search_path"
|
||||
- "chaos_and_query"
|
||||
- "dynamic_schema"
|
||||
- "cache"
|
||||
- "mod_install"
|
||||
- "mod"
|
||||
- "check"
|
||||
- "performance"
|
||||
- "exit_codes"
|
||||
- "force_stop"
|
||||
exclude:
|
||||
- platform: macos-latest
|
||||
test_block: migration
|
||||
- platform: macos-latest
|
||||
test_block: force_stop
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
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 Darwin Build Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
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: Set PATH
|
||||
run: |
|
||||
echo "PATH=$PATH:$HOME/build:$GTIHUB_WORKSPACE/tests/acceptance/lib/bats/bin" >> $GITHUB_ENV
|
||||
|
||||
- name: Install DB
|
||||
id: install-db
|
||||
continue-on-error: false
|
||||
run: |
|
||||
steampipe service start
|
||||
steampipe plugin install chaos
|
||||
steampipe service stop
|
||||
|
||||
- name: Run Test Suite
|
||||
id: run-test-suite
|
||||
timeout-minutes: 15
|
||||
run: |
|
||||
chmod +x $GITHUB_WORKSPACE/tests/acceptance/run.sh
|
||||
$GITHUB_WORKSPACE/tests/acceptance/run.sh ${{ matrix.test_block }}.bats
|
||||
steampipe service stop --force
|
||||
|
||||
docker_acceptance_test_debian:
|
||||
name: Acceptance tests(Docker - Debian)
|
||||
needs: goreleaser
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
|
||||
- name: Prepare for downloads
|
||||
id: prepare-for-downloads
|
||||
run: |
|
||||
mkdir ~/artifacts
|
||||
|
||||
- name: Download Linux Build Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-artifact-linux
|
||||
path: ~/artifacts
|
||||
|
||||
- name: Extract Ubuntu Artifacts and Install Binary
|
||||
run: |
|
||||
mkdir ~/build
|
||||
tar -xf ~/artifacts/linux.tar.gz -C ~/build
|
||||
|
||||
- name: Copy binary
|
||||
run: |
|
||||
cp ~/build/steampipe tests/dockertesting/debian
|
||||
|
||||
- name: Build steampipe docker images
|
||||
run: |
|
||||
docker build -t spdebian tests/dockertesting/debian
|
||||
docker images
|
||||
|
||||
- name: Create a container and run the test suite
|
||||
run: |
|
||||
docker run --name steampipe-deb `docker images -q spdebian`
|
||||
echo "docker run complete"
|
||||
|
||||
docker_acceptance_test_oraclelinux:
|
||||
name: Acceptance tests(Docker - OracleLinux)
|
||||
needs: goreleaser
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
|
||||
- name: Prepare for downloads
|
||||
id: prepare-for-downloads
|
||||
run: |
|
||||
mkdir ~/artifacts
|
||||
|
||||
- name: Download Linux Build Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: build-artifact-linux
|
||||
path: ~/artifacts
|
||||
|
||||
- name: Extract Ubuntu Artifacts and Install Binary
|
||||
run: |
|
||||
mkdir ~/build
|
||||
tar -xf ~/artifacts/linux.tar.gz -C ~/build
|
||||
|
||||
- name: Copy binary
|
||||
run: |
|
||||
cp ~/build/steampipe tests/dockertesting/oraclelinux
|
||||
|
||||
- name: Build steampipe docker images
|
||||
run: |
|
||||
docker build -t sporacle tests/dockertesting/oraclelinux
|
||||
docker images
|
||||
|
||||
- name: Create a container and run the test suite
|
||||
run: |
|
||||
docker run --name steampipe-oracle `docker images -q sporacle`
|
||||
echo "docker run complete"
|
||||
|
||||
create_release_tag:
|
||||
name: Tag Release
|
||||
needs: [goreleaser, acceptance_test, docker_acceptance_test_debian, docker_acceptance_test_oraclelinux]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Trim asset version prefix and Validate
|
||||
run: |-
|
||||
echo $VERSION
|
||||
trim=${VERSION#"v"}
|
||||
echo $trim
|
||||
if [[ $trim =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
|
||||
echo "Version OK: $trim"
|
||||
else
|
||||
echo "Invalid version: $trim"
|
||||
exit 1
|
||||
fi
|
||||
echo "VERSION=${trim}" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Tag Release
|
||||
run: |
|
||||
git config user.name "Steampipe GitHub Actions Bot"
|
||||
git config user.email noreply@github.com
|
||||
git tag ${{ github.event.inputs.version }}
|
||||
git push origin ${{ github.event.inputs.version }}
|
||||
|
||||
ensure_branch_in_homebrew:
|
||||
name: Ensure branch exists in homebrew-tap
|
||||
needs: [create_release_tag]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Parse semver string
|
||||
id: semver_parser
|
||||
uses: booxmedialtd/ws-action-parse-semver@v1
|
||||
with:
|
||||
input_string: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Checkout
|
||||
if: steps.semver_parser.outputs.prerelease == ''
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: turbot/homebrew-tap
|
||||
token: ${{ secrets.GH_ACCESS_TOKEN }}
|
||||
ref: main
|
||||
|
||||
- name: Delete base branch if exists
|
||||
if: steps.semver_parser.outputs.prerelease == ''
|
||||
run: |
|
||||
git fetch --all
|
||||
git push origin --delete bump-brew
|
||||
git push origin --delete $VERSION
|
||||
continue-on-error: true
|
||||
|
||||
- name: Create base branch
|
||||
if: steps.semver_parser.outputs.prerelease == ''
|
||||
run: |
|
||||
git checkout -b bump-brew
|
||||
git push --set-upstream origin bump-brew
|
||||
|
||||
create_release:
|
||||
name: Release
|
||||
needs: [create_release_tag, ensure_branch_in_homebrew]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
|
||||
|
||||
# - name: Setup GCloud CLI
|
||||
# uses: google-github-actions/setup-gcloud@v0.6.0
|
||||
# with:
|
||||
# service_account_key: ${{ secrets.GCP_GITHUB_ACTION_PUSH_ARTIFACTS }}
|
||||
# project_id: ${{ env.PROJECT_ID }}
|
||||
# export_default_credentials: true
|
||||
|
||||
# - name: Install GCloud Beta Components
|
||||
# run: |-
|
||||
# gcloud config list
|
||||
# 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
|
||||
|
||||
create_pr_in_homebrew:
|
||||
name: Create PR in homebrew-tap
|
||||
needs: [ensure_branch_in_homebrew, create_release]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
Version: ${{ github.event.inputs.version }}
|
||||
steps:
|
||||
- name: Parse semver string
|
||||
id: semver_parser
|
||||
uses: booxmedialtd/ws-action-parse-semver@v1
|
||||
with:
|
||||
input_string: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Checkout
|
||||
if: steps.semver_parser.outputs.prerelease == ''
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: turbot/homebrew-tap
|
||||
token: ${{ secrets.GH_ACCESS_TOKEN }}
|
||||
ref: main
|
||||
|
||||
- name: Create a new branch off the base branch
|
||||
if: steps.semver_parser.outputs.prerelease == ''
|
||||
run: |
|
||||
git fetch --all
|
||||
git checkout bump-brew
|
||||
git checkout -b $VERSION
|
||||
git push --set-upstream origin $VERSION
|
||||
|
||||
- name: Close pull request if already exists
|
||||
if: steps.semver_parser.outputs.prerelease == ''
|
||||
run: |
|
||||
gh pr close $VERSION
|
||||
continue-on-error: true
|
||||
|
||||
- name: Create pull request
|
||||
if: steps.semver_parser.outputs.prerelease == ''
|
||||
run: |
|
||||
gh pr create --base main --head $VERSION --title "$Version" --body "Update formula"
|
||||
|
||||
|
||||
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_pr_in_homebrew
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean up Linux Build
|
||||
uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: build-artifact-linux
|
||||
|
||||
- name: Clean up Darwin Build
|
||||
uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: build-artifact-darwin
|
||||
21
.github/workflows/release_cli_and_assets.yml
vendored
21
.github/workflows/release_cli_and_assets.yml
vendored
@@ -3,9 +3,6 @@ name: Steampipe Release (CLI and Assets)
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: "The branch that will be built"
|
||||
required: true
|
||||
version:
|
||||
description: "The version to release (must be prefixed with 'v')"
|
||||
required: true
|
||||
@@ -42,7 +39,7 @@ jobs:
|
||||
- name: Validate Branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event.ref }}
|
||||
|
||||
verify_asset_unreleased:
|
||||
name: Verify Assets Unreleased
|
||||
@@ -128,7 +125,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event.ref }}
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
@@ -251,7 +248,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event.ref }}
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch
|
||||
@@ -337,7 +334,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event.ref }}
|
||||
|
||||
- name: Setup BATS
|
||||
uses: mig4/setup-bats@v1
|
||||
@@ -390,7 +387,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event.ref }}
|
||||
|
||||
- name: Prepare for downloads
|
||||
id: prepare-for-downloads
|
||||
@@ -414,7 +411,7 @@ jobs:
|
||||
|
||||
- name: Build steampipe docker images
|
||||
run: |
|
||||
docker build -t spdebian tests/dockertesting/debian --build-arg TARGETBRANCH="${{ github.event.inputs.branch }}"
|
||||
docker build -t spdebian tests/dockertesting/debian --build-arg TARGETBRANCH="${{ github.event.ref }}"
|
||||
docker images
|
||||
|
||||
- name: Create a container and run the test suite
|
||||
@@ -431,7 +428,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event.ref }}
|
||||
|
||||
- name: Prepare for downloads
|
||||
id: prepare-for-downloads
|
||||
@@ -455,7 +452,7 @@ jobs:
|
||||
|
||||
- name: Build steampipe docker images
|
||||
run: |
|
||||
docker build -t sporacle tests/dockertesting/oraclelinux --build-arg TARGETBRANCH="${{ github.event.inputs.branch }}"
|
||||
docker build -t sporacle tests/dockertesting/oraclelinux --build-arg TARGETBRANCH="${{ github.event.ref }}"
|
||||
docker images
|
||||
|
||||
- name: Create a container and run the test suite
|
||||
@@ -485,7 +482,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event.ref }}
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
Reference in New Issue
Block a user