Cherry-pick 1355baef0a370628f23d24123f003c3e36660c7f with conflicts #47130
Workflow file for this run
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: local_example | |
on: [push, pull_request] | |
permissions: read-all | |
jobs: | |
build: | |
name: Local example using ${{ matrix.topo }} on Ubuntu | |
runs-on: gh-hosted-runners-16cores-1-24.04 | |
strategy: | |
matrix: | |
topo: [consul,etcd,zk2] | |
steps: | |
- name: Skip CI | |
run: | | |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then | |
echo "skipping CI due to the 'Skip CI' label" | |
exit 1 | |
fi | |
- name: Check if workflow needs to be skipped | |
id: skip-workflow | |
run: | | |
skip='false' | |
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then | |
skip='true' | |
fi | |
echo Skip ${skip} | |
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT | |
- name: Check out code | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Check for changes in relevant files | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' | |
uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1 | |
id: changes | |
with: | |
token: '' | |
filters: | | |
examples: | |
- 'go/**/*.go' | |
- 'test.go' | |
- 'Makefile' | |
- 'build.env' | |
- 'go.sum' | |
- 'go.mod' | |
- 'proto/*.proto' | |
- 'tools/**' | |
- 'config/**' | |
- 'bootstrap.sh' | |
- 'examples/**' | |
- '.github/workflows/local_example.yml' | |
- name: Set up Go | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true' | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version-file: go.mod | |
- name: Tune the OS | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true' | |
run: | | |
sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535" | |
- name: Get dependencies | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true' | |
run: | | |
go mod download | |
- name: Run make minimaltools | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true' | |
run: | | |
make minimaltools | |
- name: Build | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true' | |
run: | | |
make build | |
- name: local_example | |
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true' | |
timeout-minutes: 30 | |
run: | | |
export TOPO=${{matrix.topo}} | |
if [ ${{matrix.os}} = "macos-latest" ]; then | |
export PATH="/usr/local/opt/[email protected]/bin:$PATH" | |
fi | |
eatmydata -- go run test.go -print-log -follow -retry=1 local_example |