diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d47536d..bd37eac 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,67 +3,70 @@ concurrency: build on: push: - workflow_call: - inputs: - resolver: - required: false - type: string - coverage: - required: false - type: boolean - -env: - extra_stack_args: - extra_key_part: jobs: - test: + build: name: Build runs-on: ubuntu-latest steps: - - name: Set environment - if: ${{ inputs.resolver != '' }} - run: | - echo "extra_stack_args=--resolver ${{ inputs.resolver }}" >> $GITHUB_ENV - echo "extra_key_part=-resolver-${{ inputs.resolver }}" >> $GITHUB_ENV - - name: Checkout uses: actions/checkout@v4 - - name: Setup - uses: haskell-actions/setup@v2 - with: - enable-stack: true - - name: Cache dependencies uses: actions/cache@v4 with: path: ~/.stack - key: stack${{ env.extra_key_part }}-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('package.yaml', 'stack.yaml') }} + key: stack-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('package.yaml', 'stack.yaml') }} - name: Cache build artifacts - if: ${{ !inputs.coverage }} uses: actions/cache@v4 with: path: .stack-work - key: stack${{ env.extra_key_part}}-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('app/**', 'bench/**', 'src/**', 'test/**') }} + key: stack-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('app/**', 'bench/**', 'src/**', 'test/**') }} - - name: Build and test - if: ${{ !inputs.coverage }} - run: stack build --test --bench --no-run-benchmarks ${{ env.extra_stack_args }} + - name: Setup + uses: haskell-actions/setup@v2 + with: + enable-stack: true + + - name: Build + run: stack build --test --bench --haddock --no-run-benchmarks --no-haddock-deps - - name: Coverage - id: coverage - if: ${{ inputs.coverage }} + - id: paths + name: Get path + if: ${{ github.ref_name == 'pages' }} run: | - stack build --test --bench --no-run-benchmarks ${{ env.extra_stack_args }} --coverage - echo "coverage-report=$(stack path --local-hpc-root)" >> $GITHUB_OUTPUT + echo "docs=$(stack path --local-doc-root --no-haddock-deps)/ninetynine-$(stack query locals ninetynine version)" >> $GITHUB_OUTPUT - - name: Upload coverage report - if: ${{ inputs.coverage }} + - name: Upload documentation uses: actions/upload-artifact@v4 with: - name: coverage-report - path: ${{ steps.coverage.outputs.coverage-report }} + name: docs + path: ${{ steps.paths.outputs.docs }} + + deploy: + name: Deploy documentation + if: github.ref_name == 'pages' + needs: build + concurrency: deploy + runs-on: ubuntu-latest + + # Permissions needed to deploy to GitHub Pages. + permissions: + pages: write + id-token: write + + steps: + - uses: actions/download-artifact@v4 + with: + name: docs + path: _site + + - id: customize + run: ln -s _site/Problems.html _site/index.html + + - uses: actions/upload-pages-artifact@v3 + + - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index 3cd593b..0000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: Coverage - -on: - schedule: - - cron: '23 1 4 * *' - - workflow_dispatch: - -jobs: - coverage: - uses: ./.github/workflows/build.yaml - with: - coverage: true diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml deleted file mode 100644 index 7f038a9..0000000 --- a/.github/workflows/integration.yaml +++ /dev/null @@ -1,13 +0,0 @@ -name: Continuous Integration - -on: - schedule: - - cron: '38 7 26 * *' - - workflow_dispatch: - -jobs: - test: - uses: ./.github/workflows/build.yaml - with: - resolver: nightly