Skip to content

Commit 02a0aec

Browse files
Merge pull request #7 from archivesspace/github-workflow-with-docker
Github workflow with docker
2 parents 8e8effb + 73bc1f3 commit 02a0aec

File tree

4 files changed

+117
-8
lines changed

4 files changed

+117
-8
lines changed

.github/workflows/cucumber-tests.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
name: Cucumber Tests
1+
name: Cucumber
22
on: push
3-
43
jobs:
54
cucumber:
6-
name: Run Cucmber Tests
5+
name: Run Tests
76
runs-on: ubuntu-latest
8-
7+
concurrency:
8+
group: ci-${{ github.ref }}
9+
cancel-in-progress: true
910
steps:
1011
- name: Checkout repository
1112
uses: actions/checkout@v2
13+
- name: Set up Docker
14+
run: |
15+
docker compose -f docker-compose.yml up --quiet-pull --detach
16+
- name: Wait until the web server is ready
17+
run: until curl -s -f -o /dev/null "http://localhost:8080"; do sleep 5; done
1218
- name: Set up Ruby
1319
uses: ruby/setup-ruby@v1
1420
with:
1521
ruby-version: '3.2.0'
16-
- name: Cache gems # You can cache your gems to make the workflow run faster
22+
- name: Cache gems
1723
uses: actions/cache@v2
1824
with:
1925
path: vendor/bundle
@@ -23,6 +29,7 @@ jobs:
2329
- name: Install gems
2430
run: |
2531
bundle config path vendor/bundle
26-
bundle install --jobs 4 --retry 3
32+
bundle install --quiet --jobs 4 --retry 3
2733
- name: Run tests
28-
run: bundle exec cucumber HEADLESS=true
34+
run: |
35+
bundle exec cucumber HEADLESS=true HOST=localhost staff-features/

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
### Archives Space End-to-end testing with Cucumber
1+
## Archives Space End-to-End Tests
2+
3+
#### How to install
4+
5+
Clone this repository on your machine, navigate to the root application folder, and run:
6+
7+
```
8+
bundle install
9+
```
10+
11+
### How to run the tests
12+
13+
#### Run on remote host
14+
To run the tests on the `https://e2e.archivesspace.org`, run:
15+
```
16+
bundle exec cucumber
17+
```
18+
19+
#### Run on localhost
20+
To run the tests on localhost, you have to setup the application with:
21+
22+
```
23+
docker compose -f docker-compose.yml up
24+
```
25+
26+
Wait until everything is up and running.
27+
You can check if the staff interface is running on `http://localhost:8080`.
28+
29+
Then, to run the tests, open another terminal, and run:
30+
```
31+
bundle exec cucumber HOST=localhost staff-features/
32+
```

docker-compose.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: "3"
2+
services:
3+
app:
4+
image: archivesspace/archivesspace:latest
5+
container_name: archivesspace
6+
restart: on-failure
7+
ports:
8+
- "8080:8080"
9+
- "8081:8081"
10+
- "8082:8082"
11+
- "8089:8089"
12+
- "8090:8090"
13+
depends_on:
14+
- db
15+
- solr
16+
environment:
17+
APPCONFIG_DB_URL: "jdbc:mysql://db:3306/archivesspace?useUnicode=true&characterEncoding=UTF-8&user=as&password=as123&useSSL=false&allowPublicKeyRetrieval=true"
18+
APPCONFIG_FRONTEND_PROXY_URL: "http://localhost:8080"
19+
APPCONFIG_PUBLIC_PROXY_URL: "http://localhost:8081"
20+
APPCONFIG_SOLR_URL: "http://solr:8983/solr/archivesspace"
21+
ASPACE_DB_MIGRATE: true
22+
ASPACE_JAVA_XMX: "-Xmx2048m"
23+
JAVA_OPTS: "-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xss1024k -Djavax.accessibility.assistive_technologies=''"
24+
DB_ADDR: db
25+
DB_NAME: archivesspace
26+
DB_USER: as
27+
DB_PASS: as123
28+
SOLR_URL: http://solr:8983/solr/archivesspace
29+
db:
30+
image: mysql:8
31+
cap_add:
32+
- SYS_NICE
33+
container_name: mysql
34+
command: --character-set-server=utf8 --collation-server=utf8_unicode_ci --innodb_buffer_pool_size=1G --innodb_buffer_pool_instances=2 --log_bin_trust_function_creators=1
35+
ports:
36+
- "3306:3306"
37+
environment:
38+
MYSQL_ROOT_PASSWORD: "123456"
39+
MYSQL_DATABASE: archivesspace
40+
MYSQL_USER: as
41+
MYSQL_PASSWORD: as123
42+
solr:
43+
image: archivesspace/solr:latest
44+
command: solr-create -p 8983 -c archivesspace -d archivesspace
45+
environment:
46+
SOLR_JAVA_MEM: "-Xms2g -Xmx2g"
47+
ports:
48+
- "8983:8983"

helpers/helpers.rb

+23
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,29 @@ def login_admin
1919
expect(page).to have_content 'Your friendly archives management tool.'
2020
element = find('.global-header .user-container')
2121
expect(element.text.strip).to eq 'admin'
22+
23+
# Ensure the system has at least one repository
24+
begin
25+
element = find('.alert.alert-info.with-hide-alert')
26+
27+
if element.text == 'To create your first Repository, click the System menu above and then Manage Repositories.'
28+
click_on 'System'
29+
click_on 'Manage Repositories'
30+
click_on 'Create Repository'
31+
32+
fill_in 'repository_repository__repo_code_', with: 'repository_test'
33+
fill_in 'repository_repository__name_', with: 'Repository Test'
34+
find('#repository_repository__publish_').check
35+
click_on 'Save'
36+
37+
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Repository Created'
38+
expect(find('.alert.alert-info.with-hide-alert').text).to eq 'Repository is Currently Selected'
39+
40+
visit STAFF_URL
41+
end
42+
rescue Capybara::ElementNotFound
43+
# Continue
44+
end
2245
end
2346

2447
def create_resource(uuid)

0 commit comments

Comments
 (0)