-
Notifications
You must be signed in to change notification settings - Fork 13
93 lines (80 loc) · 2.93 KB
/
tests.yml
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
name: Tests
on:
push:
branches:
- master
pull_request:
# Allow running this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tests:
name: App Tests
runs-on: ubuntu-latest
steps:
# Setup OSM website
# Some app tests rely on this test server
# derived from https://github.com/openstreetmap/openstreetmap-website/blob/master/.github/workflows/docker.yml
- name: Checkout OSM website source
uses: actions/checkout@v4
with:
repository: openstreetmap/openstreetmap-website
path: osm-website
- name: Poke OSM website config
run: |
cp config/example.storage.yml config/storage.yml
cp config/docker.database.yml config/database.yml
touch config/settings.local.yml
working-directory: ./osm-website
- name: Build and start OSM website docker
run: |
docker compose up -d --build
sleep 15 # let the DB warm up a little
working-directory: ./osm-website
- name: Prepare OSM website Database
run: |
docker compose run --rm web bundle exec rails db:migrate
docker compose run --rm web bundle exec rails i18n:js:export
# The command below populates the db with some test data
# However this somehow doesn't update the unique key counter, wherefore the creation of new elements will fail due to a duplicate key value violation
# docker compose run --rm web osmosis --rx docker/null-island.osm.xml --wd host=db database=openstreetmap user=openstreetmap password=openstreetmap validateSchemaVersion=no
working-directory: ./osm-website
- name: Test basic OSM website
run: |
curl -siL http://127.0.0.1:3000 | egrep '^HTTP/1.1 200 OK'
working-directory: ./osm-website
# Create user account
# derived from https://github.com/openstreetmap/openstreetmap-website/issues/3136
- name: Create test OSM user account
run: |
docker compose run --rm web bundle exec rails runner '
pass_crypt, pass_salt = PasswordHash.create("testpass");
user = User.find_or_create_by(
:email => "[email protected]",
:email_valid => true,
:display_name => "testuser",
:terms_seen => true,
:terms_agreed => Time.now.getutc,
:data_public => true,
:languages => ["en-US"],
:pass_crypt => pass_crypt,
:pass_salt => pass_salt
);
user.save
user.activate!'
working-directory: ./osm-website
# App checkout, setup and final tests
- name: Checkout App source
uses: actions/checkout@v4
with:
path: app
- name: Run shared environment setup steps
uses: ./app/.github/actions/environment_setup
with:
path: app
- name: Run tests
run: flutter test
working-directory: ./app
- name: Check OSM website logs
if: failure()
run: docker compose logs web
working-directory: ./osm-website