Skip to content

Commit 791d757

Browse files
committed
Fix a buildtools gitignore?
1 parent a2f5ad5 commit 791d757

File tree

11 files changed

+74
-57
lines changed

11 files changed

+74
-57
lines changed

.github/actions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"private": true,
44
"type": "module",
55
"devDependencies": {
6-
"@types/node": "^22.15.30",
76
"@sourceacademy/modules-repotools": "workspace:^",
7+
"@types/node": "^22.15.30",
88
"typescript": "^5.8.2"
99
},
1010
"dependencies": {

.github/workflows/new-workflow.yml

Lines changed: 67 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
- master
1010

1111
jobs:
12-
setup-repo:
13-
name: Setup Repository Tooling
12+
setup-repotools:
13+
name: Setup Repotools package
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -47,30 +47,9 @@ jobs:
4747
path: ./lib/repotools/dist
4848
key: repotools
4949

50-
- name: Install Buildtools Dependencies
51-
run: yarn workspaces focus @sourceacademy/modules-buildtools
52-
53-
- name: Check cache for buildtools
54-
uses: actions/cache/restore@v4
55-
id: cache-buildtools
56-
with:
57-
path: ./lib/buildtools/bin/index.js
58-
key: buildtools
59-
60-
- name: Build Buildtools
61-
if: steps.cache-buildtools.outputs.cache-hit != 'true'
62-
run: yarn workspaces foreach -A --include @sourceacademy/modules-buildtools run build
63-
64-
- name: Cache Buildtools
65-
if: steps.cache-repotools.outputs.cache-hit != 'true'
66-
uses: actions/cache/save@v4
67-
with:
68-
path: ./lib/buildtools/bin/index.js
69-
key: buildtools
70-
7150
find-packages:
7251
name: Determine the packages present in the repo for the given type
73-
needs: setup-repo
52+
needs: setup-repotools
7453
runs-on: ubuntu-latest
7554
strategy:
7655
matrix:
@@ -103,46 +82,83 @@ jobs:
10382
with:
10483
type: ${{ matrix.type }}
10584

106-
test-libs:
107-
name: Test and Typecheck libraries
85+
build-libs:
86+
name: Build and compile the libraries
10887
runs-on: ubuntu-latest
10988
needs: find-packages
11089
strategy:
11190
matrix:
112-
package: ${{ fromJson(needs.find-packages.outputs.tabs) }}
113-
114-
steps:
115-
- name: Check out source code
116-
uses: actions/checkout@v4
117-
118-
- name: Enable Corepack
119-
run: corepack enable
91+
package: ${{ fromJSON(needs.find-packages.outputs.libs )}}
12092

121-
- name: Use Node.js 💻
122-
uses: actions/setup-node@v4
123-
with:
124-
node-version-file: .node-version
125-
cache: yarn
93+
defaults:
94+
run:
95+
working-directory: ${{ matrix.package.directory }}
12696

97+
steps:
12798
- name: Install dependencies
12899
run: yarn workspaces focus ${{ matrix.package.name }}
129100

130-
- name: Restore repotools
101+
- name: Check cache
131102
uses: actions/cache/restore@v4
103+
id: cache
132104
with:
133-
path: ./lib/repotools/dist
134-
key: repotools
105+
path: ${{ matrix.package.directory }}/dist
106+
key: ${{ matrix.package.name }}
135107

136-
- name: tsc and test
137-
run: |
138-
cd ${{ matrix.package.directory }}
139-
yarn tsc
140-
yarn test
108+
- name: Build ${{ matrix.package.name }}
109+
if: steps.cache.outputs.cache-hit != 'true'
110+
run: yarn build
111+
112+
- name: Store in Cache
113+
if: steps.cache.outputs.cache-hit != 'true'
114+
uses: actions/cache/save@v4
115+
with:
116+
path: ${{ matrix.package.directory }}/dist
117+
key: ${{ matrix.package.name }}
118+
119+
# test-libs:
120+
# name: Test and Typecheck libraries
121+
# runs-on: ubuntu-latest
122+
# needs: find-packages
123+
# strategy:
124+
# matrix:
125+
# package: ${{ fromJson(needs.find-packages.outputs.tabs) }}
126+
127+
# steps:
128+
# - name: Check out source code
129+
# uses: actions/checkout@v4
130+
131+
# - name: Enable Corepack
132+
# run: corepack enable
133+
134+
# - name: Use Node.js 💻
135+
# uses: actions/setup-node@v4
136+
# with:
137+
# node-version-file: .node-version
138+
# cache: yarn
139+
140+
# - name: Install dependencies
141+
# run: yarn workspaces focus ${{ matrix.package.name }}
142+
143+
# - name: Restore repotools
144+
# uses: actions/cache/restore@v4
145+
# with:
146+
# path: ./lib/repotools/dist
147+
# key: repotools
148+
149+
# - name: tsc and test
150+
# run: |
151+
# cd ${{ matrix.package.directory }}
152+
# yarn tsc
153+
# yarn test
141154

142155
test-tabs:
143156
name: Test and Typecheck tabs
144157
runs-on: ubuntu-latest
145-
needs: find-packages
158+
needs:
159+
- build-libs
160+
- find-packages
161+
146162
strategy:
147163
fail-fast: false
148164
matrix:
@@ -178,13 +194,13 @@ jobs:
178194
- name: Restore buildtools
179195
uses: actions/cache/restore@v4
180196
with:
181-
key: buildtools
182-
path: ./lib/buildtools/bin/index.js
197+
key: "@sourceacademy/modules-buildtools"
198+
path: ./lib/buildtools/dist
183199

184200
- name: Restore repotools
185201
uses: actions/cache/restore@v4
186202
with:
187-
key: repotools
203+
key: "@sourceacademy/modules-repotools"
188204
path: ./lib/repotools/dist
189205

190206
- name: Install dependencies

lib/buildtools/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
bin/index.js
1+
!**/dist/**
2+
**/dist/index.js

lib/buildtools/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const command = getBuildCommand({
1515
},
1616
bundle: true,
1717
format: 'esm',
18-
outfile: './bin/index.js',
18+
outfile: './dist/index.js',
1919
packages: 'external',
2020
platform: 'node',
2121
tsconfig: './tsconfig.json',
File renamed without changes.

lib/buildtools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"exports": null,
1414
"bin": {
15-
"buildtools": "./bin/index.js"
15+
"buildtools": "./dist/index.js"
1616
},
1717
"type": "module",
1818
"dependencies": {

lib/buildtools/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"extends": "../tsconfig.json",
99
"include": ["./src", "vitest.setup.ts", "vitest.d.ts"],
1010
"exclude": [
11-
"./bin",
11+
"dist",
1212
"../__test_mocks__"
1313
]
1414
}

0 commit comments

Comments
 (0)