Skip to content

Commit d312c37

Browse files
committed
Actions need to be merged to test, so isolate testing them into a bespoke action to validate env var config and that this issue is handled: actions/runner#2058
1 parent cb36745 commit d312c37

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: actions-test-playground
2+
3+
on:
4+
push:
5+
branches:
6+
- 'test_actions*'
7+
pull_request:
8+
paths:
9+
- '.github/workflows/actions-test-playground.yml'
10+
- 'internal/buildscripts/packaging/temp-gh-actions-test/**'
11+
- 'Makefile'
12+
13+
concurrency:
14+
group: actions-test-playground-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
PYTHON_VERSION: '3.10'
19+
PIP_VERSION: '22.0.4'
20+
GO_VERSION: 1.19.0
21+
22+
jobs:
23+
setup-environment:
24+
name: setup-environment
25+
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved
26+
runs-on: ubuntu-20.04
27+
steps:
28+
- name: Check out the codebase.
29+
uses: actions/checkout@v3
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v3
33+
with:
34+
go-version: ${{ env.GO_VERSION }}
35+
36+
- name: Caching dependency
37+
uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cache/go-build
41+
~/go/pkg/mod
42+
~/go/bin
43+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
44+
45+
- name: Test env vars
46+
run: |
47+
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
48+
echo "GITHUB_REF_NAME=$GITHUF_REF_NAME"
49+
echo "REF_TYPE=$REF_TYPE"
50+
make install-tools
51+
make test-gh-actions

Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,13 @@ endif
225225
.PHONY: update-examples
226226
update-examples:
227227
cd examples && $(MAKE) update-examples
228+
229+
.PHONY: test-gh-actions
230+
test-gh-actions:
231+
echo "In makefile for github actions"
232+
echo "$(GITHUB_WORKSPACE)"
233+
echo "$(GITHUB_REF)"
234+
echo "$(GITHUB_REF_NAME)"
235+
echo "$(REF_TYPE)"
236+
echo "$(VERSION)"
237+
./internal/buildscripts/packaging/temp-gh-actions-test/test-gh-actions-shell-script.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
echo "starting tests!"
3+
set -euxo pipefail
4+
# Tests that github actions env vars are set as expected. Likely to fail on first few pushes, as we will be validating
5+
# an error case to start with.
6+
7+
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
8+
echo "GITHUB_REF_NAME=$GITHUB_REF_NAME"
9+
echo "REF_TYPE=$REF_TYPE"
10+
echo "exiting test.."

0 commit comments

Comments
 (0)