File tree Expand file tree Collapse file tree 6 files changed +50
-54
lines changed Expand file tree Collapse file tree 6 files changed +50
-54
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ name: Test
2
2
on :
3
3
push :
4
4
branches :
5
- - master
5
+ - main
6
6
pull_request :
7
7
branches :
8
- - master
8
+ - main
9
9
jobs :
10
10
tests :
11
11
runs-on : ubuntu-latest
@@ -15,11 +15,11 @@ jobs:
15
15
- name : Set up CouchDB
16
16
uses : ./
17
17
with :
18
- couchdb version : " 2.3.1 "
18
+ couchdb- version : " 3.5.0 "
19
19
- name : Test that CouchDB can be accessed
20
20
run : curl -sS -f http://127.0.0.1:5984/
21
21
- name : Test that system databases are there
22
- run : curl -sS -f http://127.0.0.1:5984/_users
22
+ run : curl -sS -f http://admin:admin@ 127.0.0.1:5984/_users
23
23
- name : Test that the Erlang query server is enabled
24
24
run : |
25
25
curl -sS -f 'http://admin:[email protected] :5984/_users/_design/test' -X PUT -H 'Content-Type: application/json' --data '{"views":{"test":{"map":"fun({Doc}) -> Emit(proplists:get_value(<<\"name\">>, Doc, null), 1) end."}},"language":"erlang"}'
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 14
14
``` yaml
15
15
steps :
16
16
- name : Set up CouchDB
17
- uses : " cobot/couchdb-action@master "
17
+ uses : " cobot/couchdb-action@main "
18
18
with :
19
19
couchdb version : " 2.3.1"
20
20
- name : Do something
Original file line number Diff line number Diff line change 1
- name : ' Setup CouchDB'
2
- description : ' Set up a CouchDB database as a single node.'
3
- author : ' Alexander Lang'
1
+ name : " Setup CouchDB"
2
+ description : " Set up a CouchDB database as a single node."
3
+ author : " Alexander Lang"
4
4
branding :
5
- icon : ' database'
6
- color : ' red'
5
+ icon : " database"
6
+ color : " red"
7
7
inputs :
8
8
# See https://hub.docker.com/_/couchdb for supported versions
9
9
# and further details on input environment variables
10
- couchdb version :
11
- description : ' Version of CouchDB to use.'
10
+ couchdb- version :
11
+ description : " Version of CouchDB to use."
12
12
required : false
13
- default : ' latest'
13
+ default : " latest"
14
14
runs :
15
- using : ' docker'
16
- image : ' Dockerfile'
15
+ using : " composite"
16
+ steps :
17
+ - name : Set up CouchDB
18
+ env :
19
+ INPUT_COUCHDB_VERSION : ${{ inputs.couchdb-version }}
20
+ GITHUB_ACTION_PATH : ${{ github.action_path }}
21
+ run : |
22
+ sed -i "s/COUCHDB_VERSION/$INPUT_COUCHDB_VERSION/" $GITHUB_ACTION_PATH/Dockerfile.couchdb
23
+ docker build --tag custom-couchdb -f $GITHUB_ACTION_PATH/Dockerfile.couchdb $GITHUB_ACTION_PATH
24
+ docker run -d -p 5984:5984 -p 5986:5986 --tmpfs /ram_disk custom-couchdb
25
+ shell : bash
26
+ - name : Wait for CouchDB to be ready
27
+ run : $GITHUB_ACTION_PATH/wait-for-couchdb.sh
28
+ shell : bash
29
+ - name : Set up CouchDB system databases
30
+ run : |
31
+ curl -sS 'http://admin:[email protected] :5984/_users' -X PUT -H 'Content-Type: application/json' --data '{"id":"_users","name":"_users"}' > /dev/null
32
+ curl -sS 'http://admin:[email protected] :5984/_global_changes' -X PUT -H 'Content-Type: application/json' --data '{"id":"_global_changes","name":"_global_changes"}' > /dev/null
33
+ curl -sS 'http://admin:[email protected] :5984/_replicator' -X PUT -H 'Content-Type: application/json' --data '{"id":"_replicator","name":"_replicator"}' > /dev/null
34
+ shell : bash
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ echo " Waiting for CouchDB..."
4
+ retries=0
5
+ max_retries=20
6
+
7
+ until curl --output /dev/null --silent --head --fail http://127.0.0.1:5984/; do
8
+ retries=$(( retries+ 1 ))
9
+ if [ $retries -ge $max_retries ]; then
10
+ echo " CouchDB did not become available after $max_retries attempts. Exiting."
11
+ exit 1
12
+ fi
13
+ echo " ."
14
+ sleep 1
15
+ done
16
+
17
+ echo " CouchDB is up and running."
You can’t perform that action at this time.
0 commit comments