-
Notifications
You must be signed in to change notification settings - Fork 4
123 lines (119 loc) · 4.68 KB
/
Copy pathcontainer.yml
File metadata and controls
123 lines (119 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Container
on:
workflow_dispatch:
inputs:
publish_version:
description: Existing package version to rebuild, for example 0.2.2
required: false
type: string
push:
tags:
- "v*"
pull_request:
paths:
- Dockerfile
- packaging/container/environment.yml
- pyproject.toml
- setup.py
- src/**
- .github/workflows/container.yml
permissions:
contents: write
jobs:
image:
name: ${{ matrix.label }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
include:
- label: linux-amd64
runner: ubuntu-latest
platform: linux/amd64
arch: amd64
- label: linux-arm64
runner: ubuntu-24.04-arm
platform: linux/arm64
arch: arm64
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- name: Build native smoke image
uses: docker/build-push-action@v7
with:
context: .
platforms: ${{ matrix.platform }}
load: true
tags: fp-tools:smoke
cache-from: type=gha,scope=container-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=container-${{ matrix.arch }}
- name: Test packaged commands, dependencies, regression, and GUI health
shell: bash
run: |
docker run --rm fp-tools:smoke python -c "import fp_tools.utils.sequences, fp_tools.utils.ngs, fp_tools.utils.signals"
docker run --rm fp-tools:smoke atac-correct --help >/dev/null
docker run --rm fp-tools:smoke prepare-atac --doctor --profile modern | tee /tmp/fp-tools-doctor.txt
grep -q $'bedtools\tyes\t' /tmp/fp-tools-doctor.txt
docker run --rm fp-tools:smoke python -c 'from fp_tools.utils.regions import OneRegion, RegionList; x=RegionList([OneRegion(["chr1",0,10,"outer"]),OneRegion(["chr1",2,8,"inner"])]); x.merge(); assert [(r.chrom,r.start,r.end) for r in x] == [("chr1",0,10)]'
docker run --rm -d --name fp-tools-gui-smoke -p 8891:8891 fp-tools:smoke
trap 'docker rm -f fp-tools-gui-smoke >/dev/null 2>&1 || true' EXIT
for attempt in {1..60}; do
if curl --fail --silent http://127.0.0.1:8891/_stcore/health >/dev/null; then
exit 0
fi
sleep 2
done
docker logs fp-tools-gui-smoke
exit 1
- name: Pack architecture image
if: startsWith(github.ref, 'refs/tags/') || inputs.publish_version != ''
shell: bash
env:
ARCH: ${{ matrix.arch }}
PUBLISH_VERSION: ${{ inputs.publish_version }}
run: |
release_tag="${GITHUB_REF_NAME}"
if [[ "${GITHUB_REF}" != refs/tags/* ]]; then release_tag="v${PUBLISH_VERSION#v}"; fi
version="${release_tag#v}"
mkdir -p release
docker tag fp-tools:smoke "fp-tools:${release_tag}"
docker tag fp-tools:smoke fp-tools:latest
docker save "fp-tools:${release_tag}" fp-tools:latest | gzip -1 \
> "release/fp-tools-container-${version}-linux-${ARCH}.tar.gz"
- uses: actions/upload-artifact@v7
if: startsWith(github.ref, 'refs/tags/') || inputs.publish_version != ''
with:
name: fp-tools-container-${{ matrix.arch }}
path: release/fp-tools-container-*.tar.gz
if-no-files-found: error
release:
name: container release archives
if: startsWith(github.ref, 'refs/tags/') || inputs.publish_version != ''
needs: image
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
pattern: fp-tools-container-*
merge-multiple: true
path: release
- name: Upload container archives to the GitHub release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
PUBLISH_VERSION: ${{ inputs.publish_version }}
run: |
release_tag="${GITHUB_REF_NAME}"
if [[ "${GITHUB_REF}" != refs/tags/* ]]; then release_tag="v${PUBLISH_VERSION#v}"; fi
(cd release && sha256sum fp-tools-container-*.tar.gz > CONTAINER_SHA256SUMS.txt)
if ! gh release view "${release_tag}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
release_flags=()
if [[ "${release_tag}" == *rc* ]]; then release_flags+=(--prerelease); fi
gh release create "${release_tag}" \
--repo "${GITHUB_REPOSITORY}" \
--title "fp-tools ${release_tag}" \
--generate-notes \
"${release_flags[@]}"
fi
gh release upload "${release_tag}" release/* --repo "${GITHUB_REPOSITORY}" --clobber