Skip to content

Commit

Permalink
Merge branch 'main' into fix-web/toggle-save-button
Browse files Browse the repository at this point in the history
  • Loading branch information
caichi-t authored Oct 16, 2024
2 parents 47012c6 + aec7b82 commit 67e4b4a
Show file tree
Hide file tree
Showing 73 changed files with 931 additions and 587 deletions.
File renamed without changes.
File renamed without changes.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: ci
on:
push:
branches: [main, release]
pull_request:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
web: ${{ steps.web.outputs.any_modified }}
server: ${{ steps.server.outputs.any_modified }}
worker: ${{ steps.worker.outputs.any_modified }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: changed files for web
id: web
uses: tj-actions/changed-files@v45
with:
files: |
web
.github/workflows/ci.yml
.github/workflows/ci_web.yml
- name: changed files for server
id: server
uses: tj-actions/changed-files@v45
with:
files: |
server
.github/workflows/ci.yml
.github/workflows/ci_server.yml
.github/workflows/build_server.yml
- name: changed files for worker
id: worker
uses: tj-actions/changed-files@v45
with:
files: |
worker
.github/workflows/ci.yml
.github/workflows/ci_worker.yml
.github/workflows/build_worker.yml
ci-web:
name: web
needs: prepare
if: needs.prepare.outputs.web == 'true'
uses: ./.github/workflows/ci_web.yml

ci-server:
name: server
needs: prepare
if: needs.prepare.outputs.server == 'true'
uses: ./.github/workflows/ci_server.yml

ci-worker:
name: worker
needs: prepare
if: needs.prepare.outputs.worker == 'true'
uses: ./.github/workflows/ci_worker.yml

ci:
runs-on: ubuntu-latest
needs:
- ci-web
- ci-server
- ci-worker
if: '!failure()'
steps:
- run: echo OK
85 changes: 43 additions & 42 deletions .github/workflows/ci_server.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
name: ci-server
on:
push:
branches: [main, release]
paths:
- server/**
- .github/workflows/ci_server.yml
- .github/workflows/server_build.yml
- .github/workflows/deploy_test.yml
- .github/workflows/pr_title.yml
- .github/workflows/stage.yml
- .github/workflows/release.yml
- .github/workflows/server_build.yml
pull_request:
paths:
- server/**
- .github/workflows/ci_server.yml
- .github/workflows/server_build.yml
- .github/workflows/deploy_test.yml
- .github/workflows/pr_title.yml
- .github/workflows/stage.yml
- .github/workflows/release.yml
workflow_call:
env:
GO_VERSION: "1.23"

jobs:
ci:
name: ci
ci-server-lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: go setup
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
working-directory: server
args: --config=../.golangci.yml
skip-cache: true
ci-server-i18n:
name: i18n
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- name: checkout
uses: actions/checkout@v4
- name: go setup
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: check forgotten translations
working-directory: server
run: make i18n-ci
ci-server-test:
name: test
runs-on: ubuntu-latest
services:
mongo:
image: mongo:6-focal
ports:
- 27017:27017
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.23
- name: checkout
uses: actions/checkout@v4
- name: cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
- name: go setup
uses: actions/setup-go@v5
with:
version: v1.61
working-directory: server
args: --config=../.golangci.yml
go-version: ${{ env.GO_VERSION }}
- name: test
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 10m
working-directory: server
env:
REEARTH_CMS_DB: mongodb://localhost
- name: codecov
- name: Send coverage report
uses: codecov/codecov-action@v4
with:
flags: server
file: coverage.txt
- name: check forgotten translations
run: make i18n-ci
file: coverage.txt
36 changes: 8 additions & 28 deletions .github/workflows/ci_web.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
name: ci-web
on:
push:
branches: [main, release]
paths:
- web/**
- .github/workflows/ci_web.yml
- .github/workflows/deploy_test.yml
- .github/workflows/pr_title.yml
- .github/workflows/stage.yml
- .github/workflows/release.yml
pull_request:
paths:
- web/**
- .github/workflows/ci_web.yml
- .github/workflows/deploy_test.yml
- .github/workflows/pr_title.yml
- .github/workflows/stage.yml
- .github/workflows/release.yml
workflow_call:
jobs:
ci:
name: ci
Expand All @@ -25,20 +9,12 @@ jobs:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/checkout@v4
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: yarn
cache-dependency-path: '**/yarn.lock'
- name: Install
run: yarn install
- name: Lint
Expand All @@ -53,9 +29,13 @@ jobs:
run: yarn i18n --fail-on-update
- name: Build
run: yarn build

# TODO: Remove after dockerizing the web.
- name: Pack
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release'
run: mv dist reearth-cms-web && tar -zcvf reearth-cms-web.tar.gz reearth-cms-web

# TODO: Remove after dockerizing the web.
- uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release'
with:
Expand Down
71 changes: 29 additions & 42 deletions .github/workflows/ci_worker.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,48 @@
name: ci-worker
on:
push:
branches: [main, release]
paths:
- worker/**
- .github/workflows/ci_worker.yml
- .github/workflows/deploy_test.yml
- .github/workflows/pr_title.yml
- .github/workflows/stage.yml
- .github/workflows/release.yml
- .github/workflows/decompressor_build.yml
- .github/workflows/worker_build.yml
pull_request:
paths:
- worker/**
- .github/workflows/ci_worker.yml
- .github/workflows/deploy_test.yml
- .github/workflows/pr_title.yml
- .github/workflows/stage.yml
- .github/workflows/release.yml
workflow_call:
env:
GO_VERSION: "1.23"
jobs:
ci:
name: ci
ci-server-lint:
name: lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: worker
services:
mongo:
image: mongo:6-focal
ports:
- 27017:27017
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.23
- name: checkout
uses: actions/checkout@v4
- name: cache
uses: actions/cache@v4
- name: go setup
uses: actions/setup-go@v5
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
working-directory: worker
args: --config=../.golangci.yml
skip-cache: true
ci-server-test:
name: test
runs-on: ubuntu-latest
services:
mongo:
image: mongo:6-focal
ports:
- 27017:27017
steps:
- name: checkout
uses: actions/checkout@v4
- name: go setup
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: test
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 10m
working-directory: worker
env:
REEARTH_CMS_WORKER_DB: mongodb://localhost
- name: codecov
REEARTH_CMS_DB: mongodb://localhost
- name: Send coverage report
uses: codecov/codecov-action@v4
with:
flags: worker
file: coverage.txt
file: coverage.txt
Loading

0 comments on commit 67e4b4a

Please sign in to comment.