forked from signalfx/splunk-otel-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actions need to be merged to test, so isolate testing them into a bes…
…poke action to validate env var config and that this issue is handled: actions/runner#2058
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: actions-test-playground | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'test_actions*' | ||
pull_request: | ||
paths: | ||
- '.github/workflows/actions-test-playground.yml' | ||
- 'internal/buildscripts/packaging/temp-gh-actions-test/**' | ||
- 'Makefile' | ||
|
||
concurrency: | ||
group: actions-test-playground-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PYTHON_VERSION: '3.10' | ||
PIP_VERSION: '22.0.4' | ||
GO_VERSION: 1.19.0 | ||
|
||
jobs: | ||
setup-environment: | ||
name: setup-environment | ||
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Caching dependency | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
~/go/bin | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
|
||
- name: Test env vars | ||
run: | | ||
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" | ||
echo "GITHUB_REF_NAME=$GITHUB_REF_NAME" | ||
echo "GITHUB_REF_TYPE=$GITHUB_REF_TYPE" | ||
echo "github ref name: ${{ github.ref_name }}" | ||
echo "github ref type: ${{ github.ref_type }}" | ||
make install-tools | ||
make test-gh-actions | ||
echo "back to testing workflow yaml" | ||
echo "github ref name: ${{ github.ref_name }}" | ||
echo "github ref type: ${{ github.ref_type }}" | ||
echo "github workspace: ${{ github.workspace }}" | ||
echo "github ref: ${{ github.ref }}" | ||
echo "github env: ${{ github.env }}" | ||
echo "github env workspace: ${{ env.GITHUB_WORKSPACE }}" | ||
- name: Test env vars | ||
if: ${{ github.ref_type == "tag" }} | ||
run: | | ||
echo "HEY THIS IS A TAGGED COMMIT" | ||
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" | ||
echo "GITHUB_REF_NAME=$GITHUB_REF_NAME" | ||
echo "GITHUB_REF_TYPE=$GITHUB_REF_TYPE" | ||
echo "github ref name: ${{ github.ref_name }}" | ||
echo "github ref type: ${{ github.ref_type }}" | ||
make install-tools | ||
make test-gh-actions | ||
echo "back to testing workflow yaml" | ||
echo "github ref name: ${{ github.ref_name }}" | ||
echo "github ref type: ${{ github.ref_type }}" | ||
echo "github workspace: ${{ github.workspace }}" | ||
echo "github ref: ${{ github.ref }}" | ||
echo "github env: ${{ github.env }}" | ||
echo "github env workspace: ${{ env.GITHUB_WORKSPACE }}" |
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
10 changes: 10 additions & 0 deletions
10
internal/buildscripts/packaging/temp-gh-actions-test/test-gh-actions-shell-script.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
echo "starting tests!" | ||
set -euxo pipefail | ||
# Tests that github actions env vars are set as expected. Likely to fail on first few pushes, as we will be validating | ||
# an error case to start with. | ||
|
||
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" | ||
echo "GITHUB_REF_NAME=$GITHUB_REF_NAME" | ||
echo "GITHUB_REF_TYPE=$GITHUB_REF_TYPE" | ||
echo "exiting test.." |