|
1 | 1 | name: nf-core CI |
2 | | -# This workflow is triggered on pushes and PRs to the repository. |
| 2 | +# This workflow is triggered on releases and pull-requests. |
3 | 3 | # It runs the pipeline with the minimal test dataset to check that it completes without any syntax errors |
4 | | -on: [push, pull_request] |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - dev |
| 8 | + pull_request: |
| 9 | + release: |
| 10 | + types: [published] |
5 | 11 |
|
6 | 12 | jobs: |
7 | 13 | test: |
| 14 | + name: Run workflow tests |
| 15 | + # Only run on push if this is the nf-core dev branch (merged PRs) |
| 16 | + if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/chipseq') }} |
| 17 | + runs-on: ubuntu-latest |
8 | 18 | env: |
9 | 19 | NXF_VER: ${{ matrix.nxf_ver }} |
10 | 20 | NXF_ANSI_LOG: false |
11 | | - runs-on: ubuntu-latest |
12 | 21 | strategy: |
13 | 22 | matrix: |
14 | 23 | # Nextflow versions: check pipeline minimum and current latest |
15 | 24 | nxf_ver: ['19.10.0', ''] |
16 | 25 | steps: |
17 | | - - uses: actions/checkout@v2 |
18 | | - - name: Install Nextflow |
19 | | - run: | |
20 | | - wget -qO- get.nextflow.io | bash |
21 | | - sudo mv nextflow /usr/local/bin/ |
| 26 | + - name: Check out pipeline code |
| 27 | + uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Check if Dockerfile or Conda environment changed |
| 30 | + uses: technote-space/get-diff-action@v1 |
| 31 | + with: |
| 32 | + PREFIX_FILTER: | |
| 33 | + Dockerfile |
| 34 | + environment.yml |
| 35 | +
|
| 36 | + - name: Build new docker image |
| 37 | + if: env.GIT_DIFF |
| 38 | + run: docker build --no-cache . -t nfcore/chipseq:dev |
| 39 | + |
22 | 40 | - name: Pull docker image |
| 41 | + if: ${{ !env.GIT_DIFF }} |
23 | 42 | run: | |
24 | 43 | docker pull nfcore/chipseq:dev |
25 | 44 | docker tag nfcore/chipseq:dev nfcore/chipseq:dev |
| 45 | +
|
| 46 | + - name: Install Nextflow |
| 47 | + run: | |
| 48 | + wget -qO- get.nextflow.io | bash |
| 49 | + sudo mv nextflow /usr/local/bin/ |
| 50 | +
|
26 | 51 | - name: Run pipeline with test data |
27 | 52 | run: | |
28 | 53 | nextflow run ${GITHUB_WORKSPACE} -profile test,docker |
29 | 54 |
|
30 | 55 | parameters: |
| 56 | + name: Test workflow parameters |
| 57 | + if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/chipseq') }} |
| 58 | + runs-on: ubuntu-latest |
31 | 59 | env: |
32 | 60 | NXF_VER: '19.10.0' |
33 | 61 | NXF_ANSI_LOG: false |
34 | | - runs-on: ubuntu-latest |
35 | 62 | strategy: |
36 | 63 | matrix: |
37 | 64 | parameters: [--single_end, --skip_trimming, --skip_consensus_peaks] |
38 | 65 | steps: |
39 | | - - uses: actions/checkout@v2 |
40 | | - - name: Install Nextflow |
41 | | - run: | |
42 | | - wget -qO- get.nextflow.io | bash |
43 | | - sudo mv nextflow /usr/local/bin/ |
| 66 | + - name: Check out pipeline code |
| 67 | + uses: actions/checkout@v2 |
| 68 | + |
| 69 | + - name: Check if Dockerfile or Conda environment changed |
| 70 | + uses: technote-space/get-diff-action@v1 |
| 71 | + with: |
| 72 | + PREFIX_FILTER: | |
| 73 | + Dockerfile |
| 74 | + environment.yml |
| 75 | +
|
| 76 | + - name: Build new docker image |
| 77 | + if: env.GIT_DIFF |
| 78 | + run: docker build --no-cache . -t nfcore/chipseq:dev |
| 79 | + |
44 | 80 | - name: Pull docker image |
| 81 | + if: ${{ !env.GIT_DIFF }} |
45 | 82 | run: | |
46 | 83 | docker pull nfcore/chipseq:dev |
47 | 84 | docker tag nfcore/chipseq:dev nfcore/chipseq:dev |
48 | | - - name: Run pipeline with various options |
| 85 | +
|
| 86 | + - name: Install Nextflow |
| 87 | + run: | |
| 88 | + wget -qO- get.nextflow.io | bash |
| 89 | + sudo mv nextflow /usr/local/bin/ |
| 90 | +
|
| 91 | + - name: Run pipeline with various parameters |
49 | 92 | run: | |
50 | 93 | nextflow run ${GITHUB_WORKSPACE} -profile test,docker ${{ matrix.parameters }} |
| 94 | +
|
| 95 | + push_dockerhub: |
| 96 | + name: Push new Docker image to Docker Hub |
| 97 | + runs-on: ubuntu-latest |
| 98 | + # Only run if the tests passed |
| 99 | + needs: test |
| 100 | + # Only run for the nf-core repo, for releases and merged PRs |
| 101 | + if: ${{ github.repository == 'nf-core/chipseq' && (github.event_name == 'release' || github.event_name == 'push') }} |
| 102 | + env: |
| 103 | + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} |
| 104 | + DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }} |
| 105 | + steps: |
| 106 | + - name: Check out pipeline code |
| 107 | + uses: actions/checkout@v2 |
| 108 | + |
| 109 | + - name: Build new docker image |
| 110 | + run: docker build --no-cache . -t nfcore/chipseq:latest |
| 111 | + |
| 112 | + - name: Push Docker image to DockerHub (dev) |
| 113 | + if: ${{ github.event_name == 'push' }} |
| 114 | + run: | |
| 115 | + echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin |
| 116 | + docker tag nfcore/chipseq:latest nfcore/chipseq:dev |
| 117 | + docker push nfcore/chipseq:dev |
| 118 | +
|
| 119 | + - name: Push Docker image to DockerHub (release) |
| 120 | + if: ${{ github.event_name == 'release' }} |
| 121 | + run: | |
| 122 | + echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin |
| 123 | + docker push nfcore/chipseq:latest |
| 124 | + docker tag nfcore/chipseq:latest nfcore/chipseq:${{ github.event.release.tag_name }} |
| 125 | + docker push nfcore/chipseq:${{ github.event.release.tag_name }} |
0 commit comments