Better github actions tests (#13) #147
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: Build & Lint | |
on: [push] | |
jobs: | |
lint: | |
name: Lint & TS Check | |
runs-on: ubuntu-latest | |
container: | |
image: node:20 | |
env: | |
NEXT_PUBLIC_DRUPAL_BASE_URL: http://localhost | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Restore Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
.next | |
key: lint-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
lint-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }} | |
lint-${{ hashFiles('package.json') }}- | |
- name: Lint | |
run: | | |
yarn | |
yarn next telemetry disable | |
yarn lint | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
container: | |
image: pookmish/drupal8ci:latest | |
env: | |
BUILD_PAGES: 100 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_DATABASE: drupal | |
MYSQL_USER: drupal | |
MYSQL_PASSWORD: drupal | |
MYSQL_ROOT_PASSWORD: drupal | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
# - name: Install SSH key | |
# uses: shimataro/ssh-key-action@v2 | |
# with: | |
# key: ${{ secrets.SSH_KEY }} | |
# name: id_rsa | |
# known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
# if_key_exists: fail | |
- uses: actions/checkout@v4 | |
with: | |
repository: "SU-SWS/ace-stanfordlagunita" | |
- uses: actions/checkout@v4 | |
with: | |
path: frontend | |
- name: Restore Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
vendor | |
docroot/core | |
docroot/libraries | |
docroot/modules/contrib | |
frontend/node_modules | |
key: build-${{ hashFiles('blt/blt.yml') }}-${{ hashFiles('composer.json') }}-${{ hashFiles('composer.lock') }} | |
restore-keys: | | |
build-${{ hashFiles('blt/blt.yml') }}-${{ hashFiles('composer.json') }}-${{ hashFiles('composer.lock') }} | |
build-${{ hashFiles('blt/blt.yml') }}-${{ hashFiles('composer.json') }}- | |
build-${{ hashFiles('blt/blt.yml') }}- | |
- name: Sync Site | |
run: | | |
git config --system --add safe.directory '*' && | |
mysql -h mysql -P 3306 -u root -pdrupal -e 'SET GLOBAL max_allowed_packet=67108864;' && | |
rm -rf /var/www/html && | |
ln -snf $GITHUB_WORKSPACE /var/www/html && | |
mkdir -p docroot/sites/default/files && | |
chmod -R 777 docroot/sites/default/files/ && | |
rm -rf docroot/sites/summer/files && | |
ln -sL ../default/files/ docroot/sites/summer/files && | |
apachectl stop && apachectl start && | |
composer install -n && | |
blt drupal:install -n | |
- name: Build Frontend | |
run: | | |
cd $GITHUB_WORKSPACE/frontend && | |
cp .env.example .env.local && | |
sed -i -r "s|NEXT_PUBLIC_DRUPAL_BASE_URL.*|NEXT_PUBLIC_DRUPAL_BASE_URL=http://localhost|g" .env.local && | |
cd $GITHUB_WORKSPACE && | |
drush su-next-connect >> $GITHUB_WORKSPACE/frontend/.env.local && | |
cd $GITHUB_WORKSPACE/frontend && | |
yarn && | |
yarn build |