Skip to content

Commit 0a40b91

Browse files
committed
CI attempt
1 parent 8078aba commit 0a40b91

5 files changed

Lines changed: 33 additions & 40 deletions

File tree

.github/workflows/python-apollo.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,22 @@ jobs:
2424
- name: Setup Gradle
2525
uses: gradle/actions/setup-gradle@v4
2626

27-
- name: Setup Node.js
28-
uses: actions/setup-node@v4
29-
with:
30-
node-version: 18
31-
32-
- name: Install yarn
33-
run: npm install -g yarn
27+
- name: Build Apollo
28+
run: ./gradlew classes
3429

3530
- name: Start Apollo
3631
run: |
37-
./gradlew installJBrowseWebOnly compileGwt bootRun > apollo.log 2>&1 &
32+
./gradlew bootRun > apollo.log 2>&1 &
3833
3934
# Wait for health endpoint
40-
for i in $(seq 1 180); do
41-
response=$(curl -s 'http://localhost:8080/apollo/health/index' 2>/dev/null)
35+
for i in $(seq 1 300); do
36+
response=$(curl -s 'http://localhost:8080/apollo/health/index' 2>/dev/null || true)
4237
if echo "$response" | grep -q '"status":"ready"'; then
4338
echo "Apollo is ready (${i}s)"
4439
break
4540
fi
46-
if [ $i -eq 180 ]; then
47-
echo "FAIL: Apollo not ready after 180 seconds"
41+
if [ $i -eq 300 ]; then
42+
echo "FAIL: Apollo not ready after 300 seconds"
4843
cat apollo.log
4944
exit 1
5045
fi
@@ -66,17 +61,16 @@ jobs:
6661
- name: Install python-apollo
6762
run: |
6863
cd python-apollo
69-
pip install apollo
64+
pip install apollo pytest
7065
7166
- name: Bootstrap test data
7267
run: |
7368
cd python-apollo
7469
export ARROW_GLOBAL_CONFIG_PATH=$(pwd)/test-data/local-apollo2-arrow.yml
75-
arrow users get_users
7670
./bootstrap_apollo.sh --nodocker
7771
7872
- name: Run tests
7973
run: |
8074
cd python-apollo
8175
export ARROW_GLOBAL_CONFIG_PATH=$(pwd)/test-data/local-apollo2-arrow.yml
82-
python -m pytest || python setup.py nosetests
76+
python -m pytest

grails-app/controllers/org/bbop/apollo/InlineAuthInterceptor.groovy

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,19 @@ class InlineAuthInterceptor {
1717
return true
1818
}
1919

20+
String username = null
21+
String password = null
22+
2023
if (request.JSON?.username && request.JSON?.password) {
21-
permissionService.authenticateWithToken(
22-
request.JSON.username as String,
23-
request.JSON.password as String,
24-
request
25-
)
24+
username = request.JSON.username as String
25+
password = request.JSON.password as String
26+
} else if (params.username && params.password) {
27+
username = params.username as String
28+
password = params.password as String
29+
}
30+
31+
if (username && password) {
32+
permissionService.authenticateWithToken(username, password, request)
2633
}
2734

2835
return true

grails-app/services/org/bbop/apollo/PreferenceService.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class PreferenceService {
138138

139139
Organism getOrganismForTokenInDB(String token) {
140140
log.debug "token for org ${token}"
141+
if (!token) {
142+
return null
143+
}
141144
if (token.isLong()) {
142145
log.debug "is long "
143146
return Organism.findById(token as Long)

grails-app/services/org/bbop/apollo/SequenceService.groovy

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class SequenceService {
4444
*/
4545
String getResiduesFromFeature(Feature feature) {
4646
String returnResidues = ""
47-
def orderedFeatureLocations = feature.featureLocations.sort { it.fmin }
47+
List<FeatureLocation> orderedFeatureLocations = new ArrayList<>(feature.featureLocations)
48+
orderedFeatureLocations.sort(Comparator.comparingInt { FeatureLocation fl -> fl.fmin })
4849
for (FeatureLocation featureLocation in orderedFeatureLocations) {
4950
String residues = getResidueFromFeatureLocation(featureLocation)
5051
if (featureLocation.strand == Strand.NEGATIVE.value) {
@@ -325,7 +326,7 @@ class SequenceService {
325326

326327
def sequences = Sequence.findAllByOrganism(organism)
327328
def seqsMap = [:]
328-
sequences.each { sequence ->
329+
for (Sequence sequence in sequences) {
329330
seqsMap[sequence.name] = sequence.length
330331
}
331332

@@ -339,7 +340,7 @@ class SequenceService {
339340
// otherwise if we remove all of the sequences annotations will need to be removed as well
340341
// Sequence.deleteAll(Sequence.findAllByOrganism(organism))
341342

342-
refSeqs.each { refSeq ->
343+
for (def refSeq in refSeqs) {
343344
int length;
344345
if (refSeq.length) {
345346
length = refSeq.length
@@ -362,25 +363,13 @@ class SequenceService {
362363
Sequence sequence = Sequence.findByNameAndOrganism(refSeq.name,organism)
363364
if (!sequence) {
364365
log.error "Sequence not found for name '${refSeq.name}' and organism '${organism.commonName}'"
365-
return
366+
continue
366367
}
367368
sequence.length = length
368369
sequence.seqChunkSize = refSeq.seqChunkSize
369370
sequence.start = refSeq.start
370371
sequence.end = refSeq.end
371-
// sequence.name = refSeq.name
372372
sequence.save(failOnError: true,insert:false)
373-
// def preferences = Preference.executeQuery("select p from UserOrganismPreference p join p.sequence s where s = :sequence",[sequence:seqsMap[refSeq.name]])
374-
// Preference.deleteAll(preferences)
375-
// Sequence.delete(seqsMap[refSeq.name])
376-
// Sequence sequence = new Sequence(
377-
// organism: organism
378-
// , length: length
379-
// , seqChunkSize: refSeq.seqChunkSize
380-
// , start: refSeq.start
381-
// , end: refSeq.end
382-
// , name: refSeq.name
383-
// ).save(failOnError: true)
384373
log.debug "uddated sequence ${sequence}"
385374
}
386375
else {
@@ -411,7 +400,7 @@ class SequenceService {
411400
log.info "an indexed fasta size ${index.size()}"
412401
def knownSequences = Sequence.findAllByOrganism(organism)
413402
def seqsMap = [:]
414-
knownSequences.each { sequence ->
403+
for (Sequence sequence in knownSequences) {
415404
seqsMap[sequence.name] = sequence.length
416405
}
417406
// reading the index

src/test/groovy/org/bbop/apollo/ProxyControllerSpec.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class ProxyControllerSpec extends Specification implements ControllerUnitTest<Pr
1212
}
1313

1414
def setup() {
15-
controller.permissionService = [
16-
checkPermissions: { PermissionEnum perm -> true }
17-
]
15+
controller.permissionService = Stub(PermissionService) {
16+
checkPermissions(_) >> true
17+
}
1818
}
1919

2020
void "Test the index action returns the correct model"() {

0 commit comments

Comments
 (0)