From 2d6924449782e5a5735323c05fc6242d791d787b Mon Sep 17 00:00:00 2001 From: Ravan Scafi Date: Sun, 5 Feb 2023 12:42:04 +0100 Subject: [PATCH 1/4] Create PR workflow using GitHub Actions --- .github/workflows/pull-request.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..59b41d55 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,23 @@ +on: [pull_request] + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build docker image + run: docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) web + + - name: Install composer dependencies + run: docker-compose run --rm -T web composer install --no-interaction --no-progress + + - name: Tests + run: docker-compose run --rm -T web ./vendor/bin/phpunit tests/ + + - name: Install node dependencies + run: docker-compose run --rm -T web yarn install + + - name: Build + run: docker-compose run --rm -T web yarn production From a35d8022dd5058f251859fb25cac9ca56974334f Mon Sep 17 00:00:00 2001 From: Ravan Scafi Date: Sun, 5 Feb 2023 13:01:23 +0100 Subject: [PATCH 2/4] Attempt to add PR preview --- .github/workflows/pull-request.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 59b41d55..2307fb35 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,4 +1,16 @@ -on: [pull_request] +name: Tests and Preview + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +concurrency: + group: preview-${{ github.ref }} + cancel-in-progress: true jobs: tests: @@ -21,3 +33,8 @@ jobs: - name: Build run: docker-compose run --rm -T web yarn production + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./build_production/ \ No newline at end of file From ca18ec0fc465e82c4966a81de1201b7077eb5a89 Mon Sep 17 00:00:00 2001 From: Ravan Scafi Date: Sun, 5 Feb 2023 13:42:32 +0100 Subject: [PATCH 3/4] Add main branch deployment --- .github/workflows/deploy.yml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..355ed2ee --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +name: Deploy to Pages + +on: + push: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build docker image + run: docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) web + - name: Install composer dependencies + run: docker-compose run --rm -T web composer install --no-interaction --no-progress + - name: Tests + run: docker-compose run --rm -T web ./vendor/bin/phpunit tests/ + - name: Install node dependencies + run: docker-compose run --rm -T web yarn install + - name: Build + run: docker-compose run --rm -T web yarn production + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: './build_production/' + branch: gh-pages + clean-exclude: pr-preview \ No newline at end of file From 1d385eb17d8f83b21067fdc948142779317dde15 Mon Sep 17 00:00:00 2001 From: Ravan Scafi Date: Sun, 5 Feb 2023 13:43:17 +0100 Subject: [PATCH 4/4] Add new line --- .github/workflows/deploy.yml | 2 +- .github/workflows/pull-request.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 355ed2ee..88189387 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,4 +37,4 @@ jobs: with: folder: './build_production/' branch: gh-pages - clean-exclude: pr-preview \ No newline at end of file + clean-exclude: pr-preview diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2307fb35..f55582cc 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -37,4 +37,4 @@ jobs: - name: Deploy preview uses: rossjrw/pr-preview-action@v1 with: - source-dir: ./build_production/ \ No newline at end of file + source-dir: ./build_production/