next/store: "course" purchases #9784
This file contains hidden or 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: Test | |
# newer commits in the same PR abort running ones for the same workflow | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
required: false | |
default: false | |
env: | |
PGDATABASE: smc | |
PGUSER: smc | |
PGHOST: localhost | |
COCALC_MODE: "single-user" | |
jobs: | |
doclinks: | |
runs-on: ubuntu-latest | |
# install python3, package requests, and run the script ./src/scripts/check_doc_links.py | |
steps: | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
with: | |
detached: true | |
- uses: actions/checkout@v4 | |
- name: Install python3 requests | |
run: sudo apt-get install python3-requests | |
- name: Check doc links | |
run: cd src/scripts && python3 check_doc_urls.py || sleep 5 || python3 check_doc_urls.py | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:${{ matrix.pg-version}} | |
env: | |
POSTGRES_DB: smc | |
POSTGRES_USER: smc | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
strategy: | |
matrix: | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
node-version: | |
- "20" | |
pg-version: | |
- "13.12" | |
- "16" | |
steps: | |
# Enable tmate debugging of manually-triggered workflows if the input option was provided | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
with: | |
detached: true | |
- uses: actions/checkout@v4 | |
- name: Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data | |
# caching, etc., doesn't work without using "uses: pnpm/action-setup@v2", and that | |
# doesn't work, since it makes assumptions about the layout of the repo (e.g., where package.json is), | |
# which aren't true. | |
# cache: "pnpm" | |
# cache-dependency-path: "src/packages/pnpm-lock.yaml" | |
- name: Download and install Valkey | |
run: | | |
VALKEY_VERSION=8.1.2 | |
curl -LOq https://download.valkey.io/releases/valkey-${VALKEY_VERSION}-jammy-x86_64.tar.gz | |
tar -xzf valkey-${VALKEY_VERSION}-jammy-x86_64.tar.gz | |
sudo cp valkey-${VALKEY_VERSION}-jammy-x86_64/bin/valkey-server /usr/local/bin/ | |
- name: Set up Python venv and Jupyter kernel | |
run: | | |
python3 -m pip install --upgrade pip virtualenv | |
python3 -m virtualenv venv | |
source venv/bin/activate | |
pip install ipykernel | |
python -m ipykernel install --prefix=./jupyter-local --name python3-local --display-name "Python 3 (Local)" | |
- name: install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
run_install: false | |
- name: build | |
run: cd src && pnpm run make | |
# This runs all the tests with text output and jest-junit reporters to generate junit.xml reports | |
# That test-github-ci target runs workspaces.py for testing, which in turn runs the depchecks | |
- name: test | |
run: source venv/bin/activate && cd src && pnpm run test-github-ci --report | |
- name: upload test results | |
uses: actions/upload-artifact@v4 # upload test results | |
if: ${{ !cancelled() }} # run this step even if previous step failed | |
with: | |
name: "test-results-node-${{ matrix.node-version }}-pg-${{ matrix.pg-version }}" | |
path: 'src/packages/*/junit.xml' | |
report: | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: ${{ !cancelled() }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download all test artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "test-results-*" | |
merge-multiple: true | |
path: test-results/ | |
- name: Test Report | |
uses: dorny/test-reporter@v2 | |
with: | |
name: CoCalc Jest Tests | |
path: 'test-results/**/junit.xml' | |
reporter: jest-junit | |
use-actions-summary: 'true' | |
fail-on-error: false | |