boydm / phoenix_integration

Lightweight server side integration test tools for Phoenix
Apache License 2.0
219 stars 26 forks source link

Github Actions Workflow #44

Open joselo opened 4 years ago

joselo commented 4 years ago

Sorry for ask this here, I'm not sure if I need anything else in my github action workflow, the whole integration tests fails.

I really like phoenix_integration for integration tests, I really would appreciate If anyone can give me a good approach to run it using github actions.

  1) test Try to login with invalid company (Web.CompanyLoginTest)
     apps/web/test/web/integration/company_login_test.exs:7
     ** (RuntimeError) Failed to find link "Mis ofertas", :get in the response
     Expected to find an anchor with text containing "Mis ofertas"
     code: |> follow_link("Mis ofertas")
     stacktrace:
       (phoenix_integration) lib/phoenix_integration/requests.ex:773: PhoenixIntegration.Requests.find_html_link/3
       (phoenix_integration) lib/phoenix_integration/requests.ex:193: PhoenixIntegration.Requests.click_link/3
       (phoenix_integration) lib/phoenix_integration/requests.ex:255: PhoenixIntegration.Requests.follow_link/3
       test/web/integration/company_login_test.exs:9: (test)
name: Continuous Integration
on: [push]

# This workflow will build and test a Phoenix application that uses
# PostgreSQL as a database. Will also cache dependencies and build
# artifacts to speed up the build.
jobs:
  test:
    env:
      MIX_ENV: test
      TEST_DATABASE_NAME: postgres
      TEST_DATABASE_USERNAME: postgres
      TEST_DATABASE_PASSWORD: postgres
      TEST_DATABASE_HOSTNAME: localhost
      TEST_DATABASE_PORT: 5432
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x]
        otp-version: [22.2]
        elixir-version: [1.9.4]

    services:
      db:
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: postgres
        image: postgres:11
        ports: ['5432:5432']
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v1.0.0
      - name: Recover dependency cache
        uses: actions/cache@v1
        id: deps_cache
        with:
          path: deps
          key: ${{ runner.OS }}-deps-${{ hashFiles('**/mix.lock') }}
          restore-keys: |
            ${{ runner.OS }}-deps-${{ env.cache-name }}-
            ${{ runner.OS }}-deps-
            ${{ runner.OS }}-

      - name: Copy config file
        run: cp config/env.local.exs.example config/env.local.exs

      - name: Recover build cache
        uses: actions/cache@v1
        with:
          path: _build
          key: ${{ runner.OS }}-build-${{ env.cache-name }}
          restore-keys: |
            ${{ runner.OS }}-build-
            ${{ runner.OS }}-

      - uses: actions/setup-elixir@v1.0.0
        with:
          otp-version: ${{ matrix.otp-version }}
          elixir-version: ${{ matrix.elixir-version }}

      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install Dependencies
        run: mix local.rebar --force
      - run: mix local.hex --force
      - run: mix deps.get
      - run: mix compile
      - run: mix ecto.migrate
      - run: npm install --prefix ./apps/web/assets
      - run: npm run deploy --prefix ./apps/web/assets

      - name: Run tests
        run: mix test --trace
marick commented 4 years ago

I'm sorry, I have no experience with Github actions.

boydm commented 3 years ago

Sorry. I don't either