-
-
Notifications
You must be signed in to change notification settings - Fork 330
136 lines (133 loc) · 4.12 KB
/
build.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
name: CI
on:
- push
- pull_request
env:
CI: true
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 2
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
yarn.lock
.cache
**/tsconfig.tsbuildinfo
key: cache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
cache-${{ github.ref }}-
cache-
- name: Clear Cache
if: "contains(github.event.head_commit.message, 'skip-cache')"
run: |
rm -rf node_modules yarn.lock **/tsconfig.tsbuildinfo
- name: Config And Install
run: |
[[ ! -z "${{secrets.NPM_TOKEN}}" ]] && echo "npmAuthToken: ${{secrets.NPM_TOKEN}}" >> .yarnrc.yml
git config --global user.name undefined
git config --global user.email i@undefined.moe
yarn
yarn dedupe
env:
LICENSE_KEY: ${{ secrets.MAXMIND_KEY }}
- name: Get specific changed files
id: ui-changed-files
uses: tj-actions/changed-files@v41
with:
files: |
/package.json
.eslint*
packages/ui-default/**
packages/utils/**
.github/workflows/**
- name: Build And Lint
run: |
if [[ ${{ steps.ui-changed-files.outputs.any_changed }} == true ]] || [[ $(npm info @hydrooj/ui-default version) != $(node -e 'console.log(require("./packages/ui-default/package.json").version)') ]]
then
yarn build:ui:iconfont
parallel --tty -j+0 yarn ::: lint:ci lint:ui:ci build build:ui:production:webpack test
else
parallel --tty -j+0 yarn ::: lint:ci build test
fi
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Publish
if: ${{ github.event_name == 'push' }}
run: node -r @hydrooj/register build/publish.ts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - name: Benchmark
# run: yarn benchmark
# - name: Benchmark result
# uses: benchmark-action/github-action-benchmark@v1
# with:
# name: Benchmark
# tool: customBiggerIsBetter
# output-file-path: benchmark.json
# web:
# needs: build
# permissions:
# packages: write
# contents: read
# runs-on: ubuntu-latest
# if: ${{ github.event_name == 'push' }}
# steps:
# - name: Check out
# uses: actions/checkout@v2
# with:
# submodules: recursive
# - name: Log in to GitHub Docker Registry
# uses: docker/login-action@v1
# with:
# registry: docker.pkg.github.com
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Docker:Web
# uses: docker/build-push-action@v2
# with:
# push: true
# context: ./install/docker/backend
# tags: |
# docker.pkg.github.com/hydro-dev/web:${{ github.sha }}
# docker.pkg.github.com/hydro-dev/web:${{ github.ref }}
# judge:
# needs: build
# if: ${{ github.event_name == 'push' }}
# permissions:
# packages: write
# contents: read
# runs-on: ubuntu-latest
# steps:
# - name: Check out
# uses: actions/checkout@v2
# with:
# submodules: recursive
# - name: Log in to GitHub Docker Registry
# uses: docker/login-action@v1
# with:
# registry: docker.pkg.github.com
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Docker:Judge
# uses: docker/build-push-action@v2
# with:
# push: true
# context: ./install/docker/judge
# tags: |
# docker.pkg.github.com/hydro-dev/judge:${{ github.sha }}
# docker.pkg.github.com/hydro-dev/judge:${{ github.ref }}