Skip to content

Commit 801dc04

Browse files
committed
adding readme
1 parent 1a4d4bc commit 801dc04

1 file changed

Lines changed: 22 additions & 47 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,42 @@
1-
name: CI
1+
name: ci-tests
22

33
on:
44
push:
5-
branches: [ "**" ]
5+
branches: [ main ]
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
11+
defaults:
12+
run:
13+
working-directory: WorkLog-mobile # << run inside your app folder
14+
815
jobs:
9-
unit-tests:
10-
name: Unit tests (Jest)
16+
test:
1117
runs-on: ubuntu-latest
18+
environment: ci-integration # <- optional: only if you created this Environment
1219
steps:
1320
- name: Checkout
1421
uses: actions/checkout@v4
1522

1623
- name: Use Node.js 20
1724
uses: actions/setup-node@v4
1825
with:
19-
node-version: '20'
26+
node-version: 20
2027
cache: 'npm'
28+
cache-dependency-path: WorkLog-mobile/package-lock.json
2129

2230
- name: Install deps
2331
run: npm ci
2432

25-
- name: Run unit tests with coverage
26-
run: npm run test:unit
33+
# If you set secrets on the *Environment* named "ci-integration",
34+
# GitHub exposes them as ${{ secrets.* }} inside the job.
35+
- name: Inject CI secrets into env
36+
run: |
37+
echo "EXPO_PUBLIC_SUPABASE_URL=${{ secrets.CI_SUPABASE_URL }}" >> $GITHUB_ENV
38+
echo "EXPO_PUBLIC_SUPABASE_ANON_KEY=${{ secrets.CI_SUPABASE_ANON_KEY }}" >> $GITHUB_ENV
39+
echo "SUPABASE_SERVICE_ROLE_KEY=${{ secrets.CI_SUPABASE_SERVICE_ROLE_KEY }}" >> $GITHUB_ENV
2740
28-
- name: Upload coverage (unit)
29-
if: always()
30-
uses: actions/upload-artifact@v4
31-
with:
32-
name: coverage-unit
33-
path: coverage
34-
35-
integration-tests:
36-
name: Integration tests (Supabase)
37-
runs-on: ubuntu-latest
38-
environment: ci-integration # <= requires approval / restricts secrets
39-
if: |
40-
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main')) ||
41-
(github.event_name == 'pull_request' && contains(toJson(github.event.pull_request.labels), 'integration'))
42-
env:
43-
EXPO_PUBLIC_SUPABASE_URL: ${{ secrets.EXPO_PUBLIC_SUPABASE_URL }}
44-
EXPO_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.EXPO_PUBLIC_SUPABASE_ANON_KEY }}
45-
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
46-
steps:
47-
- name: Checkout
48-
uses: actions/checkout@v4
49-
50-
- name: Use Node.js 20
51-
uses: actions/setup-node@v4
52-
with:
53-
node-version: '20'
54-
cache: 'npm'
55-
56-
- name: Install deps
57-
run: npm ci
58-
59-
- name: Run integration tests
60-
run: npm run test:integration
61-
62-
- name: Upload coverage (integration)
63-
if: always()
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: coverage-integration
67-
path: coverage
41+
- name: Run tests with coverage
42+
run: npm run test:cov

0 commit comments

Comments
 (0)