-
Notifications
You must be signed in to change notification settings - Fork 2
144 lines (144 loc) · 5.64 KB
/
build.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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Tests
on: [push, pull_request]
jobs:
db:
name: Database tests [${{ matrix.db_image.name }} DB]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
db_image:
- {name: 'Legacy', image: 'ghcr.io/linz/nz-buildings-db-legacy:v1'}
- {name: 'Modern', image: 'ghcr.io/linz/nz-buildings-db-modern:v1'}
env:
PGHOST: localhost
PGPORT: 54320
PGUSER: buildings
PGPASSWORD: buildings
BASE_DIR: ${{ github.workspace }}
DB_DOCKER_IMAGE: ${{ matrix.db_image.image }}
DOCKER_NETWORK: buildings
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Create docker network
run: bash $BASE_DIR/scripts/steps/create_docker_network.sh
- name: Launch database container
run: bash $BASE_DIR/scripts/steps/launch_database_container.sh
- name: Print docker logs
uses: jwalton/gh-docker-logs@v1
- name: Load additional schemas
run: bash $BASE_DIR/scripts/steps/load_additional_schemas.sh
- name: Sqitch deploy and verify
run: bash $BASE_DIR/scripts/steps/sqitch_deploy_verify.sh
- name: Sqitch revert
run: bash $BASE_DIR/scripts/steps/sqitch_revert.sh
- name: Sqitch deploy
run: bash $BASE_DIR/scripts/steps/sqitch_deploy.sh
- name: Load test data
run: bash $BASE_DIR/scripts/steps/load_db_test_data.sh
- name: Run pgTAP tests
run: bash $BASE_DIR/scripts/steps/run_pgtap_tests.sh
qgis:
name: QGIS tests [QGIS ${{ matrix.qgis_image.name }}, ${{ matrix.db_image.name }} DB]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
db_image:
- {name: 'Legacy', image: 'ghcr.io/linz/nz-buildings-db-legacy:v1'}
- {name: 'Modern', image: 'ghcr.io/linz/nz-buildings-db-modern:v1'}
qgis_image:
- {name: '3.10', image: 'qgis/qgis:release-3_10'}
- {name: '3.16', image: 'qgis/qgis:release-3_16'}
- {name: '3.24', image: 'qgis/qgis:release-3_24'}
env:
PGHOST: localhost
PGPORT: 54320
PGUSER: buildings
PGPASSWORD: buildings
BASE_DIR: ${{ github.workspace }}
DB_DOCKER_IMAGE: ${{ matrix.db_image.image }}
QGIS_DOCKER_IMAGE: ${{ matrix.qgis_image.image }}
QGIS_DISPLAY: ":99"
DOCKER_NETWORK: buildings
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Create docker network
run: bash $BASE_DIR/scripts/steps/create_docker_network.sh
- name: Launch database container
run: bash $BASE_DIR/scripts/steps/launch_database_container.sh
- name: Print docker logs
uses: jwalton/gh-docker-logs@v1
- name: Load additional schemas
run: bash $BASE_DIR/scripts/steps/load_additional_schemas.sh
- name: Sqitch deploy
run: bash $BASE_DIR/scripts/steps/sqitch_deploy.sh
- name: Load test data
run: bash $BASE_DIR/scripts/steps/load_qgis_test_data.sh
- name: Launch QGIS container
run: bash $BASE_DIR/scripts/steps/launch_qgis_container.sh
- name: Setup QGIS plugin
run: bash $BASE_DIR/scripts/steps/setup_qgis_plugin.sh
- name: Run QGIS tests
run: bash $BASE_DIR/scripts/steps/run_qgis_tests.sh
docs:
name: Documentation
runs-on: ubuntu-latest
env:
BUILD: docs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Install required Python modules
run: |
grep sphinx requirements-dev.txt | xargs pip3 install
pip3 install -r requirements-docs.txt
- name: Run Sphinx build
run: |
sphinx-build -b html db/docs/source db/docs
deploy:
name: Deploy
if: contains(github.ref, 'refs/tags/')
needs: [db, qgis, docs]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2-beta
with:
ref: ${{ github.ref }}
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
echo ${{ github.ref }}
echo ${{ github.repository }}
zip -r buildings.zip buildings
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
See [${CHANGELOG} ${{ github.ref }}](https://github.com/linz/nz-buildings/blob/master/${CHANGELOG}#$(echo ${{ github.ref }} | sed -e 's/[a-zA-Z\.]//g')) for detailed release information.
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./buildings.zip
asset_name: buildings.zip
asset_content_type: application/zip
- name: Upload To LINZ QGIS Plugin Repository in AWS
run: |
curl -X POST -H 'Content-Type: application/octet-stream' -H "authorization: bearer ${{ secrets.PLUGIN_REPO_AUTH }}" --data-binary @buildings.zip https://plugins.qgis.linz.govt.nz/v1/plugin/buildings