Skip to content

Commit

Permalink
Make the built locale files available in CI
Browse files Browse the repository at this point in the history
Note the files are currently unused.

Refs #1817, unsplash/intlc#208
  • Loading branch information
thewilkybarkid committed Jul 22, 2024
1 parent 5b8e475 commit 4e8997f
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,45 @@ jobs:
name: manifest
path: src/manifest.json

build-locales:
name: 'Build locales'
runs-on: ubuntu-22.04
timeout-minutes: 30

steps:
- name: 'Checkout code'
uses: actions/[email protected]

- name: 'Set up Docker Build'
uses: docker/[email protected]

- name: 'Build intlc image'
id: build
uses: docker/[email protected]
env:
DOCKER_BUILD_SUMMARY: false
with:
context: .
target: build-intlc
outputs: type=docker
cache-from: type=gha,ignore-error=true
cache-to: type=gha,mode=max,ignore-error=true

- name: 'Create container'
id: container
run: |
container=$(docker container create "${{ steps.build.outputs.imageid }}")
echo "container=$container" >> $GITHUB_OUTPUT
- name: 'Copy files'
run: docker container cp ${{ steps.container.outputs.container }}:/app/src/ .

- name: 'Upload locales'
uses: actions/[email protected]
with:
name: locales
path: src/locales

build-image:
name: 'Build image'
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -135,6 +174,7 @@ jobs:
timeout-minutes: 30
needs:
- build-assets
- build-locales

steps:
- name: 'Checkout code'
Expand All @@ -155,6 +195,12 @@ jobs:
name: manifest
path: src

- name: 'Download locales'
uses: actions/[email protected]
with:
name: locales
path: src/locales

- name: 'Run the linter'
run: npm run lint:ts

Expand All @@ -164,6 +210,7 @@ jobs:
timeout-minutes: 30
needs:
- build-assets
- build-locales
strategy:
fail-fast: false
matrix:
Expand All @@ -188,6 +235,12 @@ jobs:
name: manifest
path: src

- name: 'Download locales'
uses: actions/[email protected]
with:
name: locales
path: src/locales

- name: 'Run the tests'
run: npm run test -- --shard=${{ matrix.shard }}/${{ strategy.job-total }}

Expand All @@ -197,6 +250,7 @@ jobs:
timeout-minutes: 30
needs:
- build-assets
- build-locales
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -227,6 +281,12 @@ jobs:
name: manifest
path: src

- name: 'Download locales'
uses: actions/[email protected]
with:
name: locales
path: src/locales

- name: 'Run Playwright'
id: 'playwright'
uses: docker://mcr.microsoft.com/playwright:v1.42.1-jammy
Expand Down Expand Up @@ -269,6 +329,7 @@ jobs:
timeout-minutes: 30
needs:
- build-assets
- build-locales
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -299,6 +360,12 @@ jobs:
name: manifest
path: src

- name: 'Download locales'
uses: actions/[email protected]
with:
name: locales
path: src/locales

- name: 'Run Playwright'
id: 'playwright'
uses: docker://mcr.microsoft.com/playwright:v1.42.1-jammy
Expand Down Expand Up @@ -345,6 +412,7 @@ jobs:
timeout-minutes: 30
needs:
- build-assets
- build-locales

steps:
- name: 'Checkout code'
Expand All @@ -365,6 +433,12 @@ jobs:
name: manifest
path: src

- name: 'Download locales'
uses: actions/[email protected]
with:
name: locales
path: src/locales

- name: 'Run typechecker'
run: npm run typecheck

Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ COPY .npmrc \
package-lock.json \
./

#
# Stage: intlc environment
#
FROM debian:12.6-slim AS intlc
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
WORKDIR /app

ADD https://github.com/unsplash/intlc/releases/download/v0.8.3/intlc-v0.8.3-linux-x86_64 /usr/local/bin/intlc

RUN chmod +x /usr/local/bin/intlc

#
# Stage: Development NPM install
#
Expand All @@ -26,6 +38,16 @@ FROM npm AS npm-prod

RUN npm ci --ignore-scripts --production

#
# Stage: Intlc build
#
FROM intlc AS build-intlc

COPY scripts/ scripts/
COPY locales/ locales/

RUN scripts/intlc.sh

#
# Stage: Production build
#
Expand Down

0 comments on commit 4e8997f

Please sign in to comment.