-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
2,326 additions
and
501 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: copier-build | ||
on: | ||
workflow_run: | ||
workflows: [ci-worker] | ||
types: [completed] | ||
branches: [main, release] | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
info: | ||
name: Collect information | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.conclusion != 'failure' && github.event.repository.full_name == 'reearth/reearth-cms' && (github.event.workflow_run.head_branch == 'release' || !startsWith(github.event.workflow_run.head_commit.message, 'v')) | ||
outputs: | ||
sha_short: ${{ steps.info.outputs.sha_short }} | ||
new_tag: ${{ steps.info.outputs.new_tag }} | ||
new_tag_short: ${{ steps.info.outputs.new_tag_short }} | ||
name: ${{ steps.info.outputs.name }} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: Fetch tags | ||
run: git fetch --prune --unshallow --tags | ||
- name: Get info | ||
id: info | ||
# The tag name should be retrieved lazily, as tagging may be delayed. | ||
env: | ||
BRANCH: ${{ github.event.workflow_run.head_branch }} | ||
run: | | ||
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | ||
if [[ "$BRANCH" = "release" ]]; then | ||
TAG=$(git tag --points-at HEAD) | ||
if [[ ! -z "$TAG" ]]; then | ||
echo "new_tag=$TAG" >> "$GITHUB_OUTPUT" | ||
echo "new_tag_short=${TAG#v}" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "name=rc" >> "$GITHUB_OUTPUT" | ||
fi | ||
else | ||
echo "name=nightly" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Show info | ||
env: | ||
SHA_SHORT: ${{ steps.info.outputs.sha_short }} | ||
NEW_TAG: ${{ steps.info.outputs.new_tag }} | ||
NEW_TAG_SHORT: ${{ steps.info.outputs.new_tag_short }} | ||
NAME: ${{ steps.info.outputs.name }} | ||
run: echo "sha_short=$SHA_SHORT, new_tag=$NEW_TAG, new_tag_short=$NEW_TAG_SHORT, name=$NAME" | ||
|
||
docker: | ||
name: Build and push Docker image | ||
runs-on: ubuntu-latest | ||
needs: | ||
- info | ||
if: needs.info.outputs.name || needs.info.outputs.new_tag | ||
env: | ||
IMAGE_NAME: reearth/reearth-cms-copier | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Get options | ||
id: options | ||
env: | ||
TAG: ${{ needs.info.outputs.new_tag_short }} | ||
NAME: ${{ needs.info.outputs.name }} | ||
SHA: ${{ needs.info.outputs.sha_short }} | ||
run: | | ||
if [[ -n $TAG ]]; then | ||
PLATFORMS=linux/amd64,linux/arm64 | ||
VERSION=$TAG | ||
TAGS=$IMAGE_NAME:$TAG | ||
if [[ ! $TAG =~ '-' ]]; then | ||
TAGS+=,${IMAGE_NAME}:${TAG%.*} | ||
TAGS+=,${IMAGE_NAME}:${TAG%%.*} | ||
TAGS+=,${IMAGE_NAME}:latest | ||
fi | ||
else | ||
PLATFORMS=linux/amd64 | ||
VERSION=$SHA | ||
TAGS=$IMAGE_NAME:$NAME | ||
fi | ||
echo "platforms=$PLATFORMS" >> "$GITHUB_OUTPUT" | ||
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
echo "tags=$TAGS" >> "$GITHUB_OUTPUT" | ||
- name: Build and push docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./worker | ||
file: ./worker/copier.Dockerfile | ||
platforms: ${{ steps.options.outputs.platforms }} | ||
push: true | ||
build-args: VERSION=${{ steps.options.outputs.version }} | ||
tags: ${{ steps.options.outputs.tags }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Web E2E test | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 3 * * 1-5" | ||
jobs: | ||
e2e: | ||
name: playwright | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: web | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: yarn | ||
cache-dependency-path: "**/yarn.lock" | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Get installed Playwright version | ||
id: playwright-version | ||
run: echo "version=$( node -e "console.log(require('@playwright/test/package.json').version)" )" >> $GITHUB_OUTPUT | ||
- name: Cache Playwright browsers | ||
id: playwright-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/ms-playwright | ||
key: "${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}" | ||
restore-keys: | | ||
${{ runner.os }}-playwright- | ||
- name: Install Playwright system dependencies and browsers | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
run: yarn playwright install --with-deps chromium | ||
- name: Install Playwright system dependencies | ||
if: steps.playwright-cache.outputs.cache-hit == 'true' | ||
run: yarn playwright install-deps chromium | ||
- name: Run Playwright tests | ||
run: yarn e2e | ||
env: | ||
REEARTH_CMS_API: https://api.cms.test.reearth.dev/api | ||
REEARTH_CMS_E2E_BASEURL: https://cms.test.reearth.dev | ||
REEARTH_CMS_E2E_USERNAME: ${{ secrets.REEARTH_WEB_E2E_USERNAME }} | ||
REEARTH_CMS_E2E_PASSWORD: ${{ secrets.REEARTH_WEB_E2E_PASSWORD }} | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: test-results | ||
path: web/test-results/ | ||
retention-days: 7 |
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
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
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
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
Oops, something went wrong.