Use PAT to clone private test-datasets submodule in CI. #872
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: Tests | |
| on: [push] | |
| jobs: | |
| run-unit-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| # chem-spectra-test-files is private; use a PAT with repo read access, | |
| # or enable org-wide GITHUB_TOKEN access, or make the dataset repo public. | |
| token: ${{ secrets.CHEMSPECTRA_TEST_FILES_PAT != '' && secrets.CHEMSPECTRA_TEST_FILES_PAT || github.token }} | |
| - name: Verify test-datasets submodule | |
| run: | | |
| if [ ! -f test-datasets/catalog/datasets.json ]; then | |
| echo "::error::Submodule test-datasets is missing." | |
| echo "chem-spectra-test-files is a private repository." | |
| echo "Fix options:" | |
| echo " 1. Add repo secret CHEMSPECTRA_TEST_FILES_PAT (read access to ComPlat/chem-spectra-test-files)" | |
| echo " 2. Enable org setting: Actions may access other repositories in ComPlat" | |
| echo " 3. Make ComPlat/chem-spectra-test-files public" | |
| exit 1 | |
| fi | |
| - uses: actions/setup-python@v6 | |
| with: | |
| check-latest: true | |
| cache: "pip" | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install .[dev] | |
| - name: Create tmp directory with permissions | |
| run: | | |
| mkdir -p chem_spectra/tmp | |
| chmod -R 777 chem_spectra/tmp | |
| - name: Start msconvert Docker container | |
| run: | | |
| docker run --detach --name msconvert_docker \ | |
| --rm -it \ | |
| -e WINEDEBUG=-all \ | |
| -v ${{ github.workspace }}/chem_spectra/tmp:/data \ | |
| proteowizard/pwiz-skyline-i-agree-to-the-vendor-licenses bash | |
| - name: Test with pytest | |
| shell: bash -el {0} | |
| run: | | |
| python -m pytest |