Catch local storage error. #9
This file contains hidden or 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: Backend CI | ||
| on: | ||
| workflow_call: | ||
| workflow_dispatch: | ||
| env: | ||
| IMAGE_NAME_PREFIX: ghcr.io/collective/volto-form-block | ||
| IMAGE_NAME_SUFFIX: backend | ||
| PYTHON_VERSION: "3.11" | ||
| defaults: | ||
| run: | ||
| working-directory: ./backend | ||
| jobs: | ||
| config: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| BASE_TAG: ${{ steps.vars.outputs.BASE_TAG }} | ||
| PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set Env Vars | ||
| id: vars | ||
| run: | | ||
| echo "PLONE_VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT | ||
| echo 'BASE_TAG=sha-'$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT | ||
| - name: Test vars | ||
| run: | | ||
| echo 'BASE_TAG=${{ steps.vars.outputs.BASE_TAG }}' | ||
| echo 'PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}' | ||
| code-quality: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - config | ||
| steps: | ||
| - name: Checkout codebase | ||
| uses: actions/checkout@v4 | ||
| - name: Install hatch | ||
| run: pipx install hatch | ||
| - name: Generate Constraints file | ||
| run: pipx run mxdev -c mx.ini | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
| cache: 'pip' | ||
| - name: "Install Environment" | ||
| run: hatch env create | ||
| - name: "Run checks" | ||
| run: hatch run lint | ||
| # test: | ||
| # runs-on: ubuntu-latest | ||
| # needs: | ||
| # - config | ||
| # steps: | ||
| # - name: Checkout codebase | ||
| # uses: actions/checkout@v4 | ||
| # - name: Install hatch | ||
| # run: pipx install hatch | ||
| # - name: Generate Constraints file | ||
| # run: pipx run mxdev -c mx.ini | ||
| # - uses: actions/setup-python@v5 | ||
| # with: | ||
| # python-version: ${{ env.PYTHON_VERSION }} | ||
| # cache: 'pip' | ||
| # - name: "Install Environment" | ||
| # run: hatch env create | ||
| # - name: "Test Codebase" | ||
| # run: hatch run test | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - config | ||
| - code-quality | ||
| - test | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Docker meta | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: | | ||
| ${{ env.IMAGE_NAME_PREFIX }}-${{ env.IMAGE_NAME_SUFFIX }} | ||
| labels: | | ||
| org.label-schema.docker.cmd=docker run -d -p 8080:8080 ${{ env.IMAGE_NAME_PREFIX }}-${{ env.IMAGE_NAME_SUFFIX }}:latest | ||
| flavor: | ||
| latest=false | ||
| tags: | | ||
| type=ref,event=branch | ||
| type=sha | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Build and push | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| platforms: linux/amd64 | ||
| context: backend | ||
| file: backend/Dockerfile | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| build-args: | | ||
| PLONE_VERSION=${{ needs.config.outputs.PLONE_VERSION }} | ||