Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #5
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
name: ODBC Driver for Mac (Debug) | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
env: | |
CI_OUTPUT_PATH: "ci-output" | |
ODBC_LIB_PATH: "${{github.workspace}}/build/odbc/lib" | |
ODBC_BIN_PATH: "${{github.workspace}}/build/odbc/bin" | |
ODBC_BUILD_PATH: "${{github.workspace}}/build/odbc/build" | |
DOCUMENTDB_HOME: "${{github.workspace}}/build/odbc/bin" | |
DOC_DB_KEYPAIR: ${{secrets.DOC_DB_KEYPAIR}} | |
DOC_DB_USER_NAME: ${{secrets.DOC_DB_USER_NAME}} | |
DOC_DB_PASSWORD: ${{secrets.DOC_DB_PASSWORD}} | |
DOC_DB_USER: ${{secrets.DOC_DB_USER}} | |
DOC_DB_HOST: ${{secrets.DOC_DB_HOST}} | |
DOC_DB_LOCAL_PORT: 27019 | |
DOC_DB_REMOTE_PORT: 27017 | |
DOC_DB_PRIV_KEY_FILE: ~/certs/docdb-sshtunnel.pem | |
DOC_DB_ODBC_INTEGRATION_TEST: 1 | |
DOC_DB_LOG_PATH: "${{github.workspace}}/build/odbc/logs" | |
DOC_DB_LOG_LEVEL: "debug" | |
ODBCINSTINI: "${{github.workspace}}/build/odbc/lib/documentdb-odbc-install.ini" | |
ODBCINI: "${{github.workspace}}/odbc.ini" | |
jobs: | |
build-mac-debug: | |
runs-on: macos-11 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Java distribution | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
architecture: x64 | |
- name: run-cppcheck | |
run: | | |
brew install cppcheck | |
sh run_cppcheck.sh | |
- name: upload-cppcheck-results | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cppcheck-results | |
path: cppcheck-results.log | |
- name: Extract key-pair into file | |
run: | | |
mkdir ~/certs | |
echo "${{env.DOC_DB_KEYPAIR}}" > ${{env.DOC_DB_PRIV_KEY_FILE}} | |
chmod 400 ${{env.DOC_DB_PRIV_KEY_FILE}} | |
- name: get-dependencies | |
run: | | |
chmod +x scripts/install_dependencies_mac.sh | |
./scripts/install_dependencies_mac.sh | |
pip3 install gcovr | |
# if action `EnricoMi/publish-unit-test-result-action/[email protected]` | |
# recognizes Python in Library/Developer/CommandLineTools instead of in /usr/local/bin/, then errors would occur | |
- name: set-PATH | |
run: | | |
echo "/Library/Developer/CommandLineTools/usr/bin" >> $GITHUB_PATH | |
echo "/usr/local/bin/" >> $GITHUB_PATH | |
- name: Update environment with JDBC_DRIVER_VERSION | |
run: | | |
read -r JDBC_DRIVER_VERSION < ./src/JDBC_DRIVER_VERSION.txt | |
echo "JDBC_DRIVER_VERSION=$JDBC_DRIVER_VERSION" >> $GITHUB_ENV | |
- name: Cache DocumentDB JDBC JAR | |
id: cache-documentdb-jdbc-jar | |
uses: actions/cache@v3 | |
with: | |
path: | | |
cache/jar | |
key: cache-documentdb-jdbc-jar-${{env.JDBC_DRIVER_VERSION}} | |
- name: Download DocumentDB JDBC JAR | |
if: steps.cache-documentdb-jdbc-jar.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p cache/jar | |
cd cache/jar | |
wget https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v${{env.JDBC_DRIVER_VERSION}}/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar | |
- name: Install DocumentDB JDBC JAR | |
run: | | |
mkdir -p ${{env.ODBC_BIN_PATH}}/libs | |
cp cache/jar/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar ${{env.ODBC_BIN_PATH}}/libs | |
- name: configure-and-build-driver | |
run: | | |
chmod +x build_mac_debug64.sh | |
./build_mac_debug64.sh | |
env: | |
OPENSSL_ROOT_DIR: /usr/local/opt/openssl | |
# - name: prepare-dsn | |
# run: | | |
# sudo mkdir /Library/ODBC | |
# sudo cp ./src/Tests/Tests/odbc-mac.ini /Library/ODBC/odbc.ini | |
# sudo cp ./src/Tests/Tests/odbcinst-mac.ini /Library/ODBC/odbcinst.ini | |
# mkdir ${{ github.workspace }}/odbc-logs | |
- name: register-odbc-driver | |
run: | | |
chmod +x scripts/register_driver_unix.sh | |
./scripts/register_driver_unix.sh | |
- name: Import test data | |
run: | | |
chmod +x ./src/odbc-test/scripts/import_test_data.sh | |
./src/odbc-test/scripts/import_test_data.sh | |
env: | |
RUN_CODE_COVERAGE: ${{ true }} | |
BOOST_TEST_CATCH_SYSTEM_ERRORS: no | |
- name: run-tests | |
id: runtests | |
run: | | |
mkdir -p "${{env.DOC_DB_LOG_PATH}}" | |
ssh -f -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}} | |
./build/odbc/bin/documentdb-odbc-tests --catch_system_errors=false | |
python3 -m gcovr --exclude-directories cmake-build64/odbc-test/CMakeFiles/documentdb-odbc-tests.dir$ --cobertura --output coverage.cobertura.xml | |
- name: upload-coverage | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage | |
path: coverage.cobertura.xml | |
- name: upload-test-report | |
if: always() | |
uses: EnricoMi/publish-unit-test-result-action/[email protected] | |
with: | |
check_name: "MacOS Big Sur 11 Debug Build Unit Test Results Check" | |
comment_title: "MacOS Big Sur 11 Debug Build Unit Test Results" | |
files: ./odbc_test_result.xml | |
- name: upload-test-file | |
if: always() && (steps.runtests.outcome == 'failure') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: odbc-test-results-mac-debug | |
path: | | |
./odbc_test_result.xml | |
./build/odbc/logs/docdb_odbc_*.log | |
comment_PR_mac_coverage: | |
runs-on: ubuntu-latest | |
needs: build-mac-debug | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: '' | |
- name: Retrieve coverage | |
uses: actions/[email protected] | |
with: | |
name: code-coverage | |
- name: Code Coverage Badge | |
uses: irongut/[email protected] | |
with: | |
filename: coverage.cobertura.xml | |
badge: true | |
format: text | |
indicators: true | |
output: both | |
- name: Extract Code Coverage Badge | |
run: | | |
COVERAGE_BADGE=$(head -1 code-coverage-results.txt ) | |
COVERAGE_BADGE="${COVERAGE_BADGE/'Code%20Coverage'/'macOS%20Code%20Coverage'}" | |
curl $COVERAGE_BADGE > .github/badges/coverage_badge_macOS.svg | |
- name: Commit Coverage Badge | |
if: github.event_name == 'pull_request' | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_options: '--allow-empty --no-verify' | |
commit_message: Commit Code Coverage Badge | |
file_pattern: '*.svg' | |
skip_fetch: false | |
skip_checkout: false | |
skip_dirty_check: false | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
with: | |
filename: coverage.cobertura.xml | |
badge: true | |
format: markdown | |
indicators: true | |
output: both | |
- name: Add Header for Code Coverage Summary Report | |
run: | | |
echo "## MacOS Big Sur 11 Debug Build Code Coverage Result" > coverage-cobertura.md | |
cat code-coverage-results.md >> coverage-cobertura.md | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
header: macOS | |
recreate: true | |
path: coverage-cobertura.md | |
- name: upload-test-file | |
if: always() && (steps.runtests.outcome == 'failure') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: odbc-test-results | |
path: | | |
./odbc_test_result.xml | |
./build/odbc/logs/docdb_odbc_*.log | |