-
Notifications
You must be signed in to change notification settings - Fork 5
160 lines (154 loc) · 5.84 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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: Run pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: false
- name: Setup Python 3.8
id: setup-python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- uses: actions/setup-node@v2
with:
node-version: "14"
- name: Get node version
id: node-version
run: echo "::set-output name=node-version::$(node --version)"
- uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Cache poetry venv
id: cache-poetry
uses: actions/cache@v2
with:
path: .venv
key: "poetry-${{ runner.os }}-\
${{ steps.setup-python.outputs.python-version }}-\
${{ hashFiles('poetry.lock') }}"
restore-keys: |
poetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-
- name: Install poetry dependencies
run: poetry install
- name: Cache pre-commit cache
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: "pre-commit-${{ runner.os }}-\
${{ steps.setup-python.outputs.python-version }}-\
${{ steps.node-version.outputs.node-version }}-\
${{ hashFiles('.pre-commit-config.yaml') }}"
- name: Run pre-commit
run: poetry run 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_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }}
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }}
PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
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-remix
run: yarn workspace @thunderstore/cyberstorm-remix build
chromatic-deployment:
runs-on: ubuntu-latest
needs: ["test", "pre-commit", "get-node-version"]
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