Skip to content

Commit 37030fb

Browse files
lukasz-antoniakjoao-r-reis
authored andcommitted
Update CCM installation after Python and Java upgrades on GitHub Actions
Patch by Lukasz Antoniak; reviewed by Joao Reis, Jackson Fleming for CASSGO-20
1 parent 48bb2bc commit 37030fb

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Setup environment
2+
description: Setup environment for integration tests execution
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set up cache for SDKMAN
7+
uses: actions/cache@v3
8+
with:
9+
path: ~/.sdkman
10+
key: ${{ runner.os }}-sdkman
11+
12+
- name: Set up cache for PIP
13+
uses: actions/cache@v3
14+
with:
15+
path: ~/.cache/pip
16+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
17+
restore-keys: |
18+
${{ runner.os }}-pip-
19+
20+
- name: Install Java
21+
shell: bash
22+
run: |
23+
echo "Installing SDKMAN..."
24+
curl -s "https://get.sdkman.io" | bash
25+
source "$HOME/.sdkman/bin/sdkman-init.sh"
26+
echo "sdkman_auto_answer=true" >> ~/.sdkman/etc/config
27+
28+
echo "Installing Java versions..."
29+
sdk install java 11.0.24-zulu
30+
sdk install java 17.0.12-zulu
31+
32+
sdk default java 11.0.24-zulu
33+
sdk use java 11.0.24-zulu
34+
35+
echo "JAVA11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
36+
echo "JAVA17_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
37+
echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
38+
echo "PATH=$PATH" >> $GITHUB_ENV
39+
40+
- name: Install CCM
41+
shell: bash
42+
run: |
43+
echo "Creating Python virtual environment..."
44+
VENV_DIR="$HOME/venv"
45+
python3 -m venv $VENV_DIR
46+
source $VENV_DIR/bin/activate
47+
pip install --upgrade pip setuptools
48+
49+
echo "Installing CCM..."
50+
pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"

.github/workflows/main.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ jobs:
5151
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
5252
restore-keys: |
5353
${{ runner.os }}-go-
54-
- name: Install CCM
55-
run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
54+
- name: Setup environment
55+
uses: ./.github/actions/setup-environment
5656
- name: Start cassandra nodes
5757
run: |
58+
source ~/venv/bin/activate
5859
VERSION=${{ matrix.cassandra_version }}
5960
keypath="$(pwd)/testdata/pki"
6061
conf=(
@@ -107,6 +108,7 @@ jobs:
107108
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
108109
- name: Integration tests
109110
run: |
111+
source ~/venv/bin/activate
110112
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
111113
go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
112114
- name: 'Save ccm logs'
@@ -135,10 +137,11 @@ jobs:
135137
- uses: actions/setup-go@v4
136138
with:
137139
go-version: ${{ matrix.go }}
138-
- name: Install CCM
139-
run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
140+
- name: Setup environment
141+
uses: ./.github/actions/setup-environment
140142
- name: Start cassandra nodes
141143
run: |
144+
source ~/venv/bin/activate
142145
VERSION=${{ matrix.cassandra_version }}
143146
keypath="$(pwd)/testdata/pki"
144147
conf=(
@@ -197,5 +200,6 @@ jobs:
197200
sleep 30s
198201
- name: Integration tests
199202
run: |
203+
source ~/venv/bin/activate
200204
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
201205
go test -v -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}

0 commit comments

Comments
 (0)