-
Notifications
You must be signed in to change notification settings - Fork 8
126 lines (106 loc) · 3.35 KB
/
Copy pathci.yml
File metadata and controls
126 lines (106 loc) · 3.35 KB
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
name: CI
on:
push:
branches: [ main ]
tags: [ '*' ]
pull_request:
branches: [ main ]
permissions:
contents: read
env:
VITE_MAPTILER_API_KEY: '${{ secrets.MAPTILER_API_KEY }}'
IMAGE_PROJECT: dft-rlg-schemes-gis-dev
IMAGE_LOCATION: europe-west1
IMAGE_REPOSITORY_ID: docker
IMAGE_NAME: plan
jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- name: Install wasm-pack
run: |
FOLDER=wasm-pack-v0.15.0-x86_64-unknown-linux-musl
BINARY=wasm-pack
TARGET_FOLDER=~/.cargo/bin
curl -LO "https://github.com/wasm-bindgen/wasm-pack/releases/download/v0.15.0/${FOLDER}.tar.gz"
tar -xzf "${FOLDER}.tar.gz"
mkdir -p "${TARGET_FOLDER}"
mv "${FOLDER}/${BINARY}" "${TARGET_FOLDER}/${BINARY}"
- name: Install dependencies
run: npm ci
- name: Setup GOV.UK
run: npm run setup-govuk
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run type-checker
run: npm run check
- name: Run Playwright tests
run: npm test
- name: Upload test results
run: npx github-actions-ctrf ctrf/ctrf-report.json
if: always()
- name: Upload test results for historical report
uses: actions/upload-artifact@v7
with:
name: ctrf-report
path: ctrf/ctrf-report.json
if: always()
- name: Build svelte app
run: npm run build
- id: auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v3
with:
token_format: access_token
credentials_json: '${{ secrets.GCP_CREDENTIALS_PUSH }}'
- name: Login to Docker repository
uses: docker/login-action@v4
with:
registry: ${{ env.IMAGE_LOCATION }}-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- id: meta
name: Extract metadata
uses: docker/metadata-action@v6
with:
images: ${{ env.IMAGE_LOCATION }}-docker.pkg.dev/${{ env.IMAGE_PROJECT }}/${{ env.IMAGE_REPOSITORY_ID }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=ref,event=branch,enable={{is_not_default_branch}}
type=ref,event=pr,enable={{is_not_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push image
uses: docker/build-push-action@v7
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
deploy_plan:
needs: build
uses: ./.github/workflows/deploy.yml
with:
environment: Dev
tag: ${{ needs.build.outputs.version }}
# only run deploy for CI runs on main
if: github.event_name != 'pull_request'
secrets:
GCP_CREDENTIALS_DEPLOY: ${{ secrets.GCP_CREDENTIALS_DEPLOY }}
deploy_browse:
needs: build
uses: ./.github/workflows/deploy.yml
with:
environment: Dev - browse
tag: ${{ needs.build.outputs.version }}
# only run deploy for CI runs on main
if: github.event_name != 'pull_request'
secrets:
GCP_CREDENTIALS_DEPLOY: ${{ secrets.GCP_CREDENTIALS_DEPLOY }}