mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-16 07:00:18 -05:00
172 lines
4.8 KiB
YAML
172 lines
4.8 KiB
YAML
name: steampipe-tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
env:
|
|
STEAMPIPE_UPDATE_CHECK: false
|
|
|
|
jobs:
|
|
goreleaser:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Unshallow
|
|
run: git fetch
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.14
|
|
|
|
- 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 --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_testing:
|
|
name: Acceptance testing
|
|
needs: goreleaser
|
|
strategy:
|
|
matrix:
|
|
platform: [ macos-latest ]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.14
|
|
# if we don't do this, Git will convert all line endings to CRLF when cloning on windows
|
|
- name: Setup BATS
|
|
uses: mig4/setup-bats@v1
|
|
with:
|
|
bats-version: 1.2.1
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Prepare for downloads
|
|
id: prepare-for-downloads
|
|
run: |
|
|
mkdir ~/artifacts
|
|
|
|
- name: Download Darwin Build Artifacts
|
|
uses: actions/download-artifact@v2
|
|
if: ${{ matrix.platform == 'macos-latest' }}
|
|
with:
|
|
name: build-artifact-darwin
|
|
path: ~/artifacts
|
|
|
|
- name: Check that everything got downloaded
|
|
run: |
|
|
ls -l ~/artifacts
|
|
|
|
- name: Rename build artifact on Darwin
|
|
if: ${{ matrix.platform == 'macos-latest' }}
|
|
run: mv ~/artifacts/darwin.zip ~/artifacts/build.zip
|
|
|
|
- name: Check that renaming is good
|
|
run: |
|
|
ls -l ~/artifacts
|
|
|
|
- name: Extract Artifacts and Install Binary
|
|
if: ${{ matrix.platform == 'macos-latest' }}
|
|
run: |
|
|
mkdir ~/build
|
|
unzip ~/artifacts/build.zip -d ~/build
|
|
ls -l ~/build
|
|
echo "PATH=$PATH:$HOME/build:$GTIHUB_WORKSPACE/tests/acceptance/lib/bats/libexec" >> $GITHUB_ENV
|
|
|
|
- name: Install DB
|
|
if: ${{ matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' }}
|
|
run: |
|
|
echo $PATH
|
|
steampipe query "select 1 as col"
|
|
|
|
- name: Install chaos plugin
|
|
if: ${{ matrix.platform == 'macos-latest' }}
|
|
run: |
|
|
steampipe plugin install chaos
|
|
|
|
- name: Stop steampipe service
|
|
run: |
|
|
steampipe service stop --force
|
|
|
|
- name: Start steampipe service
|
|
run: |
|
|
steampipe service start
|
|
|
|
- name: Run Test Suite
|
|
run: |
|
|
chmod +x $GITHUB_WORKSPACE/tests/acceptance/run.sh
|
|
$GITHUB_WORKSPACE/tests/acceptance/run.sh
|
|
|
|
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: acceptance_testing
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clean up Windows Build
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: build-artifact-windows
|
|
failOnError: true
|
|
|
|
- name: Clean up Linux Build
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: build-artifact-linux
|
|
failOnError: true
|
|
|
|
- name: Clean up Darwin Build
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: build-artifact-darwin
|
|
failOnError: true
|
|
|
|
- name: Clean up Test Suite
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: test-artifact
|
|
failOnError: true |