fix: add reearthWeb filed #570
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- release | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
ci_pre: | |
name: CI pre | |
runs-on: ubuntu-latest | |
if: github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'v') | |
outputs: | |
web: ${{ steps.web.outputs.any_changed }} | |
server: ${{ steps.server.outputs.any_changed }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get web changed files | |
id: web | |
uses: tj-actions/changed-files@v24 | |
with: | |
files: | | |
.github/workflows/ci.yml | |
.github/workflows/build.yml | |
.github/workflows/deploy.yml | |
.github/workflows/stage.yml | |
.github/workflows/release.yml | |
CHANGELOG.md | |
web/** | |
.eslintignore | |
- name: Get server changed files | |
id: server | |
uses: tj-actions/changed-files@v24 | |
with: | |
files: | | |
.github/workflows/ci.yml | |
.github/workflows/build.yml | |
.github/workflows/deploy.yml | |
.github/workflows/stage.yml | |
.github/workflows/release.yml | |
CHANGELOG.md | |
server/** | |
ci_web: | |
name: CI web | |
needs: ci_pre | |
if: ${{ needs.ci_pre.outputs.web == 'true' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: web | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- uses: actions/checkout@v3 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
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- | |
- name: Install | |
run: yarn install | |
- name: Lint | |
run: yarn run lint | |
- name: Test | |
run: yarn coverage | |
- name: codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
flags: web | |
- name: Check translations | |
run: yarn i18n --fail-on-update | |
- name: Build | |
run: yarn build | |
- name: Build extension | |
run: yarn build:ext | |
- name: Pack | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release' | |
run: mv dist reearth-marketplace-web && tar -zcvf reearth-marketplace-web.tar.gz reearth-marketplace-web | |
- uses: actions/upload-artifact@v3 | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release' | |
with: | |
name: reearth-marketplace-web | |
path: web/reearth-marketplace-web.tar.gz | |
if-no-files-found: error | |
ci_server: | |
name: CI server | |
needs: ci_pre | |
if: ${{ needs.ci_pre.outputs.server == 'true' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: server | |
services: | |
mongo: | |
image: mongo:4.4-focal | |
ports: | |
- 27017:27017 | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
version: v1.49 | |
working-directory: server | |
args: --timeout=10m | |
- name: test | |
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic | |
env: | |
REEARTH_MARKETPLACE_DB: mongodb://localhost | |
- name: codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
flags: server | |
file: coverage.txt | |
ci: | |
name: CI | |
runs-on: ubuntu-latest | |
needs: | |
- ci_web | |
- ci_server | |
if: ${{ ! failure() }} | |
steps: | |
- run: echo succeeded |