-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (168 loc) · 5.54 KB
/
node.yaml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Node CI
on:
push:
branches:
- "**"
tags:
- "v**"
pull_request:
jobs:
lint-core:
name: Typecheck and Lint
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
- uses: ./.github/actions/setup-meteor
- name: restore node_modules
uses: actions/cache@v4
with:
path: |
meteor/node_modules
key: ${{ runner.os }}-${{ hashFiles('meteor/yarn.lock') }}-${{ hashFiles('meteor/.meteor/release') }}
- name: Prepare Environment
run: |
yarn
env:
CI: true
- name: Run typecheck and linter
run: |
cd meteor
meteor npm run ci:lint
env:
CI: true
test-core:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
- uses: ./.github/actions/setup-meteor
- name: restore node_modules
uses: actions/cache@v4
with:
path: |
meteor/node_modules
key: ${{ runner.os }}-${{ hashFiles('meteor/yarn.lock') }}-${{ hashFiles('meteor/.meteor/release') }}
- name: Prepare Environment
run: |
yarn
env:
CI: true
- name: Run Tests
run: |
cd meteor
meteor yarn unitci
env:
CI: true
- name: Send coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
# name: codecov-umbrella
build-core:
# TODO - should this be dependant on tests or something passing if we are on a tag?
name: Build and publish docker image
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Determine images to publish
id: image-tags
run: |
IMAGES=
DOCKER_TAG=$(echo "${{ github.ref_name }}" | sed -r 's/[^a-z0-9]+/-/gi')
# check if a release branch, or master, or a tag
if [[ $DOCKER_TAG =~ ^release([0-9]+)$ || $DOCKER_TAG == "master" || $DOCKER_TAG == "main" || "${{ github.ref }}" == refs/tags/* ]]
then
# If we have a dockerhub image name, then setup to publish there
if [ -z "${{ secrets.DOCKERHUB_IMAGE_PREFIX }}" ]
then
DOCKERHUB_PUBLISH="0"
else
DOCKERHUB_PUBLISH="1"
IMAGES="${{ secrets.DOCKERHUB_IMAGE_PREFIX }}e2e-test-runner:$DOCKER_TAG"$'\n'$IMAGES
fi
# If instructed, push to github packages
if [ -z "${{ secrets.GH_PACKAGES_ENABLED }}" ] || [ -z "${{ secrets.GITHUB_TOKEN }}" ]
then
GHCR_PUBLISH="0"
else
GHCR_PUBLISH="1"
IMAGES="ghcr.io/${{ github.repository }}:$DOCKER_TAG"$'\n'$IMAGES
fi
# debug output
echo dockerhub-publish $DOCKERHUB_PUBLISH
echo ghcr-publish $GHCR_PUBLISH
echo images $IMAGES
echo "images=$IMAGES" >> $GITHUB_OUTPUT
echo "dockerhub-publish=$DOCKERHUB_PUBLISH" >> $GITHUB_OUTPUT
echo "ghcr-publish=$GHCR_PUBLISH" >> $GITHUB_OUTPUT
else
echo "Skipping docker build"
fi
- name: Use Node.js
uses: actions/setup-node@v4
if: ${{ steps.image-tags.outputs.images }}
with:
node-version-file: ".node-version"
- uses: ./.github/actions/setup-meteor
if: ${{ steps.image-tags.outputs.images }}
- name: Prepare Environment
if: ${{ steps.image-tags.outputs.images }}
run: |
yarn install
- name: Persist Built Version information
if: ${{ steps.image-tags.outputs.images }}
run: |
cd meteor
yarn inject-git-hash
- name: Meteor Build
if: ${{ steps.image-tags.outputs.images }}
run: |
cd meteor
NODE_OPTIONS="--max-old-space-size=4096" METEOR_DEBUG_BUILD=1 meteor build --allow-superuser --directory .
- name: Meteor Bundle NPM Build
if: ${{ steps.image-tags.outputs.images }}
run: |
cd meteor/bundle/programs/server
meteor npm install
- name: Set up Docker Buildx
if: ${{ steps.image-tags.outputs.images }}
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: steps.image-tags.outputs.images && steps.image-tags.outputs.dockerhub-publish == '1'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: steps.image-tags.outputs.images && steps.image-tags.outputs.ghcr-publish == '1'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
if: ${{ steps.image-tags.outputs.images }}
with:
context: .
file: ./meteor/Dockerfile.gha
push: true
tags: ${{ steps.image-tags.outputs.images }}