Bump docker/login-action from 2 to 3 #143
Workflow file for this run
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
# Copyright (C) 2022 Roberto Rossini (roberros@uio.no) | |
# SPDX-License-Identifier: MIT | |
name: CI | |
on: | |
push: | |
branches: [ main, devel ] | |
paths: | |
- ".github/workflows/ci.yml" | |
- ".dockerignore" | |
- "Dockerfile" | |
- "env.yml" | |
- "main.nf" | |
- "nextflow.config" | |
- "bin/*.py" | |
pull_request: | |
paths: | |
- ".github/workflows/ci.yml" | |
- ".dockerignore" | |
- "Dockerfile" | |
- "env.yml" | |
- "main.nf" | |
- "nextflow.config" | |
- "bin/*.py" | |
release: | |
types: [ published ] | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
TEST_DATASET_URL: 'https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/8b9d6836-0d6b-4c2f-9eaa-323f4fd7b6e4/4DNFI74YHN5W.mcool' | |
TEST_DATASET_SHA256: 'a5e3dc9e9e6b68b577c086dcbf34e8a21094bf34fa27461440642e9273ee228b' | |
NXF_ANSI_LOG: false | |
jobs: | |
build-image: | |
name: Build Dockerfile | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
flavor: | | |
latest=true | |
tags: | | |
type=semver,priority=1000,pattern={{version}} | |
type=sha,priority=900 | |
type=ref,priority=800,event=branch | |
type=ref,priority=700,event=pr | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image and push to registries | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ github.workspace }} | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=min | |
tags: ${{ steps.meta.outputs.tags }} | |
preproc-test-dataset: | |
name: Preprocess test dataset | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key: ${{ steps.generate-cache-key.outputs.key }} | |
steps: | |
- name: Generate cache key | |
id: generate-cache-key | |
run: | | |
key="test-dataset-$TEST_DATASET_SHA256" | |
echo "key=$key" >> $GITHUB_OUTPUT | |
- name: Cache test datasets | |
id: cache-dataset | |
uses: actions/cache@v3 | |
with: | |
key: ${{ steps.generate-cache-key.outputs.key }} | |
path: data/ | |
- name: Download test dataset | |
if: steps.cache-dataset.outputs.cache-hit != 'true' | |
run: | | |
mkdir data | |
cd data | |
curl -LO "$TEST_DATASET_URL" | |
- name: Checksum test dataset | |
if: steps.cache-dataset.outputs.cache-hit != 'true' | |
run: | | |
echo "$TEST_DATASET_SHA256 data/$(basename "$TEST_DATASET_URL")" > checksum.sha256 | |
shasum -c checksum.sha256 | |
- name: Generate requirements.txt | |
if: steps.cache-dataset.outputs.cache-hit != 'true' | |
run: | | |
echo 'cooler==0.9.1' > requirements.txt | |
- name: Setup Python | |
if: steps.cache-dataset.outputs.cache-hit != 'true' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
cache: pip | |
- name: Remove unused resolutions | |
if: steps.cache-dataset.outputs.cache-hit != 'true' | |
run: | | |
src="data/$(basename "$TEST_DATASET_URL")" | |
dest="$src.new" | |
pip3 install -r requirements.txt | |
for res in 100000 1000000; do | |
cooler cp "$src::/resolutions/$res" "$dest::/resolutions/$res" | |
done | |
mv "$dest" "$src" | |
test-workflow: | |
name: Test workflow | |
runs-on: ubuntu-latest | |
needs: [ build-image, preproc-test-dataset ] | |
strategy: | |
matrix: | |
NXF_VER: [ "20.07", "latest-stable" ] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Cache test datasets | |
uses: actions/cache@v3 | |
with: | |
key: ${{ needs.preproc-test-dataset.outputs.cache-key }} | |
path: data/ | |
- name: Install Nextflow | |
uses: nf-core/setup-nextflow@v1 | |
with: | |
version: ${{ matrix.NXF_VER }} | |
- name: Test workflow | |
run: | | |
nextflow run -c config/test.config \ | |
--sample="test" \ | |
--cooler_cis="data/$(basename "$TEST_DATASET_URL")::/resolutions/100000" \ | |
--cooler_trans="data/$(basename "$TEST_DATASET_URL")::/resolutions/1000000" \ | |
--outdir=data/out \ | |
--max_cpus=2 \ | |
--max_memory=6.GB \ | |
--max_time=2.h \ | |
. | |
ls -lah data/out/test_{all,cis,trans}_{cliques,domains}*.gz |