Merge pull request #80 from end2endzone/feature-issue77 #140
This file contains hidden or 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: macOS | |
on: [push, pull_request] | |
env: | |
# build Configuration, i.e. Debug, Release, etc. | |
PRODUCT_BUILD_TYPE: Release | |
# Required for Github Action. Unit test TestProcess.testKillAndTerminate fails to start /bin/nano with the following error: "Error opening terminal: unknown." | |
TERM: xterm | |
jobs: | |
build: | |
# For a list of available runner types, refer to | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Configure GIT | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: | | |
git config --local core.autocrlf true | |
git config --local advice.detachedHead false | |
git submodule update --init --recursive | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified | |
- name: Create new environment variables | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: | | |
python -c "import os; print('GIT_REPOSITORY=' + os.path.split(os.getenv('GITHUB_REPOSITORY'))[1]);" >> $GITHUB_ENV | |
python -c "import os; print('GIT_BRANCH=' + os.path.split(os.getenv('GITHUB_REF'))[1]);" >> $GITHUB_ENV | |
echo GITHUB_WORKFLOW=$GITHUB_WORKFLOW>> $GITHUB_ENV | |
- name: List environment variables for debugging | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: | | |
env | |
- name: Deploy 'tests not available' badge before building | |
#uses: exuanbo/actions-deploy-gist@v1 | |
uses: end2endzone/actions-deploy-gist@main | |
if: github.event_name != 'pull_request' | |
with: | |
token: ${{ secrets.BADGES }} | |
gist_id: 58cf6c72c08e706335337d5ef9ca48e8 | |
gist_file_name: ${{env.GIT_REPOSITORY}}.${{env.GIT_BRANCH}}.${{env.GITHUB_WORKFLOW}}.json | |
file_path: ./ci/github/tests_not_available.badge.json | |
- name: Install Google Test | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: ./ci/github/install_googletest.sh | |
- name: Install RapidAssist | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: ./ci/github/install_rapidassist.sh | |
- name: Build bin2cpp | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: ./ci/github/install_bin2cpp.sh | |
- name: Run unit tests | |
id: unit_tests | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: ./ci/github/test_script.sh | |
- name: Search unit test report file | |
if: success() || steps.unit_tests.conclusion == 'failure' | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: | | |
UNITTEST_REPORT_PATH=$(find . -name 'bin2cpp_unittest.*.xml') | |
echo UNITTEST_REPORT_PATH=$UNITTEST_REPORT_PATH | |
echo UNITTEST_REPORT_PATH=$UNITTEST_REPORT_PATH >> $GITHUB_ENV | |
- name: Create test badge | |
if: success() || steps.unit_tests.conclusion == 'failure' | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: python ci/github/maketestbadge.py ${{env.UNITTEST_REPORT_PATH}} | |
- name: Deploy test badge to gist | |
if: success() || steps.unit_tests.conclusion == 'failure' | |
#uses: exuanbo/actions-deploy-gist@v1 | |
uses: end2endzone/actions-deploy-gist@main | |
with: | |
token: ${{ secrets.BADGES }} | |
gist_id: 58cf6c72c08e706335337d5ef9ca48e8 | |
gist_file_name: ${{env.GIT_REPOSITORY}}.${{env.GIT_BRANCH}}.${{env.GITHUB_WORKFLOW}}.json | |
file_path: ./badge.json | |
- name: Archive test results | |
if: success() || steps.unit_tests.conclusion == 'failure' | |
uses: actions/[email protected] | |
with: | |
name: unit-test-results | |
path: build/bin/bin2cpp_unittest.*.xml | |
- name: Get bin2cpp version | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
shell: bash | |
run: | | |
echo BIN2CPP_VERSION=$(cat build/version) | |
echo BIN2CPP_VERSION=$(cat build/version)>> $GITHUB_ENV | |
- name: Archive installation packages | |
if: success() || steps.unit_tests.conclusion == 'failure' | |
uses: actions/[email protected] | |
with: | |
name: Installation packages. | |
path: build/bin2cpp-${{env.BIN2CPP_VERSION}}-*.* |