localgovdrupal / localgov_project

Project template for Drupal 10 sites built with the LocalGov Drupal distribution.
https://localgovdrupal.org
GNU General Public License v2.0
11 stars 10 forks source link

Create localgov-drupal-ci.yml #30

Closed finnlewis closed 3 years ago

finnlewis commented 3 years ago

@stephen-cox @Adnan-cds @ekes

Does anyone know why the name of the project on packagist uses a hyphen, but on github uses an underscore?

https://packagist.org/packages/localgovdrupal/localgov-project https://github.com/localgovdrupal/localgov_project

It looks like this descrepency is preventing the automated tests from building this project.

I thought better of changing it lest it make break all the things!

Adnan-cds commented 3 years ago

Does anyone know why the name of the project on packagist uses a hyphen, but on github uses an underscore?

Nah, sorry.

If you please replace ${{ github.repository }} on line 38 with localgovdrupal/localgov-project, it should still work.

finnlewis commented 3 years ago

Now we get this:

Run composer --working-dir=html require localgovdrupal/localgov-project:"dev-${GIT_BRANCH} as 1.0.x-dev"
  composer --working-dir=html require localgovdrupal/localgov-project:"dev-${GIT_BRANCH} as 1.0.x-dev"
  shell: /bin/bash -e {0}
  env:
    GIT_BRANCH: feature/29-add-ci
Root package 'localgovdrupal/localgov-project' cannot require itself in its composer.json
Error: Process completed with exit code 1.

Is this just impossible to automate tests on?

Any ideas @Adnan-cds @stephen-cox ?

Adnan-cds commented 3 years ago

Root package 'localgovdrupal/localgov-project' cannot require itself in its composer.json

Sorry, never seen this :(

Is this just impossible to automate tests on?

Could you please try the following:

name: Test LocalGov Drupal

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  test:

    runs-on: ubuntu-latest

    steps:
      - name: Clone drupal_container
        uses: actions/checkout@v2
        with:
          repository: localgovdrupal/drupal-container
          ref: master

      - name: Extract Git branch name outside of a pull request
        if: github.event_name != 'pull_request'
        run: echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

      - name: Extract Git branch name from a pull request
        if: github.event_name == 'pull_request'
        run: echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV

      - name: Create LocalGov Drupal project
        run: composer create-project --stability dev localgovdrupal/localgov-project:dev-${GIT_BRANCH} html

      - name: Start Docker environment
        run: docker-compose up -d

      - name: Run tests
        run: ./run-tests.sh
        shell: bash

This is totally untested. Sorry if this fails too.

stephen-cox commented 3 years ago

Thanks @Adnan-cds - I'll merge this and create a new PR for the 1.x branch