Build and test #1831
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: Build and test | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: '40 6,15 * * *' | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Building the RJM python package | |
| - name: Build the package | |
| run: python -m pip install .[dev] | |
| - name: Check rjm_batch_submit command installed | |
| run: rjm_batch_submit --help | |
| - name: Check rjm_batch_wait command installed | |
| run: rjm_batch_wait --help | |
| - name: Display rjm version | |
| run: rjm_batch_submit --version | |
| # Run unit tests | |
| - name: Run tests | |
| run: pytest | |
| pyinstaller: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| # Building the RJM python package | |
| - name: Build the package | |
| run: python -m pip install .[dev] | |
| # Build executables using PyInstaller | |
| - name: Build rjm_batch_submit | |
| run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_submit.py | |
| working-directory: ./extra/pyinstaller | |
| - name: Build rjm_batch_wait | |
| run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_wait.py | |
| working-directory: ./extra/pyinstaller | |
| - name: Build rjm_authenticate | |
| run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_authenticate.py | |
| working-directory: ./extra/pyinstaller | |
| - name: Build rjm_config | |
| run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_config.py | |
| working-directory: ./extra/pyinstaller | |
| - name: Build rjm_health_check | |
| run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_health_check.py | |
| working-directory: ./extra/pyinstaller | |
| - name: Build rjm_batch_cancel | |
| run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_cancel.py | |
| working-directory: ./extra/pyinstaller | |
| - name: Build rjm_batch_run | |
| run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_run.py | |
| working-directory: ./extra/pyinstaller | |
| - name: Dump license files | |
| run: | | |
| pip-licenses -f plain-vertical -l --output-file dist/bundled_licenses.txt | |
| echo "Python license: https://docs.python.org/3/license.html" >> dist/bundled_licenses.txt | |
| working-directory: ./extra/pyinstaller | |
| # test the pyinstaller built health check runs | |
| - name: Display pyinstaller built health check help | |
| run: dist/rjm_health_check.exe --help | |
| working-directory: ./extra/pyinstaller | |
| - name: Display RJM version | |
| run: dist/rjm_batch_submit.exe --version | |
| working-directory: ./extra/pyinstaller | |
| - name: Check pyinstaller build rjm_config help | |
| run: dist/rjm_config.exe --help | |
| working-directory: ./extra/pyinstaller | |
| # archive the binaries | |
| - name: Archive binaries | |
| uses: thedoctor0/zip-release@master | |
| with: | |
| type: zip | |
| directory: extra/pyinstaller/dist | |
| filename: RemoteJobManager-${{ runner.os }}.zip | |
| # upload archive as an artifact of the build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: RemoteJobManager-${{ runner.os }} | |
| path: extra/pyinstaller/dist/RemoteJobManager-*.zip | |
| realtestpyinstaller: | |
| needs: pyinstaller | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| name: Download artifact archive | |
| with: | |
| name: RemoteJobManager-${{ runner.os }} | |
| - run: ls | |
| - name: Extract artifact archive | |
| run: 7z x RemoteJobManager-*.zip | |
| - run: ls | |
| # display version | |
| - name: Display RJM version | |
| run: ./rjm_batch_wait --version | |
| # Secrets required for running real tests | |
| - run: mkdir -p ~/.rjm | |
| - run: printf "${RJM_CONFIG}" > ${RJM_CONFIG_FILE_TEMP} | |
| shell: bash | |
| env: | |
| RJM_CONFIG: ${{ secrets.RJM_CONFIG }} | |
| RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini | |
| if: env.RJM_CONFIG != null | |
| - run: ln -sf ${RJM_CONFIG_FILE_TEMP} ~/.rjm/rjm_config.ini | |
| shell: bash | |
| env: | |
| RJM_CONFIG: ${{ secrets.RJM_CONFIG }} | |
| RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini | |
| if: env.RJM_CONFIG != null | |
| - run: printf "${RJM_TOKENS}" > ${RJM_TOKENS_FILE_TEMP} | |
| shell: bash | |
| env: | |
| RJM_TOKENS: ${{ secrets.RJM_TOKENS }} | |
| RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json | |
| if: env.RJM_TOKENS != null | |
| - run: ln -sf ${RJM_TOKENS_FILE_TEMP} ~/.rjm/rjm_tokens.json | |
| shell: bash | |
| env: | |
| RJM_TOKENS: ${{ secrets.RJM_TOKENS }} | |
| RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json | |
| if: env.RJM_TOKENS != null | |
| - name: "Check if RJM secrets are set" | |
| id: rjm_config_files | |
| shell: bash | |
| run: | | |
| if [[ -r ~/.rjm/rjm_tokens.json ]] && [[ -r ~/.rjm/rjm_config.ini ]]; then | |
| echo 'files_exist=true' >> $GITHUB_OUTPUT | |
| else | |
| echo 'files_exist=false' >> $GITHUB_OUTPUT | |
| fi | |
| # If the secrets were set, run some real tests | |
| - name: Run the health check script | |
| run: ./rjm_health_check -ll debug --retries --logextra | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' | |
| timeout-minutes: 10 | |
| - name: Run batch_submit for nonmem example | |
| run: ../../rjm_batch_submit -f localdirs.txt -ll debug -n --logextra | |
| working-directory: ./examples/nonmem | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' | |
| timeout-minutes: 10 | |
| - name: Run batch_wait for nonmem example | |
| run: ../../rjm_batch_wait -f localdirs.txt -ll debug -n --logextra | |
| working-directory: ./examples/nonmem | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' | |
| timeout-minutes: 10 | |
| # Cleanup rjm config directory | |
| - run: rm ~/.rjm/* | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' | |
| releasepyinstaller: | |
| runs-on: windows-latest | |
| needs: | |
| - realtestpyinstaller | |
| - realtest | |
| - test | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| name: Download artifact archive | |
| with: | |
| name: RemoteJobManager-${{ runner.os }} | |
| # only if it's a tag, add the archive to the release | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: RemoteJobManager-*.zip | |
| realtest: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.11'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Building the RJM python package | |
| - name: Build the package | |
| run: python -m pip install .[dev] | |
| # display version | |
| - name: Display RJM version | |
| run: rjm_batch_wait --version | |
| # Secrets required for running real tests | |
| - run: mkdir -p ~/.rjm | |
| - run: printf "${RJM_CONFIG}" > ${RJM_CONFIG_FILE_TEMP} | |
| shell: bash | |
| env: | |
| RJM_CONFIG: ${{ secrets.RJM_CONFIG }} | |
| RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini | |
| if: env.RJM_CONFIG != null | |
| - run: ln -sf ${RJM_CONFIG_FILE_TEMP} ~/.rjm/rjm_config.ini | |
| shell: bash | |
| env: | |
| RJM_CONFIG: ${{ secrets.RJM_CONFIG }} | |
| RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini | |
| if: env.RJM_CONFIG != null | |
| - run: printf "${RJM_TOKENS}" > ${RJM_TOKENS_FILE_TEMP} | |
| shell: bash | |
| env: | |
| RJM_TOKENS: ${{ secrets.RJM_TOKENS }} | |
| RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json | |
| if: env.RJM_TOKENS != null | |
| - run: ln -sf ${RJM_TOKENS_FILE_TEMP} ~/.rjm/rjm_tokens.json | |
| shell: bash | |
| env: | |
| RJM_TOKENS: ${{ secrets.RJM_TOKENS }} | |
| RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json | |
| if: env.RJM_TOKENS != null | |
| - name: "Check if RJM secrets are set" | |
| id: rjm_config_files | |
| shell: bash | |
| run: | | |
| if [[ -r ~/.rjm/rjm_tokens.json ]] && [[ -r ~/.rjm/rjm_config.ini ]]; then | |
| echo 'files_exist=true' >> $GITHUB_OUTPUT | |
| else | |
| echo 'files_exist=false' >> $GITHUB_OUTPUT | |
| fi | |
| # If the secrets were set, run some real tests | |
| - name: Run the health check script | |
| run: rjm_health_check -ll debug --retries --logextra | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' | |
| timeout-minutes: 10 | |
| - name: Run batch_submit for nonmem example | |
| run: rjm_batch_submit -f localdirs.txt -ll debug -n --logextra | |
| working-directory: ./examples/nonmem | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' | |
| timeout-minutes: 10 | |
| - name: Run batch_wait for nonmem example | |
| run: rjm_batch_wait -f localdirs.txt -ll debug -n --logextra | |
| working-directory: ./examples/nonmem | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' | |
| timeout-minutes: 10 | |
| # Cleanup rjm config directory | |
| - run: rm ~/.rjm/* | |
| if: steps.rjm_config_files.outputs.files_exist == 'true' |