Skip to content

Commit dca8111

Browse files
committed
re-enable github tests
1 parent 696de4b commit dca8111

1 file changed

Lines changed: 131 additions & 131 deletions

File tree

.github/workflows/build.yml

Lines changed: 131 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -61,137 +61,137 @@ jobs:
6161
steps:
6262
- uses: actions/checkout@v4
6363

64-
# - uses: actions/setup-python@v5
65-
# with:
66-
# python-version: ${{ matrix.python }}
67-
68-
# - name: get-dependencies-location
69-
# shell: bash
70-
# run: |
71-
# SITE_PACKAGES_LOCATION=$(python -c "from sysconfig import get_path; print(get_path('purelib'))")
72-
# SITE_BIN_DIR=$(python3 -c "import os; import platform; import sysconfig; pre = sysconfig.get_config_var('prefix'); bindir = os.path.join(pre, 'Scripts' if platform.system() == 'Windows' else 'bin'); print(bindir)")
73-
# echo "site_packages_loc=$SITE_PACKAGES_LOCATION" >> $GITHUB_OUTPUT
74-
# echo "site_bin_dir=$SITE_BIN_DIR" >> $GITHUB_OUTPUT
75-
# id: get-dependencies
76-
77-
# - name: Cache py-dependencies
78-
# id: cache-dependencies
79-
# uses: actions/cache@v4
80-
# env:
81-
# cache-name: cache-py-dependencies
82-
# with:
83-
# path: |
84-
# ${{ steps.get-dependencies.outputs.site_packages_loc }}
85-
# ${{ steps.get-dependencies.outputs.site_bin_dir }}
86-
# key: ${{ runner.os }}-${{ matrix.python }}-build-${{ env.cache-name }}-${{ hashFiles('setup.py') }}-v24
87-
88-
# - name: Install py-dependencies
89-
# if: steps.cache-dependencies.outputs.cache-hit != 'true'
90-
# shell: bash
91-
# run: |
92-
# python -m pip install --upgrade pip
93-
94-
# pip install -e ".[boto3,pandas,pysftp,tests]"
95-
96-
# # ensure that numpy c extensions are installed on windows
97-
# # https://stackoverflow.com/a/59346525
98-
# if [ "${{startsWith(runner.os, 'Windows')}}" == "true" ]; then
99-
# pip uninstall -y numpy
100-
# pip uninstall -y setuptools
101-
# pip install setuptools
102-
# pip install numpy
103-
# fi
104-
105-
# - name: run-unit-tests
106-
# shell: bash
107-
# run: |
108-
# pytest -sv --cov-append --cov=. --cov-report xml tests/unit
109-
# - name: Check for Secret availability
110-
# id: secret-check
111-
# if: ${{ contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.13"]'), matrix.python) }}
112-
# # perform secret check & put boolean result as an output
113-
# shell: bash
114-
# run: |
115-
# if [ -z "${{ secrets.encrypted_d17283647768_key }}" ] || [ -z "${{ secrets.encrypted_d17283647768_iv }}" ]; then
116-
# echo "secrets_available=false" >> $GITHUB_OUTPUT;
117-
# else
118-
# echo "secrets_available=true" >> $GITHUB_OUTPUT;
119-
# fi
120-
121-
# if [ -z "${{ secrets.synapse_personal_access_token }}" ]; then
122-
# echo "synapse_pat_available=false" >> $GITHUB_OUTPUT;
123-
# else
124-
# echo "synapse_pat_available=true" >> $GITHUB_OUTPUT;
125-
# fi
126-
127-
# # run integration tests iff the decryption keys for the test configuration are available.
128-
# # they will not be available in pull requests from forks.
129-
# # run integration tests on the oldest and newest supported versions of python.
130-
# # we don't run on the entire matrix to avoid a 3xN set of concurrent tests against
131-
# # the target server where N is the number of supported python versions.
132-
# - name: run-integration-tests
133-
# shell: bash
134-
135-
# # keep versions consistent with the first and last from the strategy matrix
136-
# if: ${{ (contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.13"]'), matrix.python)) && steps.secret-check.outputs.secrets_available == 'true'}}
137-
# run: |
138-
# # decrypt the encrypted test synapse configuration
139-
# openssl aes-256-cbc -K ${{ secrets.encrypted_d17283647768_key }} -iv ${{ secrets.encrypted_d17283647768_iv }} -in test.synapseConfig.enc -out test.synapseConfig -d
140-
# mv test.synapseConfig ~/.synapseConfig
141-
142-
# if [ "${{ startsWith(matrix.os, 'ubuntu') }}" == "true" ]; then
143-
# # on linux only we can build and run a docker container to serve as an SFTP host for our SFTP tests.
144-
# # Docker is not available on GH Action runners on Mac and Windows.
145-
146-
# docker build -t sftp_tests - < tests/integration/synapseclient/core/upload/Dockerfile_sftp
147-
# docker run -d sftp_tests:latest
148-
149-
# # get the internal IP address of the just launched container
150-
# export SFTP_HOST=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -q))
151-
152-
# printf "[sftp://$SFTP_HOST]\nusername: test\npassword: test\n" >> ~/.synapseConfig
153-
154-
# # add to known_hosts so the ssh connections can be made without any prompting/errors
155-
# mkdir -p ~/.ssh
156-
# ssh-keyscan -H $SFTP_HOST >> ~/.ssh/known_hosts
157-
# fi
158-
159-
# # set env vars used in external bucket tests from secrets
160-
# export EXTERNAL_S3_BUCKET_NAME="${{secrets.EXTERNAL_S3_BUCKET_NAME}}"
161-
# export EXTERNAL_S3_BUCKET_AWS_ACCESS_KEY_ID="${{secrets.EXTERNAL_S3_BUCKET_AWS_ACCESS_KEY_ID}}"
162-
# export EXTERNAL_S3_BUCKET_AWS_SECRET_ACCESS_KEY="${{secrets.EXTERNAL_S3_BUCKET_AWS_SECRET_ACCESS_KEY}}"
163-
164-
# # Set env vars for OTEL
165-
# export OTEL_EXPORTER_OTLP_ENDPOINT="${{ vars.OTEL_EXPORTER_OTLP_ENDPOINT }}"
166-
# export OTEL_SERVICE_INSTANCE_ID="${{ vars.OTEL_SERVICE_INSTANCE_ID }}"
167-
# export SYNAPSE_INTEGRATION_TEST_OTEL_ENABLED="${{ vars.SYNAPSE_INTEGRATION_TEST_OTEL_ENABLED }}"
168-
# export OTEL_EXPORTER_OTLP_HEADERS="${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}"
169-
170-
# # Setup ignore patterns based on Python version
171-
# IGNORE_FLAGS="--ignore=tests/integration/synapseclient/test_command_line_client.py"
172-
173-
# if [ "${{ matrix.python }}" == "3.9" ]; then
174-
# # For min Python version, ignore async tests
175-
# IGNORE_FLAGS="$IGNORE_FLAGS --ignore=tests/integration/synapseclient/models/async/"
176-
# echo "Running integration tests for Min Python version (3.9) - ignoring async tests"
177-
# elif [ "${{ matrix.python }}" == "3.13" ]; then
178-
# # For max Python version, ignore synchronous tests
179-
# IGNORE_FLAGS="$IGNORE_FLAGS --ignore=tests/integration/synapseclient/models/synchronous/"
180-
# echo "Running integration tests for Max Python version (3.13) - ignoring synchronous tests"
181-
# fi
182-
183-
# # use loadscope to avoid issues running tests concurrently that share scoped fixtures
184-
# pytest -sv --reruns 3 --cov-append --cov=. --cov-report xml tests/integration -n 8 $IGNORE_FLAGS --dist loadscope
185-
186-
# # Execute the CLI tests in a non-dist way because they were causing some test instability when being run concurrently
187-
# pytest -sv --reruns 3 --cov-append --cov=. --cov-report xml tests/integration/synapseclient/test_command_line_client.py
188-
# - name: Upload coverage report
189-
# id: upload_coverage_report
190-
# uses: actions/upload-artifact@v4
191-
# if: ${{ contains(fromJSON('["3.13"]'), matrix.python) && contains(fromJSON('["ubuntu-22.04"]'), matrix.os)}}
192-
# with:
193-
# name: coverage-report
194-
# path: coverage.xml
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: ${{ matrix.python }}
67+
68+
- name: get-dependencies-location
69+
shell: bash
70+
run: |
71+
SITE_PACKAGES_LOCATION=$(python -c "from sysconfig import get_path; print(get_path('purelib'))")
72+
SITE_BIN_DIR=$(python3 -c "import os; import platform; import sysconfig; pre = sysconfig.get_config_var('prefix'); bindir = os.path.join(pre, 'Scripts' if platform.system() == 'Windows' else 'bin'); print(bindir)")
73+
echo "site_packages_loc=$SITE_PACKAGES_LOCATION" >> $GITHUB_OUTPUT
74+
echo "site_bin_dir=$SITE_BIN_DIR" >> $GITHUB_OUTPUT
75+
id: get-dependencies
76+
77+
- name: Cache py-dependencies
78+
id: cache-dependencies
79+
uses: actions/cache@v4
80+
env:
81+
cache-name: cache-py-dependencies
82+
with:
83+
path: |
84+
${{ steps.get-dependencies.outputs.site_packages_loc }}
85+
${{ steps.get-dependencies.outputs.site_bin_dir }}
86+
key: ${{ runner.os }}-${{ matrix.python }}-build-${{ env.cache-name }}-${{ hashFiles('setup.py') }}-v24
87+
88+
- name: Install py-dependencies
89+
if: steps.cache-dependencies.outputs.cache-hit != 'true'
90+
shell: bash
91+
run: |
92+
python -m pip install --upgrade pip
93+
94+
pip install -e ".[boto3,pandas,pysftp,tests]"
95+
96+
# ensure that numpy c extensions are installed on windows
97+
# https://stackoverflow.com/a/59346525
98+
if [ "${{startsWith(runner.os, 'Windows')}}" == "true" ]; then
99+
pip uninstall -y numpy
100+
pip uninstall -y setuptools
101+
pip install setuptools
102+
pip install numpy
103+
fi
104+
105+
- name: run-unit-tests
106+
shell: bash
107+
run: |
108+
pytest -sv --cov-append --cov=. --cov-report xml tests/unit
109+
- name: Check for Secret availability
110+
id: secret-check
111+
if: ${{ contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.13"]'), matrix.python) }}
112+
# perform secret check & put boolean result as an output
113+
shell: bash
114+
run: |
115+
if [ -z "${{ secrets.encrypted_d17283647768_key }}" ] || [ -z "${{ secrets.encrypted_d17283647768_iv }}" ]; then
116+
echo "secrets_available=false" >> $GITHUB_OUTPUT;
117+
else
118+
echo "secrets_available=true" >> $GITHUB_OUTPUT;
119+
fi
120+
121+
if [ -z "${{ secrets.synapse_personal_access_token }}" ]; then
122+
echo "synapse_pat_available=false" >> $GITHUB_OUTPUT;
123+
else
124+
echo "synapse_pat_available=true" >> $GITHUB_OUTPUT;
125+
fi
126+
127+
# run integration tests iff the decryption keys for the test configuration are available.
128+
# they will not be available in pull requests from forks.
129+
# run integration tests on the oldest and newest supported versions of python.
130+
# we don't run on the entire matrix to avoid a 3xN set of concurrent tests against
131+
# the target server where N is the number of supported python versions.
132+
- name: run-integration-tests
133+
shell: bash
134+
135+
# keep versions consistent with the first and last from the strategy matrix
136+
if: ${{ (contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.13"]'), matrix.python)) && steps.secret-check.outputs.secrets_available == 'true'}}
137+
run: |
138+
# decrypt the encrypted test synapse configuration
139+
openssl aes-256-cbc -K ${{ secrets.encrypted_d17283647768_key }} -iv ${{ secrets.encrypted_d17283647768_iv }} -in test.synapseConfig.enc -out test.synapseConfig -d
140+
mv test.synapseConfig ~/.synapseConfig
141+
142+
if [ "${{ startsWith(matrix.os, 'ubuntu') }}" == "true" ]; then
143+
# on linux only we can build and run a docker container to serve as an SFTP host for our SFTP tests.
144+
# Docker is not available on GH Action runners on Mac and Windows.
145+
146+
docker build -t sftp_tests - < tests/integration/synapseclient/core/upload/Dockerfile_sftp
147+
docker run -d sftp_tests:latest
148+
149+
# get the internal IP address of the just launched container
150+
export SFTP_HOST=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -q))
151+
152+
printf "[sftp://$SFTP_HOST]\nusername: test\npassword: test\n" >> ~/.synapseConfig
153+
154+
# add to known_hosts so the ssh connections can be made without any prompting/errors
155+
mkdir -p ~/.ssh
156+
ssh-keyscan -H $SFTP_HOST >> ~/.ssh/known_hosts
157+
fi
158+
159+
# set env vars used in external bucket tests from secrets
160+
export EXTERNAL_S3_BUCKET_NAME="${{secrets.EXTERNAL_S3_BUCKET_NAME}}"
161+
export EXTERNAL_S3_BUCKET_AWS_ACCESS_KEY_ID="${{secrets.EXTERNAL_S3_BUCKET_AWS_ACCESS_KEY_ID}}"
162+
export EXTERNAL_S3_BUCKET_AWS_SECRET_ACCESS_KEY="${{secrets.EXTERNAL_S3_BUCKET_AWS_SECRET_ACCESS_KEY}}"
163+
164+
# Set env vars for OTEL
165+
export OTEL_EXPORTER_OTLP_ENDPOINT="${{ vars.OTEL_EXPORTER_OTLP_ENDPOINT }}"
166+
export OTEL_SERVICE_INSTANCE_ID="${{ vars.OTEL_SERVICE_INSTANCE_ID }}"
167+
export SYNAPSE_INTEGRATION_TEST_OTEL_ENABLED="${{ vars.SYNAPSE_INTEGRATION_TEST_OTEL_ENABLED }}"
168+
export OTEL_EXPORTER_OTLP_HEADERS="${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}"
169+
170+
# Setup ignore patterns based on Python version
171+
IGNORE_FLAGS="--ignore=tests/integration/synapseclient/test_command_line_client.py"
172+
173+
if [ "${{ matrix.python }}" == "3.9" ]; then
174+
# For min Python version, ignore async tests
175+
IGNORE_FLAGS="$IGNORE_FLAGS --ignore=tests/integration/synapseclient/models/async/"
176+
echo "Running integration tests for Min Python version (3.9) - ignoring async tests"
177+
elif [ "${{ matrix.python }}" == "3.13" ]; then
178+
# For max Python version, ignore synchronous tests
179+
IGNORE_FLAGS="$IGNORE_FLAGS --ignore=tests/integration/synapseclient/models/synchronous/"
180+
echo "Running integration tests for Max Python version (3.13) - ignoring synchronous tests"
181+
fi
182+
183+
# use loadscope to avoid issues running tests concurrently that share scoped fixtures
184+
pytest -sv --reruns 3 --cov-append --cov=. --cov-report xml tests/integration -n 8 $IGNORE_FLAGS --dist loadscope
185+
186+
# Execute the CLI tests in a non-dist way because they were causing some test instability when being run concurrently
187+
pytest -sv --reruns 3 --cov-append --cov=. --cov-report xml tests/integration/synapseclient/test_command_line_client.py
188+
- name: Upload coverage report
189+
id: upload_coverage_report
190+
uses: actions/upload-artifact@v4
191+
if: ${{ contains(fromJSON('["3.13"]'), matrix.python) && contains(fromJSON('["ubuntu-22.04"]'), matrix.os)}}
192+
with:
193+
name: coverage-report
194+
path: coverage.xml
195195

196196
sonarcloud:
197197
needs: [test]

0 commit comments

Comments
 (0)