diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..afbc3c0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,80 @@ +name: Deploy + +# https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site + +on: + pull_request: + push: + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +defaults: + run: + shell: bash -l {0} + +jobs: + build: + runs-on: ubuntu-latest + env: + python_version: 3.12 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.python_version }} + cache: "pip" + cache-dependency-path: "**/requirements*.txt" + - name: Install Python packages + run: | + pip install \ + -r environment/configuration/requirements.txt \ + -r environment/configuration/requirements-dev.txt + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.24.5" + channel: "stable" + cache: true + - name: Configure project and generate build system + run: | + mkdir build + cd build + cmake -S .. -G Ninja + - name: Build web app + run: | + cmake --build build --target web_app + - name: Generate documentation + run: | + cmake --build build --target documentation + mv build/documentation/html build/source/package/pathways_app/build/web/doc + deploy: + if: github.repository == 'Deltares-research/PathwaysGenerator' && github.ref == 'refs/heads/main' + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Setup pages + id: pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build/source/package/pathways_app/build/web + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d067c2d..58a8446 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,11 +24,6 @@ jobs: - { os: "ubuntu-24.04", arch: x64 } - { os: "windows-2022", arch: x64 } steps: - - name: Setup Linux platform - if: ${{ startsWith(matrix.platform.os, 'ubuntu') }} - run: | - sudo apt-get update - sudo apt-get install libegl1 - name: Checkout uses: actions/checkout@v4 - name: Setup Python diff --git a/.github/workflows/web_app.yml b/.github/workflows/web_app.yml deleted file mode 100644 index c57bcea..0000000 --- a/.github/workflows/web_app.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Web app - -on: - pull_request: - push: - -jobs: - build: - name: ${{ matrix.platform.os }} / ${{ matrix.platform.arch }} / python-${{ matrix.python_version }} - runs-on: ${{ matrix.platform.os }} - timeout-minutes: 30 - defaults: - run: - shell: bash -l {0} - strategy: - fail-fast: false - matrix: - python_version: ["3.12"] - platform: - - { os: "ubuntu-24.04", arch: x64 } - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python_version }} - cache: "pip" - cache-dependency-path: "**/requirements*.txt" - - name: Install Python packages - run: | - pip install -r environment/configuration/requirements.txt -r environment/configuration/requirements-dev.txt - - - name: Setup Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.24.5" - channel: "stable" - cache: true - - name: Create web app - run: | - mkdir build - cd build - cmake -S .. -G Ninja - cmake --build . --target web_app