remove civicrm configs elifesciences/issues#9017 #38
This file contains 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: CI Pipeline | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
push: | |
branches: | |
- master | |
jobs: | |
generate-date: | |
runs-on: ubuntu-latest | |
outputs: | |
date: ${{ steps.date.outputs.date }} | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "date=$(date --utc +%Y%m%d.%H%M)" >> $GITHUB_OUTPUT | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
test_script: ["phpcs", "phpunit", "behat"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bring up test stack | |
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d | |
- name: Debug bring up test stack | |
if: failure() | |
run: docker compose logs | |
- name: Run tests | |
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml run ci ./.ci/${{ matrix.test_script }} | |
- name: Take down test stack | |
if: always() | |
run: docker compose down | |
build-and-push: | |
runs-on: ubuntu-latest | |
needs: [generate-date, tests] | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' | |
env: | |
CONTAINER_REPO: ghcr.io/elifesciences/journal | |
CONTAINER_TAG: ${{ github.head_ref || github.ref_name }}-${{ github.sha }}-${{ needs.generate-date.outputs.date }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build container image | |
run: | | |
# Build all images | |
docker compose -f docker-compose.yml -f docker-compose.ci.yml build | |
# Build critical CSS | |
docker compose -f docker-compose.yml -f docker-compose.ci.yml run --name=journal_critical_css critical_css | |
docker cp journal_critical_css:build/critical-css/. build/critical-css/ | |
# Rebuild app now we have new CSS | |
docker compose -f docker-compose.yml -f docker-compose.ci.yml build app | |
# Retag and push | |
docker image tag elifesciences/journal:develop ${CONTAINER_REPO}:${CONTAINER_TAG} | |
- name: Push container image | |
run: docker push ${CONTAINER_REPO}:${CONTAINER_TAG} |