Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9b55602
CI: merge v3-dev into dev pipeline
derhuerst Nov 29, 2022
65a990e
CI: use env var & $GITHUB_OUTPUT instead of set-output
derhuerst Jan 20, 2023
6e45b0d
Yarn: run Node v14 patch after each install
derhuerst Jan 25, 2023
354a00e
Dockerfile: minor tweaks
derhuerst Apr 20, 2022
a9c5d5d
Dockerfile: use multi-stage build for yarn install
derhuerst Apr 20, 2022
db4ea7a
Dockerfile: yarn install: run with --immutable
derhuerst Apr 20, 2022
dc959d0
Dockerfile: yarn install: skip Playwright browser download
derhuerst Dec 1, 2022
3f5eda9
Dockerfile: yarn install: tweak CLI output
derhuerst Apr 20, 2022
6248afa
Dockerfile: node:12 -> node:14-alpine, CI dev pipeline: use Node v14
derhuerst Apr 20, 2022
a035ed7
Dockerfile: yarn build: tweak removal of caches & artifacts, tweak ca…
derhuerst Apr 20, 2022
38ef053
fix Docker build: favicons-webpack-plugin@^3 & update webpack@^4
derhuerst Apr 20, 2022
1435ca8
make source map generation configurable
derhuerst Apr 20, 2022
f230587
.dockerignore: ignore .github, keep README & co, remove obsolete paths
derhuerst Apr 21, 2022
76df655
Webpack stats.json: only include .entrypoints
derhuerst Apr 21, 2022
49ae0ff
Dockerfile: add labels following OCI image spec
derhuerst Apr 21, 2022
f01c604
CI dev pipeline: cache .yarn/cache in addition to node_modules
derhuerst Apr 20, 2022
8c11bb5
CI dev pipeline: re-install node_modules only if not cached
derhuerst Apr 21, 2022
1af94b5
CI dev pipeline: rebuild shared components only if not cached
derhuerst Apr 21, 2022
b3d3e62
CI dev pipeline: rebuild Relay queries only if not cached
derhuerst Apr 21, 2022
1674733
CI dev pipeline: don't let Playwright download unused browsers
derhuerst Apr 21, 2022
f916cfc
CI dev pipeline: minor tweaks
derhuerst Apr 21, 2022
b00472a
CI dev/hotfix pipelines: build & publish Docker img via buildx & GH a…
derhuerst Apr 21, 2022
cb5c45c
CI dev/hotfix pipelines: cache Docker layers via GitHub cache
derhuerst Apr 21, 2022
dc76ec4
CI dev/hotfix pipeline: re-enable linting of SVG icons
derhuerst May 17, 2023
8dae91b
jyvaskyla config.logo: use relative path
derhuerst Jan 22, 2023
b88f101
Dockerfile: add health check
derhuerst Jan 22, 2023
a3eae2a
Dockerfile: allow passing in $CONFIG as build arg
derhuerst Jan 23, 2023
9904c4c
don't build startup images for iOS/iPadOS
derhuerst May 26, 2023
abfbfd8
debug CI [drop]
derhuerst Jan 20, 2023
3dfe228
chore: upgrade to Node.js v16; css-loader@5, sass-loader@10, node-sass@6
hbruch Feb 18, 2023
d9b8b09
debug CI [drop]
derhuerst May 17, 2023
24a113b
use Yarn v3.4.1 & version plugin v3.1.3
derhuerst Feb 18, 2023
371c168
CI: add "v3" prefix to Yarn cache key 💚
derhuerst Feb 18, 2023
584d7df
update yarn.lock to Yarn v3 checksums
derhuerst Mar 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
.git
.gitignore
.*swp

.github

LICENSE*
VERSION
README.md
Changelog.md
Makefile
docker-compose.yml
win-launch-scripts/
docs/
/test

/Dockerfile

node_modules
/.yarn
# todo: keep?
# !/.yarn/install-state.gz
!/.yarn/plugins
!/.yarn/releases
!/.yarn/versions

_static
/app/__generated__
/app/**/__generated__
265 changes: 170 additions & 95 deletions .github/workflows/dev-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,75 @@
name: Process v2 push or pr
name: Process v3 push or PR

on:
push:
branches:
- v2
# - v3
# todo: remove
- improve-ci-speed
# todo: remove
- node16-upstream
pull_request:
branches:
- v2
# - v3
# todo: remove
- improve-ci-speed
# todo: remove
- node16-upstream

env:
# We tell Playwright not to download browser binaries because we use microsoft/playwright-github-action.
# https://github.com/microsoft/playwright/blob/v1.16.2/installation-tests/installation-tests.sh#L200-L216
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'

jobs:
lint:
# install dependencies, build shared components, cache both for subsequent jobs
install:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: "Set time zone to Europe/Helsinki"
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/examples.md#node---yarn-2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache .yarn/cache
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
with:
path: '.yarn/cache'
key: yarn-v3-cache-${{ github.ref_name }}
restore-keys: yarn-v3-cache-v3
- name: Install dependencies
run: yarn
- name: Install dependencies and build shared components
run: yarn setup
- name: Run linters
run: yarn lint
unit-test:
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install --immutable

- name: cache shared components
id: cache-shared-components
uses: actions/cache@v3
with:
path: 'digitransit-*'
key: ${{ runner.os }}-shared-components-${{ hashFiles('digitransit-*') }}
- name: build shared components
if: ${{ steps.cache-shared-components.outputs.cache-hit != 'true' }}
run: yarn run build-workspaces

lint:
needs: install
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -45,97 +81,111 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/examples.md#node---yarn-2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache .yarn/cache
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
with:
path: '.yarn/cache'
key: yarn-v3-cache-${{ github.ref_name }}
restore-keys: yarn-v3-cache-v3
- name: Install dependencies
run: yarn
- name: Install dependencies and build shared components
run: yarn setup
- name: build relay queries
run: yarn relay
- name: Run unit tests
run: yarn run test-coverage
- name: Send test coverage report
run: yarn run test-report
# build:
# needs: install
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [10.x]
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: "Set time zone to Europe/Helsinki"
# uses: zcong1993/setup-timezone@master
# with:
# timezone: "Europe/Helsinki"
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - name: Build shared components
# run: yarn setup
# - name: Build UI
# run: yarn build
# - name: Cache build
# id: cache-build
# uses: actions/cache@v2
# with:
# path: |
# '**/_static'
# './manifest.json'
# key: ${{ runner.os }}-build-${{ github.run_id }}
publish-npm:
if: github.ref == 'refs/heads/v2'
needs:
- lint
- unit-test
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install --immutable

- name: cache shared components
id: cache-shared-components
uses: actions/cache@v3
with:
path: 'digitransit-*'
key: ${{ runner.os }}-shared-components-${{ hashFiles('digitransit-*') }}
- name: Build shared components
if: ${{ steps.cache-shared-components.outputs.cache-hit != 'true' }}
run: yarn run build-workspaces

- name: Run linters
run: yarn lint
- name: lint SVG sprites using xmllint
run: |
sudo apt install -y libxml2-utils
xmllint --nonet --noout static/assets/svg-sprite.*.svg

unit-test:
needs: install
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 10.x ]
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Set time zone to Europe/Helsinki
- name: Checkout
uses: actions/checkout@v2
- name: "Set time zone to Europe/Helsinki"
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/examples.md#node---yarn-2
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Cache .yarn/cache
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
uses: actions/cache@v3
with:
path: '.yarn/cache'
key: yarn-v3-cache-${{ github.ref_name }}
restore-keys: yarn-v3-cache-v3
- name: Install dependencies
run: yarn
- name: Install dependencies and build shared components
run: yarn setup
- name: build relay queries
run: yarn relay
- name: Authenticate with registry
run: echo //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} > .npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: disregard changed yarn.lock
run: git update-index --assume-unchanged yarn.lock
- name: Publish shared components to npm
run: echo ::set-output name=publish-logs::$(yarn digitransit-npm-autopublish)
shell: bash
id: publish
- name: Parse publish logs
run: echo ::set-output name=published-packages::$(echo "${{ steps.publish.outputs.publish-logs }}" | grep -o -P '(Successfully published:).*')
shell: bash
id: log-parse
- name: Send published packages to slack
if: steps.log-parse.outputs.published-packages != ''
run: ./.github/workflows/scripts/slack_message.sh
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
PUBLISHED_PACKAGES: ${{ steps.log-parse.outputs.published-packages }}
shell: bash
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install --immutable

- name: cache shared components
id: cache-shared-components
uses: actions/cache@v3
with:
path: 'digitransit-*'
key: ${{ runner.os }}-shared-components-${{ hashFiles('digitransit-*') }}
- name: Build shared components
if: ${{ steps.cache-shared-components.outputs.cache-hit != 'true' }}
run: yarn run build-workspaces

- name: cache built Relay queries
id: cache-relay
uses: actions/cache@v3
with:
path: |
./__generated__
**/__generated__
key: ${{ runner.os }}-relay-${{ github.sha }}
- name: build Relay queries
if: ${{ steps.cache-relay.outputs.cache-hit != 'true' }}
run: |
yarn run relay

- name: Run unit tests
run: yarn run test-coverage
- name: Send test coverage report
run: yarn run test-report

docker-push:
if: github.ref == 'refs/heads/v2'
# todo: re-add this before merging!
# if: github.ref == 'refs/heads/v3'
needs:
- lint
- publish-npm
- unit-test
runs-on: ubuntu-latest
steps:
Expand All @@ -145,8 +195,33 @@ jobs:
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
- name: Build docker image from v2 and push it
run: ./.github/workflows/scripts/build_and_push_dev.sh
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_AUTH: ${{ secrets.DOCKER_AUTH }}

- name: Create buildInfo.js file
run: |
echo -e "export const COMMIT_ID = \"${GITHUB_SHA}\";\nexport const BUILD_TIME = \"$(date -Iminutes -u)\";" >app/buildInfo.js
- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_AUTH }}

- name: compute Docker image tag
id: docker-tags
run: |
echo "permanent-tag=v3-$(date +"%Y-%m-%dT%H.%M.%S")-${GITHUB_SHA:0:7}" >>$GITHUB_OUTPUT
- name: build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
# todo: re-enable before merging!
# hsldevcom/digitransit-ui:v3
tags: |
hsldevcom/digitransit-ui:${{ steps.docker-tags.outputs.permanent-tag }}
# https://github.com/docker/build-push-action/blob/9472e9021074a3cb3279ba431598b8836d40433f/docs/advanced/cache.md#github-cache
# https://github.com/moby/buildkit#registry-push-image-and-cache-separately
cache-from: type=gha
cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd
push: true
38 changes: 32 additions & 6 deletions .github/workflows/hotfix-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,35 @@ jobs:
uses: zcong1993/setup-timezone@master
with:
timezone: "Europe/Helsinki"
- name: Build docker image from next and push it
run: ./.github/workflows/scripts/build_and_push_dev.sh
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_AUTH: ${{ secrets.DOCKER_AUTH }}
DOCKER_BASE_TAG: hotfix

- name: configure Docker Buildx
uses: docker/setup-buildx-action@v1
- name: log in to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_AUTH }}

- name: Cache .yarn/cache
uses: actions/cache@v3
with:
path: '.yarn/cache'
key: yarn-cache-${{ github.ref_name }}
restore-keys: yarn-cache-v2

- name: determine Docker image tags
id: docker-tags
run: |
echo "::set-output name=permanent-tag::hotfix-$(date +"%Y-%m-%dT%H.%M.%S")-${GITHUB_SHA:0:7}"
- name: build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
tags: |
hsldevcom/digitransit-ui:hotfix
hsldevcom/digitransit-ui:${{ steps.docker-tags.outputs.permanent-tag }}
# https://github.com/docker/build-push-action/blob/9472e9021074a3cb3279ba431598b8836d40433f/docs/advanced/cache.md#github-cache
# https://github.com/moby/buildkit#registry-push-image-and-cache-separately
cache-from: type=gha
cache-to: type=gha,mode=max,oci-mediatypes=true,compression=zstd
push: true
Loading