这是indexloc提供的服务,不要输入任何密码
Skip to content

Add exit codes for cancellation and failure scenarios in collect, compact, connect, and query commands #649

Add exit codes for cancellation and failure scenarios in collect, compact, connect, and query commands

Add exit codes for cancellation and failure scenarios in collect, compact, connect, and query commands #649

name: "11 - Test: Acceptance"
on:
workflow_call:
push:
tags:
- v*
branches:
- main
workflow_dispatch:
pull_request:
env:
TAILPIPE_UPDATE_CHECK: false
SPIPETOOLS_TOKEN: ${{ secrets.SPIPETOOLS_TOKEN }}
jobs:
goreleaser:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: tailpipe
ref: ${{ github.event.ref }}
- name: Checkout Pipe Fittings Components repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: turbot/pipe-fittings
path: pipe-fittings
ref: develop
- name: Checkout Tailpipe plugin SDK repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: turbot/tailpipe-plugin-sdk
path: tailpipe-plugin-sdk
ref: develop
- name: Checkout Tailpipe Core Plugin repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: turbot/tailpipe-plugin-core
path: tailpipe-plugin-core
ref: main
# this is required, check golangci-lint-action docs
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: "1.23"
cache: false # setup-go v4 caches by default, do not change this parameter, check golangci-lint-action doc: https://github.com/golangci/golangci-lint-action/pull/704
- name: Run CLI Unit Tests
run: |
cd tailpipe
go clean -testcache
go test -timeout 30s ./... -test.v
- name: Build Custom Goreleaser Cross Image for Linux
run: |-
cd tailpipe
make build-goreleaser-image
echo "=== Verifying GCC 13 ==="
docker run --rm tailpipe-goreleaser-cross:gcc13 gcc-13 --version | head -1
- name: Build
run: |-
cd tailpipe
make release-acceptance
- name: Move build artifacts
run: |
ls -al $GITHUB_WORKSPACE/tailpipe
sudo chown -R runner:docker $GITHUB_WORKSPACE/tailpipe/dist
mkdir ~/artifacts
mv $GITHUB_WORKSPACE/tailpipe/dist/tailpipe.linux.amd64.tar.gz ~/artifacts/linux.tar.gz
- name: List Build Artifacts
run: ls -l ~/artifacts
- name: Save Linux Build Artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-artifact-linux
path: ~/artifacts/linux.tar.gz
if-no-files-found: error
acceptance_test:
name: Test
needs: goreleaser
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
test_block:
- "all_column_types"
- "from_and_to"
- "introspection"
- "partition_tests"
- "file_source"
- "partition_delete"
- "core_formats"
- "table_block"
- "config_precedence"
- "plugin"
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
path: tailpipe
ref: ${{ github.event.ref }}
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.22
cache: false
- name: Prepare for downloads
id: prepare-for-downloads
run: |
mkdir ~/artifacts
- name: Download Linux Build Artifacts
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
if: ${{ matrix.platform == 'ubuntu-latest' }}
with:
name: build-artifact-linux
path: ~/artifacts
- name: Extract Linux 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/tailpipe/tests/acceptance/lib/bats-core/libexec" >> $GITHUB_ENV
- name: Go install jd
run: |
go install github.com/josephburnett/jd@latest
- name: Install Tailpipe and plugins
run: |
tailpipe plugin install chaos aws
- name: Run Test Suite
id: run-test-suite
timeout-minutes: 15
continue-on-error: true
run: |
chmod +x $GITHUB_WORKSPACE/tailpipe/tests/acceptance/run.sh
$GITHUB_WORKSPACE/tailpipe/tests/acceptance/run.sh ${{ matrix.test_block }}.bats
echo "exit_code=$(echo $?)" >> $GITHUB_OUTPUT
echo ">> here"
# This job checks whether the test suite has passed or not.
# Since the exit_code is set only when the bats test suite pass,
# we have added the if-conditional block
- name: Check Test Passed/Failed
if: ${{ success() }}
continue-on-error: false
run: |
if [ ${{ steps.run-test-suite.outputs.exit_code }} -eq 0 ]; then
exit 0
else
exit 1
fi
cleanup:
# 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_test
# if: ${{ needs.acceptance_test.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Clean up Linux Build
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
with:
name: build-artifact-linux
failOnError: true
- name: Clean up Linux Build
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
with:
name: build-artifact-linux
failOnError: true