-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add GHA to test all components #4885
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,260 @@ | ||
name: Run all tests | ||
on: | ||
workflow_dispatch: | ||
|
||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
# Cancel if a newer run is started | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity | ||
NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
nf-core-lint: | ||
runs-on: ubuntu-latest | ||
name: nf-core-lint-all | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
|
||
- name: Install pip | ||
run: python -m pip install --upgrade pip | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
- name: Setup Nextflow | ||
uses: nf-core/setup-nextflow@v1 | ||
|
||
- name: Install nf-core tools development version | ||
run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev | ||
|
||
- name: Lint all modules | ||
run: nf-core modules lint --all | ||
|
||
- name: Lint all subworkflows | ||
run: nf-core subworkflows lint --all | ||
|
||
pytest: | ||
runs-on: ubuntu-latest | ||
name: pytest-all | ||
strategy: | ||
fail-fast: false | ||
env: | ||
NXF_ANSI_LOG: false | ||
SENTIEON_LICENSE_BASE64: ${{ secrets.SENTIEON_LICENSE_BASE64 }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Python dependencies | ||
run: python -m pip install --upgrade pip pytest-workflow cryptography | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
- name: Setup Nextflow ${{ matrix.NXF_VER }} | ||
uses: nf-core/setup-nextflow@v1 | ||
with: | ||
version: "${{ matrix.NXF_VER }}" | ||
|
||
- name: Setup apptainer | ||
if: matrix.profile == 'singularity' | ||
uses: eWaterCycle/setup-apptainer@main | ||
|
||
- name: Set up Singularity | ||
if: matrix.profile == 'singularity' | ||
run: | | ||
mkdir -p $NXF_SINGULARITY_CACHEDIR | ||
mkdir -p $NXF_SINGULARITY_LIBRARYDIR | ||
|
||
- name: Set up miniconda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniconda-version: "latest" | ||
channels: conda-forge,bioconda,defaults | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Conda setup | ||
run: | | ||
conda clean -a | ||
conda install -n base conda-libmamba-solver | ||
conda config --set solver libmamba | ||
echo $(realpath $CONDA)/condabin >> $GITHUB_PATH | ||
echo $(realpath python) >> $GITHUB_PATH | ||
|
||
# Set up secrets | ||
- name: Set up nextflow secrets | ||
if: env.SENTIEON_LICENSE_BASE64 != null | ||
run: | | ||
nextflow secrets set SENTIEON_LICENSE_BASE64 ${{ secrets.SENTIEON_LICENSE_BASE64 }} | ||
nextflow secrets set SENTIEON_AUTH_MECH_BASE64 ${{ secrets.SENTIEON_AUTH_MECH_BASE64 }} | ||
SENTIEON_ENCRYPTION_KEY=$(echo -n "${{ secrets.ENCRYPTION_KEY_BASE64 }}" | base64 -d) | ||
SENTIEON_LICENSE_MESSAGE=$(echo -n "${{ secrets.LICENSE_MESSAGE_BASE64 }}" | base64 -d) | ||
SENTIEON_AUTH_DATA=$(python3 tests/modules/nf-core/sentieon/license_message.py encrypt --key "$SENTIEON_ENCRYPTION_KEY" --message "$SENTIEON_LICENSE_MESSAGE") | ||
SENTIEON_AUTH_DATA_BASE64=$(echo -n "$SENTIEON_AUTH_DATA" | base64 -w 0) | ||
nextflow secrets set SENTIEON_AUTH_DATA_BASE64 $SENTIEON_AUTH_DATA_BASE64 | ||
|
||
# Test the module | ||
- name: Run pytest-workflow | ||
# only use one thread for pytest-workflow to avoid race condition on conda cache. | ||
run: TMPDIR=~ PROFILE=${{ matrix.profile }} pytest tests/ --symlink --kwdof --git-aware --color=yes | ||
|
||
- name: Output log on failure | ||
if: failure() | ||
run: | | ||
sudo apt-get update > /dev/null | ||
sudo apt-get install bat > /dev/null | ||
batcat --decorations=always --color=always /home/runner/pytest_workflow_*/*/log.{out,err} | ||
|
||
- name: Upload logs on failure | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: logs-${{ matrix.profile }} | ||
path: | | ||
/home/runner/pytest_workflow_*/*/.nextflow.log | ||
/home/runner/pytest_workflow_*/*/log.out | ||
/home/runner/pytest_workflow_*/*/log.err | ||
/home/runner/pytest_workflow_*/*/work | ||
!/home/runner/pytest_workflow_*/*/work/conda | ||
!/home/runner/pytest_workflow_*/*/work/singularity | ||
!${{ github.workspace }}/.singularity | ||
|
||
nf-test: | ||
runs-on: ubuntu-latest | ||
name: nf-test-all | ||
strategy: | ||
fail-fast: false | ||
env: | ||
NXF_ANSI_LOG: false | ||
SENTIEON_LICENSE_BASE64: ${{ secrets.SENTIEON_LICENSE_BASE64 }} | ||
NFTEST_VER: "0.8.4" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
- name: Setup Nextflow | ||
uses: nf-core/setup-nextflow@v1 | ||
|
||
- name: Cache nf-test installation | ||
id: cache-software | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
/usr/local/bin/nf-test | ||
/home/runner/.nf-test/nf-test.jar | ||
key: ${{ runner.os }}-${{ env.NFTEST_VER }}-nftest | ||
|
||
- name: Install nf-test | ||
if: steps.cache-software.outputs.cache-hit != 'true' | ||
run: | | ||
wget -qO- https://code.askimed.com/install/nf-test | bash | ||
sudo mv nf-test /usr/local/bin/ | ||
|
||
- name: Setup apptainer | ||
if: matrix.profile == 'singularity' | ||
uses: eWaterCycle/setup-apptainer@main | ||
|
||
- name: Set up Singularity | ||
if: matrix.profile == 'singularity' | ||
run: | | ||
mkdir -p $NXF_SINGULARITY_CACHEDIR | ||
mkdir -p $NXF_SINGULARITY_LIBRARYDIR | ||
|
||
- name: Set up miniconda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniconda-version: "latest" | ||
auto-update-conda: true | ||
channels: conda-forge,bioconda,defaults | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Conda setup | ||
run: | | ||
conda clean -a | ||
conda install -n base conda-libmamba-solver | ||
conda config --set solver libmamba | ||
pip install pdiff | ||
echo $(realpath $CONDA)/condabin >> $GITHUB_PATH | ||
echo $(realpath python) >> $GITHUB_PATH | ||
|
||
# Set up secrets | ||
- name: Set up nextflow secrets | ||
if: env.SENTIEON_LICENSE_BASE64 != null | ||
run: | | ||
nextflow secrets set SENTIEON_LICENSE_BASE64 ${{ secrets.SENTIEON_LICENSE_BASE64 }} | ||
nextflow secrets set SENTIEON_AUTH_MECH_BASE64 ${{ secrets.SENTIEON_AUTH_MECH_BASE64 }} | ||
SENTIEON_ENCRYPTION_KEY=$(echo -n "${{ secrets.ENCRYPTION_KEY_BASE64 }}" | base64 -d) | ||
SENTIEON_LICENSE_MESSAGE=$(echo -n "${{ secrets.LICENSE_MESSAGE_BASE64 }}" | base64 -d) | ||
SENTIEON_AUTH_DATA=$(python3 tests/modules/nf-core/sentieon/license_message.py encrypt --key "$SENTIEON_ENCRYPTION_KEY" --message "$SENTIEON_LICENSE_MESSAGE") | ||
SENTIEON_AUTH_DATA_BASE64=$(echo -n "$SENTIEON_AUTH_DATA" | base64 -w 0) | ||
nextflow secrets set SENTIEON_AUTH_DATA_BASE64 $SENTIEON_AUTH_DATA_BASE64 | ||
|
||
# Test the module | ||
- name: Run nf-test | ||
env: | ||
NFT_DIFF: "pdiff" | ||
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2" | ||
run: | | ||
NFT_WORKDIR=~ \ | ||
nf-test test \ | ||
--profile=${{ matrix.profile }} \ | ||
--tap=test.tap \ | ||
--verbose | ||
|
||
- uses: pcolby/tap-summary@v1 | ||
with: | ||
path: >- | ||
test.tap | ||
|
||
confirm-pass: | ||
runs-on: ubuntu-latest | ||
needs: [nf-core-lint, pytest, nf-test] | ||
name: confirm-pass-all-tests | ||
if: always() | ||
steps: | ||
- name: All tests ok | ||
if: ${{ success() || !contains(needs.*.result, 'failure') }} | ||
run: exit 0 | ||
- name: One or more tests failed | ||
if: ${{ contains(needs.*.result, 'failure') }} | ||
run: exit 1 | ||
|
||
- name: debug-print | ||
if: always() | ||
run: | | ||
echo "toJSON(needs) = ${{ toJSON(needs) }}" | ||
echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.