Skip to content

Commit 7683dd8

Browse files
Merge pull request #714 from freeCodeCamp/main
Create a new pull request by comparing changes across two branches
2 parents bc30d68 + 12026c3 commit 7683dd8

File tree

359 files changed

+19410
-1982
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

359 files changed

+19410
-1982
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 34 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/docker-ghcr.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Docker -- GHCR - Gitpod
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'docker/gitpod/*'
10+
11+
jobs:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
images:
22+
- gitpod
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3
30+
31+
- name: Log in to the GHCR
32+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Cache Docker layers
39+
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
40+
with:
41+
path: /tmp/.buildx-cache
42+
key: ${{ runner.os }}-buildx-${{ matrix.images }}-${{ github.sha }}
43+
restore-keys: |
44+
${{ runner.os }}-buildx-${{ matrix.images }}-
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
48+
with:
49+
context: ./docker/${{ matrix.images }}
50+
push: true
51+
tags: |
52+
ghcr.io/freecodecamp/${{ matrix.images }}:${{ github.sha }}
53+
ghcr.io/freecodecamp/${{ matrix.images }}:latest
54+
cache-from: type=local,src=/tmp/.buildx-cache
55+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
56+
57+
- name: Move cache
58+
run: |
59+
rm -rf /tmp/.buildx-cache
60+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.gitpod.Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

.gitpod.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
image:
2-
file: .gitpod.Dockerfile
1+
image: ghcr.io/freecodecamp/gitpod:latest
32
ports:
43
- port: 27017 # mongodb
54
onOpen: ignore
@@ -19,6 +18,14 @@ ports:
1918
visibility: public
2019
- port: 3300 # challenge editor client
2120
visibility: public
21+
- port: 8025 # MailHog
22+
visibility: public
23+
onOpen: ignore
24+
- port: 1025 # MailHog
25+
onOpen: ignore
26+
- port: 9323 # Playwright
27+
visibility: public
28+
onOpen: ignore
2229

2330
tasks:
2431
- before: |

api/src/routes/auth.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ describe('auth0 routes', () => {
6161
});
6262

6363
it('should be rate-limited', async () => {
64-
await Promise.all(
65-
[...Array(10).keys()].map(() => superGet('/mobile-login'))
66-
);
67-
64+
// Rather than spamming the endpoint, we can check the headers.
6865
const res = await superGet('/mobile-login');
69-
expect(res.status).toBe(429);
66+
// These headers are semi-official
67+
// https://www.ietf.org/archive/id/draft-polli-ratelimit-headers-02.html
68+
// so should not depend on the details of the rate-limiting library
69+
expect(res.headers['ratelimit-limit']).toBe('10');
70+
expect(res.headers['ratelimit-remaining']).toBe('9');
71+
72+
const res2 = await superGet('/mobile-login');
73+
expect(res2.headers['ratelimit-remaining']).toBe('8');
7074
});
7175

7276
it('should return 401 if the authorization header is invalid', async () => {

client/config/growthbook-features-default.json

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,37 @@
3030
"name": "tests the conversion rate of the new design comparing to the old one"
3131
}
3232
]
33+
},
34+
"show-modal-randomly": {
35+
"defaultValue": false,
36+
"rules": [
37+
{
38+
"coverage": 1,
39+
"hashAttribute": "id",
40+
"seed": "show-modal-randomly",
41+
"hashVersion": 2,
42+
"variations": [
43+
false,
44+
true
45+
],
46+
"weights": [
47+
0.5,
48+
0.5
49+
],
50+
"key": "show-modal-randomly",
51+
"meta": [
52+
{
53+
"key": "0",
54+
"name": "Control"
55+
},
56+
{
57+
"key": "1",
58+
"name": "Variation 1"
59+
}
60+
],
61+
"phase": "0",
62+
"name": "stg show modal randomly"
63+
}
64+
]
3365
}
34-
}
35-
66+
}

0 commit comments

Comments
 (0)