Skip to main content
Module

x/udibo_react_app/.github/workflows/ci.yml

A React Framework for Deno that makes it easy to create highly interactive apps that have server side rendering with file based routing for both your UI and API.
Go to Latest
File
name: CIon: workflow_call: inputs: working-directory: required: false type: string default: './' app-directory: required: false type: string lint-args: required: false type: string default: '' fmt-args: required: false type: string default: '' test-args: required: false type: string default: '' secrets: CODECOV_TOKEN: required: falsejobs: variables: name: Get variables runs-on: ubuntu-latest outputs: CODECOV_TOKEN: ${{ steps.secrets.outputs.CODECOV_TOKEN }} DENO_DIR: ${{ steps.deno_dir.outputs.DENO_DIR }} steps: - id: secrets name: Get secrets if: env.CODECOV_TOKEN != '' run: | if ["${{ secrets.CODECOV_TOKEN }}" != ""]; then echo "CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }}" >> $GITHUB_OUTPUT - id: deno_dir name: Get cache directory run: | echo "DENO_DIR=${{ runner.temp }}/deno_dir" >> $GITHUB_OUTPUT lint: name: Lint runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@v3.3.0 - name: Setup deno uses: denoland/setup-deno@main with: deno-version: v1.x - name: Lint source files working-directory: ${{ inputs.working-directory }} run: deno lint ${{ inputs.lint-args }} format: name: Check formatting runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@v3.3.0 - name: Setup deno uses: denoland/setup-deno@main with: deno-version: v1.x - name: Check formatting working-directory: ${{ inputs.working-directory }} run: deno fmt --check ${{ inputs.fmt-args }} test: name: Test ${{ matrix.os }} needs: [variables, lint, format] runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest] fail-fast: true env: APP_ENV: test DENO_DIR: ${{ needs.variables.outputs.DENO_DIR }} steps: - name: Clone repository uses: actions/checkout@v3.3.0 - name: Setup deno uses: denoland/setup-deno@main with: deno-version: v1.x - name: Cache Deno dependencies uses: actions/cache@v3.2.3 with: path: ${{ env.DENO_DIR }} key: deno-dir-${{ hashFiles('deno.lock') }} restore-keys: deno-dir- - name: Build working-directory: ${{ inputs.app-directory || inputs.working-directory }} run: deno task build - name: Run tests working-directory: ${{ inputs.working-directory }} if: | matrix.os != 'ubuntu-latest' || !needs.variables.outputs.CODECOV_TOKEN run: deno test ${{ inputs.test-args }} . - name: Run tests and collect coverage working-directory: ${{ inputs.working-directory }} if: | matrix.os == 'ubuntu-latest' && needs.variables.outputs.CODECOV_TOKEN run: deno test --coverage=cov ${{ inputs.test-args }} . - name: Generate coverage working-directory: ${{ inputs.working-directory }} if: | matrix.os == 'ubuntu-latest' && needs.variables.outputs.CODECOV_TOKEN run: deno coverage --lcov=cov ${{ inputs.test-args }} > cov.lcov - name: Upload coverage uses: codecov/codecov-action@v3 with: files: ${{ inputs.working-directory }}/cov.lcov token: ${{ needs.variables.outputs.CODECOV_TOKEN }} fail_ci_if_error: true if: | matrix.os == 'ubuntu-latest' && needs.variables.outputs.CODECOV_TOKEN