[ENHANCEMENT] [MER-3987] [MER-4018] support submitPerPart on math keyboard questions #6825
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 & Test PR | |
on: | |
pull_request: | |
branches: | |
- master | |
- hotfix-* | |
- prerelease-* | |
- nextgen-ux | |
jobs: | |
elixir-build-test: | |
name: Elixir build and test | |
runs-on: ubuntu-latest | |
env: | |
MIX_ENV: test | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v3 | |
- name: 🔧 Configure | |
run: | | |
cp postgres.example.env postgres.env | |
cp oli.example.env oli.env | |
- name: 🗄 Start test database | |
run: docker compose up -d postgres | |
- name: 💾 Restore the deps cache | |
id: mix-deps-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: 💾 Restore the Node.js cache | |
id: yarn-cache | |
uses: actions/cache@v3 | |
with: | |
path: assets/node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('assets/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: 🧪 Setup elixir | |
uses: erlef/setup-elixir@v1 | |
with: | |
elixir-version: 1.17.2 # Define the elixir version [required] | |
otp-version: 27.0.1 # Define the OTP version [required] | |
- name: ⬇️ Install elixir dependencies | |
run: mix deps.get | |
- name: 🔨 Build dependencies | |
run: mix deps.compile | |
- name: 🧹 Clean on master | |
if: github.ref == 'refs/heads/master' | |
run: set -a;source oli.env && mix clean | |
- name: 🔨 Build project | |
run: set -a; source oli.env && mix compile --warnings-as-errors | |
- name: 📋 Check Formatting | |
run: mix format --check-formatted | |
- name: ▶️ Run unit tests | |
run: set -a;source oli.env && MIX_ENV=test mix ecto.reset && mix test | |
- name: 📦 Install node_module dependencies | |
run: yarn --cwd assets --frozen-lockfile | |
check-simon-token: | |
name: Check simon-bot access token | |
runs-on: ubuntu-latest | |
outputs: | |
available: ${{ steps.check_token.outputs.available }} | |
steps: | |
- name: Check whether SIMON_BOT_PERSONAL_ACCESS_TOKEN is set | |
id: check_token | |
run: echo "available=$(if [ "${{ secrets.SIMON_BOT_PERSONAL_ACCESS_TOKEN }}" != "" ] ; then echo true ; else echo false ; fi)" >> $GITHUB_OUTPUT | |
auto-format: | |
name: Auto format and lint | |
runs-on: ubuntu-latest | |
needs: check-simon-token | |
if: needs.check-simon-token.outputs.available == 'true' | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
token: ${{ secrets.SIMON_BOT_PERSONAL_ACCESS_TOKEN }} | |
- name: 🔧 Configure | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16.14.2" | |
- name: 🧪 Setup elixir | |
uses: erlef/setup-elixir@v1 | |
with: | |
elixir-version: 1.17.2 # Define the elixir version [required] | |
otp-version: 27.0.1 # Define the OTP version [required] | |
- name: ⬇️ Install elixir dependencies | |
run: mix deps.get | |
- name: 📦 Install node_module dependencies | |
run: yarn --cwd assets --frozen-lockfile | |
- name: 🤖 Auto format Elixir | |
run: mix format | |
- name: 🤖 Auto format Typescript | |
run: yarn --cwd assets run format | |
- name: ✅ Commit | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: Auto format | |
committer_name: Simon Bot (GitHub Actions) | |
committer_email: [email protected] | |
ts-build-test: | |
name: TypeScript build and test | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: 🔧 Configure | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16.14.2" | |
- name: 🧪 Setup elixir | |
uses: erlef/setup-elixir@v1 | |
with: | |
elixir-version: 1.17.2 # Define the elixir version [required] | |
otp-version: 27.0.1 # Define the OTP version [required] | |
- name: ⬇️ Install elixir dependencies | |
run: mix deps.get | |
- name: 📦 Install node_module dependencies | |
run: yarn --cwd assets --frozen-lockfile | |
- name: 🧹 Lint | |
run: yarn --cwd assets run prettier && yarn --cwd assets run lint | |
- name: 👁️ Typecheck | |
run: yarn --cwd assets run check-types | |
- name: 🔨 Build | |
run: yarn --cwd assets run deploy | |
- name: ⚙️ Test | |
run: yarn --cwd assets run test |