fix: Add SameSite attribute to the cookie (#728) #2020
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 | |
on: | |
push: | |
branches: [main, develop, dependabot/develop] | |
pull_request: | |
branches: [main, develop, dependabot/develop] | |
env: | |
# Note: The schema is dev (rather than develop) because that is the branch name on the API repo | |
# If this is a push to main or a pull request targeting main, use the main schema | |
SCHEMA_VERSION: "${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'pull_request' && github.base_ref == 'main' && 'main' || 'dev' }}" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout π | |
uses: actions/checkout@master | |
- name: Setup node env π | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
check-latest: true | |
- name: Get yarn cache directory path π | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache node_modules π¦ | |
uses: actions/cache@v4 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies π¨π»βπ» | |
run: yarn | |
- name: Load GraphQL πΈ | |
run: API_BASE=https://staging.api.uobtheatre.com yarn codegen | |
- name: Run tests π§ͺ | |
run: yarn test:unit --coverage | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout π | |
uses: actions/checkout@master | |
- name: Setup node env π | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
check-latest: true | |
- name: Get yarn cache directory path π | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache node_modules π¦ | |
uses: actions/cache@v4 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies π¨π»βπ» | |
run: yarn | |
- name: Load GraphQL Codegen πΈ | |
run: GQL_SCHEMA=https://raw.githubusercontent.com/BristolSTA/uobtheatre-api/${{ env.SCHEMA_VERSION }}/schema.graphql yarn codegen | |
- name: Run linter π | |
run: yarn lint:tsc && yarn lint:js | |
- name: Check Prettier β¨ | |
run: yarn prettier:check | |
e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout π | |
uses: actions/checkout@master | |
- name: Copy Testing Env β | |
run: cp .env.test .env | |
- name: Setup node env π | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
check-latest: true | |
- name: Get yarn cache directory path π | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache node_modules π¦ | |
uses: actions/cache@v4 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Yarn Dependencies π¨π»βπ» | |
run: yarn | |
- name: Authenticate with GitHub Container Registry π | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Copy Dev Container Env π | |
run: cp .devcontainer/.env.example .devcontainer/.env | |
- name: Start Real API β | |
run: docker compose -f .devcontainer/docker-compose.yml up -d postgres uobtheatre-api | |
- name: Wait for API to boot π« | |
run: node .github/scripts/waiton-api.js http://localhost:9000 | |
- name: Load GraphQL Codegen πΈ | |
run: API_BASE=http://localhost:9000 yarn codegen | |
- name: Run End-to-End Tests π§ͺ | |
uses: cypress-io/github-action@v6 | |
timeout-minutes: 7 | |
with: | |
start: yarn beforetest:e2e:ci | |
wait-on: 'http://localhost:3000' |