-
Notifications
You must be signed in to change notification settings - Fork 5
145 lines (138 loc) · 5.38 KB
/
test.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
145
name: Test
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
get-node-version:
name: Get Node version
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.base.repo.id != github.event.head.repo.id)
runs-on: ubuntu-latest
outputs:
node-version: ${{ steps.get-node-version.outputs.node-version }}
steps:
- uses: actions/checkout@v2
- name: Check get-node-version version
uses: ./.github/actions/get-node-version
with:
package-json: .github/actions/get-node-version/package.json
- name: Get Node version
id: get-node-version
uses: ./.github/actions/get-node-version
pre-commit:
name: Code style check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install pre-commit
run: curl https://pre-commit.com/install-local.py | python -
- name: Run pre-commit
run: ~/bin/pre-commit run --show-diff-on-failure --color=always --all-files
# TODO: Configure build secrets & re-enable
# build:
# name: Build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build Docker images
# run: IMAGE_TAG=${GITHUB_REF##*/} docker compose -f docker-compose.build.yml build --pull
# - name: Login to Docker Hub
# if: github.event_name != 'pull_request'
# env:
# DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
# run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# - name: Push image to Docker Hub
# if: github.event_name != 'pull_request'
# run: IMAGE_TAG=${GITHUB_REF##*/} docker compose -f docker-compose.build.yml push
test:
name: Test
runs-on: ubuntu-latest
needs: get-node-version
env:
NEXT_PUBLIC_API_DOMAIN: ${{ vars.NEXT_PUBLIC_API_DOMAIN }}
steps:
- uses: actions/checkout@v4
- name: Set up Node ${{ needs.get-node-version.outputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ needs.get-node-version.outputs.node-version }}
cache: "yarn"
- name: Set fontawesome token
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" ${{ secrets.NPM_FA_TOKEN }}
- name: Install Yarn dependencies
run: yarn install --frozen-lockfile
- name: Build @thunderstore/cyberstorm
run: yarn workspace @thunderstore/cyberstorm build
- name: Build @thunderstore/dapper
run: yarn workspace @thunderstore/dapper build
- name: Build @thunderstore/dapper-fake
run: yarn workspace @thunderstore/dapper-fake build
- name: Build @thunderstore/thunderstore-api
run: yarn workspace @thunderstore/thunderstore-api build
- name: Test @thunderstore/thunderstore-api
run: yarn workspace @thunderstore/thunderstore-api test
- name: Build @thunderstore/dapper-ts
run: yarn workspace @thunderstore/dapper-ts build
- name: Test @thunderstore/dapper-ts
run: yarn workspace @thunderstore/dapper-ts test
- name: Build @thunderstore/use-promise
run: yarn workspace @thunderstore/use-promise build
- name: Build @thunderstore/cyberstorm-nextjs
run: yarn workspace @thunderstore/cyberstorm-nextjs build
# TODO: Enable but as a separate job once needed
# deploy:
# name: Trigger deploy
# runs-on: ubuntu-latest
# needs: [test]
# if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
# strategy:
# matrix:
# app: [sertra]
# steps:
# - name: Call deployment workflow
# run: |
# curl \
# -X POST \
# -u "${{ secrets.DEPLOY_WORKFLOW_DISPATCH_USER }}:${{ secrets.DEPLOY_WORKFLOW_DISPATCH_PAT }}" \
# -H "Accept: application/vnd.github.v3+json" \
# ${{ secrets.DEPLOY_WORKFLOW_DISPATCH_URL }} \
# -d '{"ref": "master", "inputs": {"sourceOrg": "${{ github.repository_owner }}", "sourceRepo": "${{ github.event.repository.name }}", "appName": "${{ matrix.app }}", "environment": "dev"}}'
chromatic-deployment:
runs-on: ubuntu-latest
needs: ["test", "pre-commit"]
strategy:
matrix:
projects: [
{ dir: "apps/cyberstorm-storybook", token: "CHROMATIC_CYBERSTORM_TOKEN" },
]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node ${{ needs.get-node-version.outputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ needs.get-node-version.outputs.node-version }}
cache: "yarn"
- name: Set fontawesome token
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" ${{ secrets.NPM_FA_TOKEN }}
- name: Install Yarn dependencies
run: yarn install --frozen-lockfile
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets[matrix.projects.token] }}
workingDir: ${{ matrix.projects.dir }}
exitOnceUploaded: true