Skip to content

Ensure everything builds #584

Ensure everything builds

Ensure everything builds #584

name: Ensure everything builds
on:
push:
schedule:
- cron: "30 13 * * *"
jobs:
regenerate-data:
name: Regenerate data from cache
runs-on: ubuntu-latest
steps:
- name: Checkout active ref on run not triggered by a schedule
uses: actions/checkout@v3
if: ${{ github.event_name != 'schedule' }}
- name: Checkout 'master' on scheduled run
uses: actions/checkout@v3
if: ${{ github.event_name == 'schedule' }}
with:
ref: "master"
- uses: actions/setup-python@v4
with:
python-version: 3.11
- run: pip install requests
- working-directory: src/data
run: python ../scripts/musicAndQuestsFromCache.py write
- name: Print `git status`
run: "git status --porcelain"
- name: Ensure working directory clean (unless run triggered by a schedule)
if: ${{ github.event_name != 'schedule' }}
run: 'if [ ! -z "$(git status --porcelain)" ]; then echo "Status is unclean, and this is not a scheduled run."; git status --porcelain; exit 1; fi'
# Create pull request if this job was triggered by a schedule
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v5
if: ${{ github.event_name == 'schedule' }}
with:
base: master
title: "[auto] Rebuild data from the latest cache"
body: |
Rebuild data from the latest cache.
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
labels: |
automated-pull-request
- name: Check outputs
if: ${{ steps.create-pull-request.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.create-pull-request.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.create-pull-request.outputs.pull-request-url }}"
build-server:
name: Ensure server compiles
runs-on: ubuntu-latest
steps:
- name: Checkout active ref on run not triggered by a schedule
uses: actions/checkout@v3
if: ${{ github.event_name != 'schedule' }}
- name: Checkout 'master' on scheduled run
uses: actions/checkout@v3
if: ${{ github.event_name == 'schedule' }}
with:
ref: "master"
- uses: actions/setup-node@v3
with:
node-version: '22.x'
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
- name: Install dependencies
run: yarn
- name: Ensure server compiles
run: yarn run typeCheckAndDoNotRun