How to set GitHub Action to fullfil these conditions?

I spent many hours trying to solve this issue. I’m not that skilled with CI/CD so I’m looking for some help. AI was also not helpful.

What I need from the workflow:

  • Run playwright test
  • Use sharding ( https://playwright.dev/docs/test-sharding )
  • Have Neo4j service
  • Load initial data into Neo4j database
  • Use container mcr.microsoft.com/playwright:v1.44.0-jammy

What are the problems I hit on the road:

  • To load data into Neo4j I’ve set custom name for service with options. Afterwards I can have step which runs docker exec and load required dataset and import it with cypher-shell tool. But with custom name of service I can’t connect to this database from my tool I’m testing. I don’t know why. I tried neo4j and also neo4j_service. You can see that with env variable DB_HOSTNAME.
  • Other option was to download cypher-shell separately and don’t use the one from service. I couldn’t deal with getting the latest version. So it would require to update workflow file everytime there is a new version.
  • When I used workflow strategy matrix to use sharding I have problem with loading dataset into Neo4j, because it does it multiple times. Because it is a step. I tried to condition that step but somehow it didn’t work. Maybe it was just related to problem with custom service name.
  • When I used workflow container for playwright, for running my playwright tests, which is suggested, I have problem because it doesn’t contain docker to run cypher-shell from the service.
  • I was thinking, maybe dockerfile to create neo4j instance with data will be the way. But I’m not sure if I have dockerfile in repository, if I can use it as service in workflow.

This is currently state of my yaml file:

name: Playwright e2e tests

on:
  pull_request:
    branches: [master]
  workflow_run:
    workflows: ['Prettier and linter']
    types:
      - completed

concurrency:
  group: ${{ github.head_ref }}
  cancel-in-progress: true

jobs:
  neo4j-read:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    #    container:
    #      image: mcr.microsoft.com/playwright:v1.44.0-jammy
    services:
      neo4j:
        image: neo4j:latest
        env:
          NEO4J_AUTH: neo4j/nothing123
        ports:
          - 7687:7687
          - 7474:7474
        options: >-
          --name "neo4j_service"
          --health-cmd "wget http://localhost:7474 || exit 1"
    #    strategy:
    #      fail-fast: false
    #      matrix:
    #        shardIndex: [1, 2, 3, 4, 5, 6, 7, 8]
    #        shardTotal: [8]

    steps:
      - name: Load movies dataset
        #        if: ${{ matrix.shardIndex == 1 }}
        run: |
          docker exec neo4j_service wget -O /tmp/movies.cypher https://raw.githubusercontent.com/neo4j-graph-examples/movies/main/scripts/movies.cypher
          docker exec neo4j_service cypher-shell -a bolt://localhost:7687 -u "neo4j" -p "nothing123" "MATCH (n) DETACH DELETE n"
          docker exec neo4j_service cypher-shell -a bolt://localhost:7687 -u "neo4j" -p "nothing123" -f /tmp/movies.cypher

      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup node
        uses: actions/setup-node@v4
        with:
          node-version: latest
      - name: Install dependencies
        run: npm ci
      #      - name: Playwright
      #        run: |
      #          npx playwright install --with-deps chromium
      #          npx playwright test --grep @neo4j-read --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob
      - name: Install Playwright Browsers
        run: npx playwright install --with-deps chromium
      - name: Run Playwright tests (neo4j-read)
        run: npx playwright test --grep @neo4j-read --reporter=html #--reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
        env:
          DB_HOSTNAME: 'bolt://neo4j:7687'
          DB_USERNAME: 'neo4j'
          DB_PASSWORD: 'nothing123'
      - uses: actions/upload-artifact@v4
        if: ${{ failure() }}
        with:
          name: playwright-report
          path: playwright-report/
          retention-days: 1
  #      - name: Upload blob report to GitHub Actions Artifacts
  #        if: ${{ failure() }}
  #        uses: actions/upload-artifact@v4
  #        with:
  #          name: blob-report-${{ matrix.shardIndex }}
  #          path: blob-report
  #          retention-days: 1

You can check more here: https://github.com/stefanak-michal/cyphergui/pull/88

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật