Skip to content

Commit 30ab00f

Browse files
committed
chore(ci): gh actions
1 parent 5a16fde commit 30ab00f

File tree

5 files changed

+209
-0
lines changed

5 files changed

+209
-0
lines changed

.github/labeler.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
infrastructure:
2+
- changed-files:
3+
- any-glob-to-any-file:
4+
- terraform/**/*
5+
6+
documentation:
7+
- changed-files:
8+
- any-glob-to-any-file:
9+
- docs/**/*
10+
- README.md
11+
ci:
12+
- changed-files:
13+
- any-glob-to-any-file:
14+
- .github/**/*
15+
16+
test:
17+
- changed-files:
18+
- any-glob-to-any-file:
19+
- test/**/*

.github/workflows/ci-pipeline.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Reusable CI/CD Pipeline Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
required: true
8+
type: string
9+
10+
env:
11+
AWS_ACCOUNT_ID: ${{ vars.AWS_ACCOUNT_ID }}
12+
AWS_ROLE: ${{ vars.AWS_ROLE }}
13+
CLOUDFRONT_ID: ${{ vars.CLOUDFRONT_ID }}
14+
S3_BUCKET: ${{ vars.S3_BUCKET }}
15+
AWS_REGION: ${{ vars.AWS_REGION }}
16+
REACT_APP_VERSION: ${{ vars.REACT_APP_VERSION }}
17+
REACT_APP_API_VIZZUALITY_URL_V1: ${{ vars.REACT_APP_API_VIZZUALITY_URL_V1 }}
18+
REACT_APP_API_CUBE_URL: ${{ vars.REACT_APP_API_CUBE_URL }}
19+
REACT_APP_API_CUBE_URL_V1: ${{ vars.REACT_APP_API_CUBE_URL_V1 }}
20+
REACT_APP_API_CUBE_URL_V3: ${{ vars.REACT_APP_API_CUBE_URL_V3 }}
21+
REACT_APP_ALERTS_API_URL: ${{ vars.REACT_APP_ALERTS_API_URL }}
22+
REACT_APP_ALERTS_API_TOKEN: ${{ vars.REACT_APP_ALERTS_API_TOKEN }}
23+
REACT_APP_API_AUTH_URL: ${{ vars.REACT_APP_API_AUTH_URL }}
24+
REACT_APP_API_AUTH_CALLBACK_URL: ${{ vars.REACT_APP_API_AUTH_CALLBACK_URL }}
25+
REACT_APP_API_MAPBOX_TOKEN: ${{ vars.REACT_APP_API_MAPBOX_TOKEN }}
26+
REACT_APP_CARTO: ${{ vars.REACT_APP_CARTO }}
27+
REACT_APP_CARTO_COUNTRIES: ${{ vars.REACT_APP_CARTO_COUNTRIES }}
28+
REACT_APP_CARTO_TABLE: ${{ vars.REACT_APP_CARTO_TABLE }}
29+
REACT_APP_DOWNLOAD_APK_LINK: ${{ vars.REACT_APP_DOWNLOAD_APK_LINK }}
30+
REACT_APP_DOWNLOAD_APK_VERSION: ${{ vars.REACT_APP_DOWNLOAD_APK_VERSION }}
31+
REACT_APP_FACEBOOK_WIDGET_API: ${{ vars.REACT_APP_FACEBOOK_WIDGET_API }}
32+
REACT_APP_GA_UA: ${{ vars.REACT_APP_GA_UA }}
33+
REACT_APP_GFW_API_KEY: ${{ vars.REACT_APP_GFW_API_KEY }}
34+
REACT_APP_GFW_ASSETS_PATH: ${{ vars.REACT_APP_GFW_ASSETS_PATH }}
35+
REACT_APP_SENTRY_DSN: ${{ vars.REACT_APP_SENTRY_DSN }}
36+
REACT_APP_TWITTER_WIDGET_API: ${{ vars.REACT_APP_TWITTER_WIDGET_API }}
37+
REACT_APP_GOOGLE_PLUS_ONE_WIDGET_API: ${{ vars.REACT_APP_GOOGLE_PLUS_ONE_WIDGET_API }}
38+
REACT_APP_GOOGLE_PLACES_API_KEY: ${{ vars.REACT_APP_GOOGLE_PLACES_API_KEY }}
39+
REACT_APP_MAPBOX_ACCESS_TOKEN: ${{ vars.REACT_APP_MAPBOX_ACCESS_TOKEN }}
40+
REACT_APP_PLANET_API_KEY: ${{ vars.REACT_APP_PLANET_API_KEY }}
41+
REACT_APP_FLAGSHIP_URL: ${{ vars.REACT_APP_FLAGSHIP_URL }}
42+
REACT_APP_DEFAULT_TEMPLATE_ID: ${{ vars.REACT_APP_DEFAULT_TEMPLATE_ID }}
43+
REACT_APP_API_BITLY_TOKEN: ${{ vars.REACT_APP_API_BITLY_TOKEN }}
44+
45+
jobs:
46+
build:
47+
name: Install and Build Project
48+
runs-on: ubuntu-latest
49+
environment: ${{ inputs.environment }}
50+
steps:
51+
- name: Checkout Code
52+
uses: actions/checkout@v4
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v3
55+
with:
56+
node-version: 22
57+
cache: "yarn"
58+
- name: Install Dependencies
59+
run: |
60+
yarn install
61+
- name: Build and Test
62+
run: |
63+
yarn run test
64+
yarn run build
65+
- name: Upload Artifacts
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: build-artifacts
69+
path: build/
70+
71+
deploy:
72+
name: Deploy to AWS
73+
runs-on: ubuntu-latest
74+
needs: build
75+
environment: ${{ inputs.environment }}
76+
permissions:
77+
id-token: write
78+
contents: read
79+
steps:
80+
- name: Checkout Code
81+
uses: actions/checkout@v4
82+
83+
- name: Download Artifacts
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: build-artifacts
87+
path: build/
88+
89+
- name: Configure AWS Credentials
90+
uses: aws-actions/configure-aws-credentials@v3
91+
with:
92+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/${{ vars.AWS_ROLE }}
93+
aws-region: ${{ vars.AWS_REGION }}
94+
- name: Deploy to S3
95+
id: upload
96+
shell: bash
97+
run: |
98+
aws s3 sync build/ s3://${{ vars.S3_BUCKET }}
99+
aws cloudfront create-invalidation --distribution-id ${{ vars.CLOUDFRONT_ID }} --paths "/*"

.github/workflows/main.prod.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI/CD Pipeline Production
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
run-pipeline:
10+
name: Run pipeline
11+
uses: ./.github/workflows/ci-pipeline.yml
12+
secrets: inherit
13+
permissions:
14+
id-token: write
15+
contents: read
16+
with:
17+
environment: "production"

.github/workflows/pr-utils.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Pull request utilities
2+
3+
on:
4+
- pull_request
5+
6+
jobs:
7+
labeler:
8+
name: Assign labels to PR
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
issues: write
14+
15+
steps:
16+
- uses: actions/labeler@v5
17+
- uses: pascalgn/size-label-action@v0.5.2
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
sizes: >
22+
{
23+
"0": "xs",
24+
"20": "s",
25+
"50": "m",
26+
"200": "l",
27+
"800": "xl"
28+
}
29+
30+
semantic:
31+
name: Validate PR title
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: amannn/action-semantic-pull-request@v5
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/run-tests.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Run Tests
2+
3+
on:
4+
- pull_request
5+
6+
jobs:
7+
run-tests:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
with:
13+
ref: ${{ github.event.pull_request.head.sha }}
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "22"
19+
cache: "yarn"
20+
21+
- name: Install dependencies
22+
run: yarn install
23+
24+
- name: Run tests
25+
run: yarn run test:coverage
26+
27+
# - name: Install DeepSource CLI
28+
# run: curl https://deepsource.io/cli | sh
29+
30+
# - name: Push coverage report to DeepSource
31+
# env:
32+
# DEEPSOURCE_DSN: ${{ vars.DEEPSOURCE_DSN }}
33+
# run: |
34+
# ./bin/deepsource report \
35+
# --analyzer test-coverage \
36+
# --key javascript \
37+
# --value-file ./coverage/cobertura-coverage.xml

0 commit comments

Comments
 (0)