forked from cncf/gitjobs
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (113 loc) · 3.51 KB
/
Copy pathe2e.yml
File metadata and controls
130 lines (113 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: End-to-end tests
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
e2e-tests:
runs-on: ubuntu-latest
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: gitjobs
PGPASSWORD: password
PGDATABASE: gitjobs
services:
postgres:
image: postgis/postgis:17-3.5
env:
POSTGRES_USER: gitjobs
POSTGRES_PASSWORD: password
POSTGRES_DB: gitjobs
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Rust environment
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.96.1
components: clippy, rustfmt
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('''**/Cargo.lock''') }}
- name: Set up Node.js environment
uses: actions/setup-node@v5
with:
node-version: '20'
- name: Initialize npm and install dependencies
run: |
npm init -y
npm install -D @playwright/test wait-on
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Install Tailwind CSS
run: |
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64
chmod +x tailwindcss-linux-x64
sudo mv tailwindcss-linux-x64 /usr/local/bin/tailwindcss
- name: Install tern
run: |
curl -sL https://github.com/jackc/tern/releases/download/v2.3.2/tern_2.3.2_linux_amd64.tar.gz -o tern.tar.gz
tar -xzf tern.tar.gz
sudo mv tern /usr/local/bin/
- name: Build server
run: cargo build --bin gitjobs-server
- name: Run database migrations
working-directory: database/migrations
env:
TERN_CONF: ${{ github.workspace }}/database/migrations/tern.conf
run: |
touch tern.conf
bash ./migrate.sh
- name: Insert test data
run: |
psql -f database/tests/data/e2e.sql
- name: Create Server Config File
run: |
cat <<EOF > config.testing.yml
db:
url: postgres://gitjobs:password@127.0.0.1:5432/gitjobs
email:
from_address: "test@example.com"
from_name: "Test"
smtp:
host: "127.0.0.1"
port: 2525
username: "test"
password: "password"
log:
format: "pretty"
server:
addr: "0.0.0.0:8080"
base_url: "http://127.0.0.1:8080"
cookie:
secure: false
login:
email: true
github: false
linuxfoundation: false
oauth2: {}
oidc: {}
EOF
- name: Start server and wait for it to be ready
uses: JarvusInnovations/background-action@v1
with:
run: ./target/debug/gitjobs-server --config-file config.testing.yml &
wait-on: http://localhost:8080
tail: true
log-output: "stdout,stderr"
log-output-if: true
- name: Run Playwright tests
run: npx playwright test --config tests/e2e/playwright.config.ts
env:
BASE_URL: http://127.0.0.1:8080