Skip to content

Commit 78362e7

Browse files
authored
Remove top-level env from GitHub composite actions (#1313)
tl;dr - it doesn't work In composite actions, a `shell` _must_ be specified. To avoid duplication, this was centralised to an `env` variable. However, GitHub [doesn't support this](https://github.com/orgs/community/discussions/51280) - for example, in [this job](https://github.com/hazelcast/hazelcast-go-client/actions/runs/15848149662/job/44674983175) the output of `${{ env.shell }}` is blank. It _appeared_ to work because if the specified `shell` is empty, it uses the default shell of the executing runner - and all of our executions were setting `bash` on Linux/Mac or `pwsh` on Windows anyway so the net effect is the same. This bug appeared when a `bash` composite action failed to resolve `bash` commands on a Windows runner - because it was actually running in an (implicit) `pwsh` shell.
1 parent 68f7f56 commit 78362e7

File tree

6 files changed

+37
-64
lines changed

6 files changed

+37
-64
lines changed

.github/actions/build-test/macos-x86_64/action.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,15 @@ inputs:
2222
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
2323
required: true
2424

25-
env:
26-
# Not possible to set this as a default
27-
# https://github.com/orgs/community/discussions/46670
28-
shell: bash
29-
3025
runs:
3126
using: composite
3227
steps:
3328
- name: Read Config
34-
shell: ${{ env.shell }}
29+
shell: bash
3530
run: cat .github/config.env >> $GITHUB_ENV
3631

3732
- name: Install Dependencies
38-
shell: ${{ env.shell }}
33+
shell: bash
3934
run: |
4035
sudo ./scripts/install-boost.sh ${{ inputs.BOOST_VERSION }}
4136
brew install [email protected] thrift curl

.github/actions/build-test/ubuntu-i386/action.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,25 @@ inputs:
2424
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
2525
required: true
2626

27-
env:
28-
# Not possible to set this as a default
29-
# https://github.com/orgs/community/discussions/46670
30-
shell: bash
31-
3227
runs:
3328
using: composite
3429
steps:
3530
- name: Read Config
36-
shell: ${{ env.shell }}
31+
shell: bash
3732
run: cat .github/config.env >> $GITHUB_ENV
3833

3934
# Install Java via `apt`, can't use the `setup-java` action on this image
4035
# `setup-java` is written in TypeScript and requires a compatible Node installation
4136
# Newest available version for this image is Node 8, which is too old for any version to run against
4237
# https://github.com/actions/setup-node/issues/922
4338
- name: Install Necessary Packages
44-
shell: ${{ env.shell }}
39+
shell: bash
4540
run: |
4641
apt-get update
4742
apt-get install -y build-essential cmake curl git libssl-dev maven net-tools openjdk-${{ env.JAVA_VERSION }}-jre-headless gdb curl
4843
4944
- name: Make sure the target architecture is 32 bit
50-
shell: ${{ env.shell }}
45+
shell: bash
5146
run: |
5247
echo 'int main() { return sizeof(void*) != 4; }' > test.c
5348
gcc test.c -oa
@@ -56,7 +51,7 @@ runs:
5651
5752
# `apt-get` brings in `3.6` which is too old to be compatible with Java 17
5853
- name: Install Maven
59-
shell: ${{ env.shell }}
54+
shell: bash
6055
run: |
6156
install_dir="/opt/maven"
6257
mkdir ${install_dir}
@@ -74,7 +69,7 @@ runs:
7469
echo "${install_dir}/bin" >> $GITHUB_PATH
7570
7671
- name: Install `gh` CLI
77-
shell: ${{ env.shell }}
72+
shell: bash
7873
run: |
7974
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
8075
(type -p wget >/dev/null || (apt update && apt-get install wget -y)) \
@@ -87,18 +82,18 @@ runs:
8782
&& apt install gh -y
8883
8984
- name: Install Boost
90-
shell: ${{ env.shell }}
85+
shell: bash
9186
run: |
9287
./scripts/install-boost.sh ${{ inputs.BOOST_VERSION }}
9388
9489
- name: Install Thrift
95-
shell: ${{ env.shell }}
90+
shell: bash
9691
run: |
9792
./scripts/install-thrift.sh ${{ inputs.THRIFT_VERSION }}
9893
9994
- name: Configure Resources
10095
if: ${{ inputs.run_tests }}
101-
shell: ${{ env.shell }}
96+
shell: bash
10297
run: |
10398
ulimit -c unlimited
10499

.github/actions/build-test/ubuntu-x86_64/action.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,17 @@ inputs:
2424
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
2525
required: true
2626

27-
env:
28-
# Not possible to set this as a default
29-
# https://github.com/orgs/community/discussions/46670
30-
shell: bash
31-
3227
runs:
3328
using: composite
3429
steps:
3530
- name: Install Necessary Packages
36-
shell: ${{ env.shell }}
31+
shell: bash
3732
run: |
3833
sudo apt-get update
3934
sudo apt-get install -y net-tools libssl-dev gdb curl
4035
4136
- name: Read Config
42-
shell: ${{ env.shell }}
37+
shell: bash
4338
run: cat .github/config.env >> $GITHUB_ENV
4439

4540
- name: Setup JDK
@@ -49,18 +44,18 @@ runs:
4944
distribution: ${{ env.JAVA_DISTRIBUTION }}
5045

5146
- name: Install Boost
52-
shell: ${{ env.shell }}
47+
shell: bash
5348
run: |
5449
sudo ./scripts/install-boost.sh ${{ inputs.BOOST_VERSION }}
5550
5651
- name: Install Thrift
57-
shell: ${{ env.shell }}
52+
shell: bash
5853
run: |
5954
sudo ./scripts/install-thrift.sh ${{ inputs.THRIFT_VERSION }}
6055
6156
- name: Configure Resources
6257
if: ${{ inputs.run_tests }}
63-
shell: ${{ env.shell }}
58+
shell: bash
6459
run: |
6560
ulimit -c unlimited
6661

.github/actions/build-test/unix/action.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,11 @@ inputs:
2424
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
2525
required: true
2626

27-
env:
28-
# Not possible to set this as a default
29-
# https://github.com/orgs/community/discussions/46670
30-
shell: bash
31-
3227
runs:
3328
using: composite
3429
steps:
3530
- name: Download hazelcast-enterprise-tests.jar
36-
shell: ${{ env.shell }}
31+
shell: bash
3732
run: |
3833
gh api "/repos/hazelcast/private-test-artifacts/contents/certs.jar?ref=data" -H "Accept: application/vnd.github.raw" > hazelcast-enterprise-${{ env.HZ_VERSION }}-tests.jar
3934
env:
@@ -44,7 +39,7 @@ runs:
4439
BUILD_DIR: build
4540
INSTALL: ON
4641
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
47-
shell: ${{ env.shell }}
42+
shell: bash
4843
run: |
4944
./scripts/build-unix.sh \
5045
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/destination \
@@ -62,6 +57,6 @@ runs:
6257
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
6358
HZ_TEST_AWS_INSTANCE_PRIVATE_IP: ${{ inputs.HZ_TEST_AWS_INSTANCE_PRIVATE_IP }}
6459
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
65-
shell: ${{ env.shell }}
60+
shell: bash
6661
run: |
6762
./scripts/test-unix.sh

.github/actions/build-test/windows/action.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ inputs:
4242
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
4343
required: true
4444

45-
env:
46-
# Not possible to set this as a default
47-
# https://github.com/orgs/community/discussions/46670
48-
shell: pwsh
49-
5045
runs:
5146
using: composite
5247
steps:
@@ -55,14 +50,14 @@ runs:
5550
run: cat .github/config.env >> $GITHUB_ENV
5651

5752
- name: Download hazelcast-enterprise-tests.jar
58-
shell: ${{ env.shell }}
53+
shell: pwsh
5954
run: |
6055
gh api "/repos/hazelcast/private-test-artifacts/contents/certs.jar?ref=data" -H "Accept: application/vnd.github.raw" > hazelcast-enterprise-${{ env.HZ_VERSION }}-tests.jar
6156
env:
6257
GH_TOKEN: ${{ inputs.GH_TOKEN }}
6358

6459
- name: Install SysInternals
65-
shell: ${{ env.shell }}
60+
shell: pwsh
6661
run: |
6762
Invoke-WebRequest `
6863
"https://download.sysinternals.com/files/SysinternalsSuite.zip" `
@@ -77,7 +72,7 @@ runs:
7772
timeout_minutes: 10
7873
max_attempts : 4
7974
retry_on: error
80-
shell: ${{ env.shell }}
75+
shell: pwsh
8176
command: |
8277
choco install openssl ${{ inputs.ARCH_CHOCO_OPTIONS }}
8378
Invoke-WebRequest `
@@ -86,7 +81,7 @@ runs:
8681
8782
- if: ${{ inputs.INSTALL_BOOST != 'false' }}
8883
name: Install Boost
89-
shell: ${{ env.shell }}
84+
shell: pwsh
9085
run: |
9186
Invoke-WebRequest `
9287
"${{ inputs.BOOST_URL }}" `
@@ -102,7 +97,7 @@ runs:
10297
10398
- if: ${{ inputs.INSTALL_THRIFT != 'false' }}
10499
name: Install Thrift
105-
shell: ${{ env.shell }}
100+
shell: pwsh
106101
run: |
107102
Invoke-WebRequest `
108103
"https://archive.apache.org/dist/thrift/${{ inputs.THRIFT_VERSION }}/thrift-${{ inputs.THRIFT_VERSION }}.tar.gz" `
@@ -133,7 +128,7 @@ runs:
133128
BIT_VERSION: ${{ inputs.ARCH_ADDRESS_MODEL }}
134129
INSTALL: ON
135130
CXXFLAGS: '/I C:\Thrift\include\'
136-
shell: ${{ env.shell }}
131+
shell: pwsh
137132
run: |
138133
.\scripts\build-windows.bat `
139134
-DCMAKE_PREFIX_PATH="C:\Boost;C:\Thrift" `
@@ -153,7 +148,7 @@ runs:
153148
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
154149
HZ_TEST_AWS_INSTANCE_PRIVATE_IP: ${{ inputs.HZ_TEST_AWS_INSTANCE_PRIVATE_IP }}
155150
SSL_CERT_FILE: 'C:\cacert.pem'
156-
shell: ${{ env.shell }}
151+
shell: pwsh
157152
run: |
158153
$dump = start-process -NoNewWindow sys-internals\procdump.exe {-accepteula -e -ma -w client_test.exe crash.dmp}
159154
.\scripts\test-windows.bat

.github/actions/coverage-report/action.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,37 @@ inputs:
1818
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
1919
required: true
2020

21-
env:
22-
# Not possible to set this as a default
23-
# https://github.com/orgs/community/discussions/46670
24-
shell: bash
25-
BUILD_TYPE: Debug
26-
2721
runs:
2822
using: composite
2923
steps:
3024
- name: Read Config
31-
shell: ${{ env.shell }}
25+
shell: bash
3226
run: cat .github/config.env >> $GITHUB_ENV
3327

28+
- shell: bash
29+
run: |
30+
echo "BUILD_TYPE=Debug" >> ${GITHUB_ENV}
31+
3432
- name: Install Necessary Packages
35-
shell: ${{ env.shell }}
33+
shell: bash
3634
run: |
3735
sudo apt-get update
3836
sudo apt-get install -y net-tools libssl-dev gdb gcovr lcov curl
3937
4038
- name: Download hazelcast-enterprise-tests.jar
41-
shell: ${{ env.shell }}
39+
shell: bash
4240
run: |
4341
gh api "/repos/hazelcast/private-test-artifacts/contents/certs.jar?ref=data" -H "Accept: application/vnd.github.raw" > hazelcast-enterprise-${{ env.HZ_VERSION }}-tests.jar
4442
env:
4543
GH_TOKEN: ${{ inputs.GH_TOKEN }}
4644

4745
- name: Install Boost
48-
shell: ${{ env.shell }}
46+
shell: bash
4947
run: |
5048
sudo ./scripts/install-boost.sh ${{ inputs.BOOST_VERSION }}
5149
5250
- name: Install Thrift
53-
shell: ${{ env.shell }}
51+
shell: bash
5452
run: |
5553
sudo ./scripts/install-thrift.sh ${{ inputs.THRIFT_VERSION }}
5654
@@ -65,7 +63,7 @@ runs:
6563
BUILD_DIR: build
6664
COVERAGE: ON
6765
BUILD_TYPE: ${{ env.BUILD_TYPE }}
68-
shell: ${{ env.shell }}
66+
shell: bash
6967
run: |
7068
./scripts/build-unix.sh \
7169
-DBUILD_SHARED_LIBS=ON \
@@ -82,15 +80,15 @@ runs:
8280
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
8381
HZ_TEST_AWS_INSTANCE_PRIVATE_IP: ${{ inputs.HZ_TEST_AWS_INSTANCE_PRIVATE_IP }}
8482
BUILD_TYPE: ${{ env.BUILD_TYPE }}
85-
shell: ${{ env.shell }}
83+
shell: bash
8684
run: |
8785
ulimit -c unlimited
8886
sudo sh -c "echo 'core' > /proc/sys/kernel/core_pattern"
8987
sudo sh -c "echo '1' > /proc/sys/kernel/core_uses_pid"
9088
./scripts/test-unix.sh
9189
9290
- name: Collect coverage info
93-
shell: ${{ env.shell }}
91+
shell: bash
9492
run: |
9593
# collect and list coverage info
9694
lcov --capture --directory . --no-external -o coverage.info \

0 commit comments

Comments
 (0)