EQS-512: Alternatives to pdfkit pacakge #13076
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: PR | |
| on: | |
| pull_request: | |
| branches: | |
| - "main" | |
| - "branch-v*" | |
| - "bug-fix-*" | |
| - "feature-*" | |
| concurrency: | |
| group: '${{ github.head_ref }}' | |
| cancel-in-progress: true | |
| jobs: | |
| python-dependencies: | |
| permissions: | |
| contents: 'read' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - run: | | |
| echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| version: 2.1.2 | |
| virtualenvs-create: true | |
| - name: Install virtual environment | |
| run: | | |
| sudo apt-get install libsnappy-dev | |
| poetry install | |
| node-dependencies: | |
| permissions: | |
| contents: 'read' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version-file : ".nvmrc" | |
| - name: Install npm deps | |
| run: npm install | |
| lint: | |
| permissions: | |
| contents: 'read' | |
| needs: [python-dependencies, node-dependencies] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - run: | | |
| echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - name: Write app version | |
| run: printf "${{ github.event.pull_request.head.sha }}" > .application-version | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| version: 2.1.2 | |
| virtualenvs-create: true | |
| - name: Install virtual environment | |
| run: poetry install | |
| - name: Compile translations | |
| run: make translate | |
| - name: Running translation tests | |
| run: poetry run python -m scripts.extract_translation_templates --test | |
| - name: Python linting | |
| run: make lint-python | |
| - name: Install npm deps | |
| run: npm install | |
| - name: Functional tests spec lint | |
| run: ./scripts/lint_functional_test_specs.sh | |
| - name: Javascript linting | |
| run: make lint-js | |
| - name: HTML linting | |
| run: make lint-html | |
| test-unit: | |
| if: "!contains(github.event.pull_request.labels.*.name, 'tests not required')" | |
| permissions: | |
| contents: 'read' | |
| needs: python-dependencies | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - run: | | |
| echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| version: 2.1.2 | |
| virtualenvs-create: true | |
| - name: Install virtual environment | |
| run: poetry install | |
| - name: Install apt dependencies | |
| run: | | |
| sudo apt-get install libsnappy-dev libgconf-2-4 jq | |
| # Install wkthtmltopdf with patched Qt | |
| sudo apt-get install -y xfonts-base xfonts-75dpi | |
| wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb | |
| sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb | |
| - name: Write app version | |
| run: printf "${{ github.event.pull_request.head.sha }}" > .application-version | |
| - name: Install dotenv plugin | |
| run: poetry self add [email protected] | |
| - name: Load templates | |
| run: make load-design-system-templates | |
| - name: Compile translations | |
| run: make translate | |
| - name: Link env vars | |
| run: ln -sf .development.env .env | |
| - name: Running unit tests | |
| run: make test-unit | |
| validate-schemas: | |
| permissions: | |
| contents: 'read' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - run: | | |
| echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - name: Run validator | |
| run: ./scripts/run_validator.sh | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| version: 2.1.2 | |
| virtualenvs-create: true | |
| - name: Running schema validation | |
| run: make validate-test-schemas | |
| test-functional: | |
| if: "!contains(github.event.pull_request.labels.*.name, 'tests not required')" | |
| permissions: | |
| contents: 'read' | |
| needs: [python-dependencies, node-dependencies] | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 35 | |
| env: | |
| EQ_RUN_FUNCTIONAL_TESTS_HEADLESS: True | |
| # :TODO: Revisit & update when 2 instances can be used without adverse effects | |
| EQ_FUNCTIONAL_TEST_MAX_INSTANCES: 2 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - run: | | |
| echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 | |
| with: | |
| version: 2.1.2 | |
| virtualenvs-create: true | |
| - name: Install virtual environment | |
| run: poetry install | |
| - name: Install npm deps | |
| run: npm install | |
| - name: Docker compose | |
| run: docker compose --version && RUNNER_ENV_FILE=.functional-tests.env docker compose up --build -d | |
| - name: Functional tests | |
| run: make test-functional | |
| - name: Docker compose shutdown | |
| run: RUNNER_ENV_FILE=.functional-tests.env docker compose kill | |
| docker-push: | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - id: auth | |
| name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 | |
| with: | |
| token_format: 'access_token' | |
| workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ secrets.SERVICE_ACCOUNT }} | |
| - name: Set Tag and SHA | |
| run: | | |
| CLEAN_TAG=$(echo "${{ github.event.pull_request.head.ref }}" | tr / -) | |
| echo "TAG=$CLEAN_TAG" >> $GITHUB_ENV | |
| echo "SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | |
| - name: Write app version | |
| run: | | |
| echo "Writing SHA $SHA to .application_version" | |
| printf $SHA > .application-version | |
| - name: Build | |
| run: docker build -t ${{ secrets.GAR_LOCATION }}/${{ secrets.GAR_PROJECT_ID }}/docker-images/eq-questionnaire-runner:$TAG . | |
| - name: Push to GAR | |
| run: | | |
| gcloud auth configure-docker ${{ secrets.GAR_LOCATION }} | |
| echo "Pushing to GAR with tag $TAG" | |
| docker push ${{ secrets.GAR_LOCATION }}/${{ secrets.GAR_PROJECT_ID }}/docker-images/eq-questionnaire-runner:$TAG |