Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Github Actions Migration - move go-tests workflows to GHA into release/1.13.x #16801

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
240b2e2
backport of commit df9d97f9943e9bf0a32ae618098917bd71606773
jmurret Mar 24, 2023
5ad5f6f
backport of commit 8913844f1da6247347c4a41b133ef78ca56d8afb
jmurret Mar 24, 2023
130befc
backport of commit e8d708b6931edb6fa4d35e9cae5f9fa0b617d536
jmurret Mar 24, 2023
7acd01b
backport of commit b42be82b322db542a25d3b0007dac663cc983da1
jmurret Mar 24, 2023
4c2d7e3
backport of commit 2e7fc805c974fab9f34c09ea7403a38bb9c15e1c
jmurret Mar 25, 2023
e89abae
backport of commit 6e65358f2a6a46bd1a6a954b1205170a01c096eb
jmurret Mar 27, 2023
8151531
backport of commit 924060ef91eab4fe23186e7abdd504b0e7b48457
jmurret Mar 27, 2023
46ed038
backport of commit b4f5218a29caa71ad5e6e0472bcf0120a3efe22b
jmurret Mar 27, 2023
c34e001
backport of commit 4a3c1a2b5279b66a59612ee708f0cf626de4d751
jmurret Mar 27, 2023
ae55063
backport of commit e6f0d8e361ca43920e3de6309ee9edd93f682f70
jmurret Mar 27, 2023
1115bfb
backport of commit 9eed445d5021c63882eee13da49c8a4177fc7da4
jmurret Mar 27, 2023
d24d81e
backport of commit 848170652d7a413ab56e145a46fd657deac726c7
jmurret Mar 27, 2023
17e1edc
backport of commit 5aab67566395fc39aded52bed8bbda3477ec86a1
jmurret Mar 27, 2023
b535ff1
backport of commit 07d8ede1ff363be46c29b4f4e07291f2cc57d027
jmurret Mar 28, 2023
2e38e1b
backport of commit 5b1b1acb82df179d18a360131b7b6873d5c0ada9
jmurret Mar 28, 2023
9eee318
backport of commit 2ca46f812daccca2bf4f32802f06bf23218de708
jmurret Mar 28, 2023
cd9497f
backport of commit c9f85388b1fd4d6ab03ee000d421e6a68ffb674f
jmurret Mar 28, 2023
7ea9482
backport of commit c450fa7d43da5a16b4f8dd2e3f1f0d23d444b844
jmurret Mar 28, 2023
41ee302
backport of commit 9302ebc9cff3f42ae71b3229216e63df67922fe6
jmurret Mar 28, 2023
53f8091
backport of commit 0f55035288595d5d5e6ceb8cc9e88d845f3001af
jmurret Mar 28, 2023
172a052
backport of commit 76694ab441022e85c9bab7b1d46ea45e732673f8
jmurret Mar 28, 2023
e7bcf95
backport of commit e7a7d983a5d2f790cf55ac9986fd16ee19775fec
jmurret Mar 28, 2023
9ac6750
backport of commit fea35f520370b45aafdfd19147e0e0af67427c2b
loshz Mar 28, 2023
8ce827f
backport of commit d64af3f727563464ea912abccc96d61f8ab46043
jmurret Mar 28, 2023
345dc99
backport of commit 840d80a1785cd7ad03816c74d76bdade8a0811f3
jmurret Mar 28, 2023
0286769
remove envoyextensions tests
jmurret Mar 28, 2023
a27163f
removing lint-container-test-d
jmurret Mar 28, 2023
54f3fcb
removing troubleshoot test
jmurret Mar 28, 2023
957cbc9
remove linting of test/integration/consul-container"
jmurret Mar 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/scripts/get_runner_classes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# This script generates tag-sets that can be used as runs-on: values to select runners.

set -euo pipefail

case "$GITHUB_REPOSITORY" in
*-enterprise)
# shellcheck disable=SC2129
echo "compute-small=['self-hosted', 'linux', 'small']" >> "$GITHUB_OUTPUT"
echo "compute-medium=['self-hosted', 'linux', 'medium']" >> "$GITHUB_OUTPUT"
echo "compute-large=['self-hosted', 'linux', 'large']" >> "$GITHUB_OUTPUT"
echo "compute-xl=['self-hosted', 'ondemand', 'linux', 'type=m5.2xlarge']" >> "$GITHUB_OUTPUT"
;;
*)
# shellcheck disable=SC2129
echo "compute-small=['custom-linux-s-consul-latest']" >> "$GITHUB_OUTPUT"
echo "compute-medium=['custom-linux-m-consul-latest']" >> "$GITHUB_OUTPUT"
echo "compute-large=['custom-linux-l-consul-latest']" >> "$GITHUB_OUTPUT"
echo "compute-xl=['custom-linux-xl-consul-latest']" >> "$GITHUB_OUTPUT"
;;
esac
27 changes: 27 additions & 0 deletions .github/scripts/notify_slack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -uo pipefail

# This script is used in GitHub Actions pipelines to notify Slack of a job failure.

if [[ $GITHUB_REF_NAME == "main" ]]; then
GITHUB_ENDPOINT="https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
GITHUB_ACTIONS_ENDPOINT="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
COMMIT_MESSAGE=$(git log -1 --pretty=%B | head -n1)
SHORT_REF=$(git rev-parse --short "${GITHUB_SHA}")
curl -X POST -H 'Content-type: application/json' \
--data \
"{ \
\"attachments\": [ \
{ \
\"fallback\": \"GitHub Actions workflow failed!\", \
\"text\": \"❌ Failed: \`${GITHUB_ACTOR}\`'s <${GITHUB_ACTIONS_ENDPOINT}|${GITHUB_JOB}> job failed for commit <${GITHUB_ENDPOINT}|${SHORT_REF}> on \`${GITHUB_REF_NAME}\`!\n\n- <${COMMIT_MESSAGE}\", \
\"footer\": \"${GITHUB_REPOSITORY}\", \
\"ts\": \"$(date +%s)\", \
\"color\": \"danger\" \
} \
] \
}" "${FEED_CONSUL_GH_URL}"
else
echo "Not posting slack failure notifications for non-main branch"
fi
24 changes: 24 additions & 0 deletions .github/scripts/rerun_fails_report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

#
# Add a comment on the github PR if there were any rerun tests.
#
set -eu -o pipefail

report_filename="${1?report filename is required}"
if [ ! -s "$report_filename" ]; then
echo "gotestsum rerun report file is empty or missing"
exit 0
fi

function report {
echo ":repeat: gotestsum re-ran some tests in https://github.com/hashicorp/consul/actions/run/$GITHUB_RUN_ID"
echo
echo '```'
cat "$report_filename"
echo '```'
}

report
8 changes: 8 additions & 0 deletions .github/scripts/set_test_package_matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
export RUNNER_COUNT=$1

# set matrix var to list of unique packages containing tests
matrix="$(go list -json="ImportPath,TestGoFiles" ./... | jq --compact-output '. | select(.TestGoFiles != null) | .ImportPath' | jq --slurp --compact-output '.' | jq --argjson runnercount $RUNNER_COUNT -cM '[_nwise(length / $runnercount | floor)]'))"

echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
48 changes: 30 additions & 18 deletions .github/workflows/build-distros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,34 @@ permissions:
contents: read

jobs:
check-go-mod:
runs-on: ubuntu-22.04
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
compute-small: ${{ steps.setup-outputs.outputs.compute-small }}
compute-medium: ${{ steps.setup-outputs.outputs.compute-medium }}
compute-large: ${{ steps.setup-outputs.outputs.compute-large }}
compute-xl: ${{ steps.setup-outputs.outputs.compute-xl }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # [email protected]
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # [email protected]
with:
go-version-file: 'go.mod'
- run: go mod tidy
- run: |
if [[ -n $(git status -s) ]]; then
echo "Git directory has changes"
git status -s
exit 1
fi
- id: setup-outputs
name: Setup outputs
run: ./.github/scripts/get_runner_classes.sh

check-go-mod:
needs:
- setup
uses: ./.github/workflows/reusable-check-go-mod.yml
with:
runs-on: ${{ needs.setup.outputs.compute-medium }}

build-386:
needs: check-go-mod
needs:
- setup
- check-go-mod
env:
XC_OS: "freebsd linux windows"
runs-on: ubuntu-22.04
runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # [email protected]
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # [email protected]
Expand All @@ -40,10 +48,12 @@ jobs:
done

build-amd64:
needs: check-go-mod
needs:
- setup
- check-go-mod
env:
XC_OS: "darwin freebsd linux solaris windows"
runs-on: ubuntu-22.04
runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # [email protected]
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # [email protected]
Expand All @@ -56,8 +66,10 @@ jobs:
done

build-arm:
needs: check-go-mod
runs-on: ubuntu-22.04
needs:
- setup
- check-go-mod
runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }}
env:
CGO_ENABLED: 1
GOOS: linux
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

name: frontend

on:
push:
branches:
- main
- ui/**
- backport/ui/**

permissions:
contents: read

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
compute-small: ${{ steps.setup-outputs.outputs.compute-small }}
compute-medium: ${{ steps.setup-outputs.outputs.compute-medium }}
compute-large: ${{ steps.setup-outputs.outputs.compute-large }}
compute-xl: ${{ steps.setup-outputs.outputs.compute-xl }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # [email protected]
- id: setup-outputs
name: Setup outputs
run: ./.github/scripts/get_runner_classes.sh

workspace-tests:
needs: setup
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # [email protected]

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
with:
node-version: '16'

# Install dependencies.
- name: install yarn packages
working-directory: ui
run: make deps

- run: make test-workspace

node-tests:
needs: setup
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # [email protected]

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
with:
node-version: '16'

# Install dependencies.
- name: install yarn packages
working-directory: ui
run: make deps

- run: make test-node
working-directory: ui/packages/consul-ui

ember-build-test:
needs: setup
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
env:
EMBER_TEST_REPORT: test-results/report-oss.xml #outputs test report for CircleCI test summary
EMBER_TEST_PARALLEL: true #enables test parallelization with ember-exam
CONSUL_NSPACES_ENABLED: 0 # NOTE: this should be 1 in ENT.
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # [email protected]

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
with:
node-version: '16'

# Install dependencies.
- name: install yarn packages
working-directory: ui
run: make deps

- working-directory: ui/packages/consul-ui
run: |
make build-ci
node_modules/.bin/ember exam --path dist --silent -r xunit

- working-directory: ui/packages/consul-ui
run: make test-coverage-ci
Loading