Skip to content

Commit 6bb3bc9

Browse files
committed
chore: ci
1 parent a48325f commit 6bb3bc9

File tree

3 files changed

+44
-7
lines changed

3 files changed

+44
-7
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2424
wget \
2525
git \
2626
unzip \
27+
libicu72 \
2728
&& rm -rf /var/lib/apt/lists/*
2829

2930
# Install .NET SDK
@@ -45,7 +46,9 @@ RUN curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}"
4546
RUN curl -fsSL https://just.systems/install.sh | bash -s -- --to /usr/local/bin --tag ${JUST_VERSION}
4647

4748
# Install Lefthook
48-
RUN curl -fsSL https://raw.githubusercontent.com/evilmartians/lefthook/master/install.sh | bash -s -- -d -b /usr/local/bin
49+
ARG LEFTHOOK_VERSION=1.11.5
50+
RUN curl -fsSL "https://github.com/evilmartians/lefthook/releases/download/v${LEFTHOOK_VERSION}/lefthook_${LEFTHOOK_VERSION}_Linux_x86_64" -o /usr/local/bin/lefthook \
51+
&& chmod +x /usr/local/bin/lefthook
4952

5053
WORKDIR /workspace
5154

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ghcr.io/devcontainers/features/git:1": {},
99
"ghcr.io/devcontainers/features/github-cli:1": {}
1010
},
11-
"postCreateCommand": "bun install && lefthook install",
11+
"postCreateCommand": "bun install && [ -n \"$CI\" ] || lefthook install",
1212
"customizations": {
1313
"vscode": {
1414
"settings": {

.github/workflows/changesets.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,49 @@ on:
88

99
concurrency: ${{ github.workflow }}-${{ github.ref }}
1010

11+
env:
12+
DEVCONTAINER_IMAGE: ghcr.io/${{ github.repository }}/devcontainer:latest
13+
1114
jobs:
15+
build-devcontainer:
16+
name: "[CI] Build DevContainer"
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@v4
26+
27+
- name: Login to GitHub Container Registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Build and push devcontainer
35+
uses: devcontainers/ci@v0.3
36+
with:
37+
imageName: ${{ env.DEVCONTAINER_IMAGE }}
38+
cacheFrom: ${{ env.DEVCONTAINER_IMAGE }}
39+
push: always
40+
1241
lint:
1342
name: "[CI] Lint"
43+
needs: build-devcontainer
1444
runs-on: ubuntu-latest
1545

1646
steps:
1747
- name: Checkout repo
18-
uses: actions/checkout@v6
48+
uses: actions/checkout@v4
1949

2050
- name: Run lint in devcontainer
2151
uses: devcontainers/ci@v0.3
2252
with:
53+
cacheFrom: ${{ env.DEVCONTAINER_IMAGE }}
2354
runCmd: bun install && bun run lint
2455

2556
changesets:
@@ -36,7 +67,7 @@ jobs:
3667

3768
steps:
3869
- name: Checkout repo
39-
uses: actions/checkout@v6
70+
uses: actions/checkout@v4
4071

4172
- name: Install just
4273
uses: extractions/setup-just@v3
@@ -66,11 +97,12 @@ jobs:
6697

6798
steps:
6899
- name: Checkout repo
69-
uses: actions/checkout@v6
100+
uses: actions/checkout@v4
70101

71102
- name: Build in devcontainer
72103
uses: devcontainers/ci@v0.3
73104
with:
105+
cacheFrom: ${{ env.DEVCONTAINER_IMAGE }}
74106
runCmd: |
75107
bun install
76108
just apis/timetable-generator-v1/build
@@ -97,7 +129,7 @@ jobs:
97129

98130
steps:
99131
- name: Checkout repo
100-
uses: actions/checkout@v6
132+
uses: actions/checkout@v4
101133

102134
- name: Download artifact
103135
uses: actions/download-artifact@v4
@@ -110,6 +142,7 @@ jobs:
110142
env:
111143
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
112144
with:
145+
cacheFrom: ${{ env.DEVCONTAINER_IMAGE }}
113146
runCmd: |
114147
cd apis/timetable-generator-v1/integrations/dotnet/Ladesa.Messages.TimetableGenerator.V1
115148
dotnet restore
@@ -127,7 +160,7 @@ jobs:
127160

128161
steps:
129162
- name: Checkout repo
130-
uses: actions/checkout@v6
163+
uses: actions/checkout@v4
131164

132165
- name: Download artifact
133166
uses: actions/download-artifact@v4
@@ -141,6 +174,7 @@ jobs:
141174
- name: Publish to npm in devcontainer
142175
uses: devcontainers/ci@v0.3
143176
with:
177+
cacheFrom: ${{ env.DEVCONTAINER_IMAGE }}
144178
runCmd: |
145179
cd apis/timetable-generator-v1/integrations/typescript
146180
npm publish --access public

0 commit comments

Comments
 (0)