Prepare 0.181 release #7985
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: Java CI | |
on: [push] | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} | |
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- run: yarn install | |
# Steps being performed here: | |
# npx jest --listTests: List all of the available tests. | |
# shuf: Shuffle the list randomly. | |
# awk NF: Remove additional empty lines. | |
# jq -R .: Convert each line to a JSON string. | |
# jq -s .: Combine them all into a single JSON array. | |
# jq -cM ...: This part will split it into 8 groups. The last group will probably not have enough to fill the full group. | |
- id: set-test-chunks | |
name: split tests into chunks | |
run: echo "test-chunks=$(npx jest --listTests | shuf | awk NF | jq -R . | jq -s . | jq -cM '[_nwise(length / 7 | floor)]')" >> $GITHUB_OUTPUT | |
- id: set-test-chunk-ids | |
name: Set Chunk IDs | |
run: echo "test-chunk-ids=$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')" >> $GITHUB_OUTPUT | |
env: | |
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} | |
test-chunk: | |
runs-on: ubuntu-latest | |
name: run tests (Chunk ${{ matrix.chunk }}) | |
needs: | |
- setup | |
strategy: | |
fail-fast: false | |
matrix: | |
chunk: ${{ fromJson(needs.setup.outputs['test-chunk-ids']) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- run: yarn install | |
- name: Run all tests in chunk | |
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs npx jest | |
env: | |
CHUNKS: ${{ needs.setup.outputs['test-chunks'] }} | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Install | |
run: | | |
yarn install | |
- name: Build UI project | |
run: | | |
yarn workspace dina-ui build | |
- name: Extract Version | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
jq -r ".version" packages/dina-ui/package.json > version.txt | |
- name: Store artifacts | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: | | |
packages/dina-ui/prod.Caddyfile | |
packages/dina-ui/out | |
Dockerfile | |
version.txt | |
push: | |
name: Build Docker Image and Push to DockerHub | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
steps: | |
- name: Download artifacts from build job | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: Set VERSION_TAG ENV variable | |
run: | | |
echo "VERSION_TAG=$(cat version.txt)" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Image and Push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: aafcbicoe/dina-ui:${{ env.VERSION_TAG }} | |
provenance: false | |
build-docs: | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Building ascii docs | |
run: | | |
yarn install | |
yarn docs | |
- name: Copy images for UI dev docs | |
run: | | |
mkdir generated-docs/images | |
cp -r ./docs/images generated-docs | |
- name: Deploy GitHub Pages (only on master branch) | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: generated-docs | |