This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
Bump actions/setup-go from 2 to 5 #9
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: Check - Diagnostics Plugin | |
on: | |
pull_request: | |
branches: | |
- main | |
- release-* | |
paths: | |
- "cli/cmd/plugin/diagnostics/" | |
- "!cli/cmd/plugin/diagnostics/**.md" | |
- ".github/workflows/check-pr-diagnostics-plugin.yaml" | |
- ".github/workflows/e2e-diagnostics-plugin.yaml" | |
types: | |
- assigned | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
setup-runner: | |
name: Start self-hosted EC2 runner | |
runs-on: ubuntu-latest | |
outputs: | |
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
steps: | |
- name: Start EC2 runner | |
id: start-ec2-runner | |
shell: bash | |
run: | | |
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}" | |
echo "INSTANCE_NAME: ${INSTANCE_NAME}" | |
echo ::set-output name=ec2-instance-id::${INSTANCE_NAME} | |
build-release: | |
name: Build Release based on PR | |
needs: setup-runner # required to start the main job when the runner is ready | |
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.17" | |
id: go | |
- name: Config git | |
shell: bash | |
run: | | |
git config --global init.defaultBranch main | |
- name: Check out code | |
uses: actions/checkout@v1 | |
- name: Restore Go Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Get dependencies | |
shell: bash | |
run: | | |
make get-deps | |
- name: Build | |
shell: bash | |
run: | | |
make ensure-deps | |
make release ENVS=linux-amd64 | |
- name: Install | |
shell: bash | |
run: | | |
cd `find ./release -type d -name "tce-linux-amd64-*" | xargs -n1 echo -n` | |
ALLOW_INSTALL_AS_ROOT=true ./install.sh | |
test-diagnostics-plugin: | |
name: Test Diagnostics Plugin | |
needs: | |
- setup-runner # required to start the main job when the runner is ready | |
- build-release | |
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner | |
steps: | |
- name: Tests Diagnostics Plugin | |
run: | | |
cd cli/cmd/plugin/diagnostics/ | |
make test-pr-check | |
teardown-runner: | |
name: Stop self-hosted EC2 runner | |
needs: | |
- setup-runner # required to get output from the setup-runner job | |
- test-diagnostics-plugin # required to wait when the main job is done | |
runs-on: ubuntu-latest | |
steps: | |
- name: Stop EC2 runner | |
id: stop-ec2-runner | |
shell: bash | |
run: | | |
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}" | |
echo "INSTANCE_NAME: ${INSTANCE_NAME}" |