-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (116 loc) · 3.92 KB
/
ci.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
name: Continuous integration
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
jobs:
actionlint:
name: Lint GitHub Actions workflows
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check workflow files
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
shell: bash
maplibre-style-validate:
name: Validate MapLibre style specifications
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install maplibre-gl-style-spec
run: npm install @maplibre/maplibre-gl-style-spec --global
- name: Validate MapLibre GL styles
run: |
find vector/styles -name "style.json" -type f -exec bash -c 'echo "Validating file: $1" && gl-style-validate "$1"' - {} \;
caddyfile-validate:
name: Validate Caddy file syntax
runs-on: ubuntu-latest
timeout-minutes: 5
container: caddy:2.8
steps:
- uses: actions/checkout@v4
- name: Validate Caddyfile
run: caddy validate --config vector/docker/static/caddy/Caddyfile --adapter caddyfile
test-vector-basemap:
name: Run vector basemap tests
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Prepare Java environment
uses: ./.github/actions/prepare-java-environment
- name: Run tests
run: ./gradlew test -i
publish-preivew-page:
name: Generate preview page
permissions:
contents: read
deployments: write
uses: ./.github/workflows/reusable-workflow-publish-page.yml
with:
style-source-url: https://dev-vector.startupgov.lt/tile.json
style-base-url: https://${{ github.head_ref || github.ref_name }}.national-basemap.pages.dev
pmtiles-url: https://dev-cdn.startupgov.lt/tiles/vector/pmtiles/lithuania.pmtiles
secrets:
cloudflare-api-token: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
cloudflare-account-id: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT_ID }}
generate-vector-basemap-pmtiles:
name: Generate vector basemap PMTiles
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event_name != 'push'
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate vector basemap PMTiles
uses: ./.github/actions/basemap-vector-generate-pmtiles
with:
artifact-retention-days: ${{ github.ref == 'refs/heads/main' && 30 || 7 }}
pull-request-comment-planetiler-statistics:
name: Add Planetiler statistics to pull request
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event_name == 'pull_request'
needs: generate-vector-basemap-pmtiles
permissions:
contents: read
pull-requests: write
steps:
- name: Download logs
uses: actions/download-artifact@v4
with:
name: logs-planetiler-basemap-vector
merge-multiple: true
- name: Extract only required statistics
run: sed -n '/Tile stats/,$p' logs-planetiler-basemap-vector.txt | tr -cd '[:print:]\n\r' > tile-stats.txt
- name: Prepare comment body
run: |
cat << EOF > comment-body.txt
\`\`\`
$(cat tile-stats.txt)
\`\`\`
EOF
- name: Comment pull request
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: tile-stats
filePath: comment-body.txt
- name: Add summary
run: cat comment-body.txt >> "$GITHUB_STEP_SUMMARY"