This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
Update github actions #3059
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: End to End | |
defaults: | |
run: | |
shell: bash --noprofile --norc -eo pipefail {0} | |
on: | |
push: | |
branches: [master, main, force_test, release-*, staging, trying] | |
pull_request: | |
branches: ['**'] | |
schedule: | |
- cron: "6 0 * * *" | |
# Allows to embed this workflow into another repository (e.g. promscale_extension) | |
# See .github/README.md in timescale/promscale_extension | |
workflow_call: | |
inputs: | |
docker_image_prefix: | |
required: true | |
type: string | |
ref: | |
required: false | |
type: string | |
default: ${{ github.ref }} | |
env: | |
golang-version: 1.22.1 | |
jobs: | |
pick_docker_image: | |
name: pick_docker_image | |
runs-on: ubuntu-latest | |
outputs: | |
docker_image_12: ${{ steps.metadata.outputs.docker_image_12 }} | |
docker_image_13: ${{ steps.metadata.outputs.docker_image_13 }} | |
docker_image_14: ${{ steps.metadata.outputs.docker_image_14 }} | |
docker_image_15: ${{ steps.metadata.outputs.docker_image_15 }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
repository: timescale/promscale | |
ref: ${{ inputs.ref }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Figure out database container image from branch name | |
id: metadata | |
run: | | |
if [[ "${{ github.event_name }}" =~ 'workflow_call' ]]; then | |
docker_image_12=$(echo ${{inputs.docker_image_prefix}}-pg12) | |
docker_image_13=$(echo ${{inputs.docker_image_prefix}}-pg13) | |
docker_image_14=$(echo ${{inputs.docker_image_prefix}}-pg14) | |
docker_image_15=$(echo ${{inputs.docker_image_prefix}}-pg15) | |
else | |
branch_name=$(echo ${{github.head_ref || github.ref_name}} | sed 's#/#-#') | |
possible_branch_tag=$(echo ${branch_name}-ts2) | |
extension_version=$(cat EXTENSION_VERSION | tr -d '[:space:]') | |
stable_branch_tag=$(echo ${extension_version}-ts2) | |
image_base="ghcr.io/timescale/dev_promscale_extension" | |
docker_image_12=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg12 ${image_base}:${stable_branch_tag}-pg12) | |
docker_image_13=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg13 ${image_base}:${stable_branch_tag}-pg13) | |
docker_image_14=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg14 ${image_base}:${stable_branch_tag}-pg14) | |
docker_image_15=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag}-pg15 ${image_base}:${stable_branch_tag}-pg15) | |
fi; | |
echo "docker_image_12=${docker_image_12}" >> ${GITHUB_OUTPUT} | |
echo "docker_image_13=${docker_image_13}" >> ${GITHUB_OUTPUT} | |
echo "docker_image_14=${docker_image_14}" >> ${GITHUB_OUTPUT} | |
echo "docker_image_15=${docker_image_15}" >> ${GITHUB_OUTPUT} | |
test-end-to-end: | |
name: e2e | |
needs: pick_docker_image | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
test-setups: | |
- {name: "Singlenode (15)", shortname: "singlenode-15", multi: false, pg: 15} | |
- {name: "Singlenode (14)", shortname: "singlenode-14", multi: false, pg: 14} | |
- {name: "Singlenode (13)", shortname: "singlenode-13", multi: false, pg: 13} | |
- {name: "Singlenode (12)", shortname: "singlenode-12", multi: false, pg: 12} | |
# TODO (james): Skipping multinode because tests are broken for now | |
# - {name: "Multinode", shortname: "multinode", multi: true, pg: 14} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
repository: timescale/promscale | |
ref: ${{ inputs.ref }} | |
- name: Checkout test data files | |
run: wget https://github.com/timescale/promscale-test-data/raw/main/traces-dataset.sz -O pkg/tests/testdata/traces-dataset.sz | |
- name: Set up Go ${{ env.golang-version }} | |
uses: actions/[email protected] | |
with: | |
go-version: ${{ env.golang-version }} | |
id: go | |
- name: Use Go module caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test ${{ matrix.test-setups.name }} | |
env: | |
DOCKER_IMAGE: ${{ needs.pick_docker_image.outputs[ format('docker_image_{0}', matrix.test-setups.pg) ] }} | |
MULTI: ${{ matrix.test-setups.multi }} | |
SHORTNAME: ${{ matrix.test-setups.shortname }} | |
run: go test -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE | |
test-jaeger-storage-integration: | |
name: jaeger-storage-integration | |
needs: pick_docker_image | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
test-setups: | |
- {name: "Singlenode (15)", shortname: "singlenode-15", multi: false, pg: 15} | |
- {name: "Singlenode (14)", shortname: "singlenode-14", multi: false, pg: 14} | |
- {name: "Singlenode (13)", shortname: "singlenode-13", multi: false, pg: 13} | |
- {name: "Singlenode (12)", shortname: "singlenode-12", multi: false, pg: 12} | |
# TODO (james): Skipping multinode because tests are broken for now | |
# - {name: "Multinode", shortname: "multinode", multi: true, pg: 14} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
repository: timescale/promscale | |
ref: ${{ inputs.ref }} | |
- name: Set up Go ${{ env.golang-version }} | |
uses: actions/[email protected] | |
with: | |
go-version: ${{ env.golang-version }} | |
id: go | |
- name: Use Go module caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test ${{ matrix.test-setups.name }} | |
env: | |
DOCKER_IMAGE: ${{ needs.pick_docker_image.outputs[ format('docker_image_{0}', matrix.test-setups.pg) ] }} | |
MULTI: ${{ matrix.test-setups.multi }} | |
SHORTNAME: ${{ matrix.test-setups.shortname }} | |
run: go test -v -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE -tags=jaeger_storage_test -run="^TestJaegerStorageIntegration/" | |
upgrade_test: | |
name: upgrade_tests | |
needs: pick_docker_image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
with: | |
repository: timescale/promscale | |
ref: ${{ inputs.ref }} | |
- name: Set up Go ${{ env.golang-version }} | |
uses: actions/[email protected] | |
with: | |
go-version: ${{ env.golang-version }} | |
id: go | |
- name: Use Go module caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test Upgrade from PG12 | |
env: | |
DOCKER_IMAGE: ${{ needs.pick_docker_image.outputs.docker_image_12 }} | |
run: go test -race -v -timeout=30m ./pkg/tests/upgrade_tests/ -timescale-docker-image=$DOCKER_IMAGE | |
# Added to summarize the matrix | |
tests-result: | |
name: e2e results | |
if: always() | |
needs: | |
- test-end-to-end | |
- test-jaeger-storage-integration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Mark the job as a success | |
if: needs.test-end-to-end.result == 'success' && needs.test-jaeger-storage-integration.result == 'success' | |
run: exit 0 | |
- name: Mark the job as a failure | |
if: needs.test-end-to-end.result != 'success' || needs.test-jaeger-storage-integration.result != 'success' | |
run: exit 1 |