1+ name : End to end tests
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ node-install :
11+ runs-on : ubuntu-latest
12+ strategy :
13+ matrix :
14+ node : [ 12, 14, 15, 16, 17, 18, 19, 20 ]
15+ defaults :
16+ run :
17+ working-directory : ./node
18+ steps :
19+ - uses : actions/checkout@v3
20+
21+ - name : Use Node.js
22+ uses : actions/setup-node@v3
23+ with :
24+ node-version : ${{ matrix.node }}
25+
26+ - name : Install sqlx-ts
27+ run : npm install
28+
29+ - name : Run sqlx-ts version
30+ run : ./sqlx-ts --version
31+
32+ - name : run sqlx-ts help
33+ run : ./sqlx-ts --help
34+
35+ e2e :
36+ runs-on : ubuntu-latest
37+ strategy :
38+ matrix :
39+ db :
40+ - mysql : 8
41+ - mysql : 5.7
42+ - mysql : 5.6
43+ - postgres : 16
44+ - postgres : 15
45+ - postgres : 14
46+ - postgres : 13
47+ - postgres : 12
48+
49+ steps :
50+ - name : Checkout sources
51+ uses : actions/checkout@v3
52+
53+ - name : Install stable toolchain
54+ uses : actions-rs/toolchain@v1
55+ with :
56+ profile : minimal
57+ toolchain : stable
58+ override : true
59+
60+ - run : rustup toolchain install stable --profile minimal
61+
62+ - uses : Swatinem/rust-cache@v2
63+ with :
64+ # To only cache runs from `master`:
65+ save-if : ${{ github.ref == 'refs/heads/master' }}
66+ # Specifies what to use as the backend providing cache
67+ # Can be set to either "github" or "buildjet"
68+ # default: "github"
69+ cache-provider : " github"
70+
71+
72+ - name : build docker-compose services for integration tests
73+ run : docker compose -f docker-compose.yml up -d
74+ env :
75+ MYSQL_VERSION : ${{ matrix.db.mysql }}
76+ PG_VERSION : ${{ matrix.db.postgres }}
77+ MYSQL_MIGRATION_FILE : " ${{ matrix.db.mysql == '5.6' && 'mysql_migration_5_6.sql' || 'mysql_migration.sql' }}"
78+
79+ - uses : GuillaumeFalourd/wait-sleep-action@v1
80+ with :
81+ time : ' 10' # for 10 seconds
82+
83+ - name : Check the docker-compose services running
84+ run : docker ps -a
85+
86+ - name : build
87+ run : cargo build
88+
89+ - name : Add failure.ts test file
90+ run : |
91+ mkdir -p tests/staging
92+ cat << 'EOF' > tests/staging/failure.ts
93+ import { sql } from 'sqlx-ts'
94+
95+ const selectSql4 = sql`
96+ SELECT itemz.*
97+ FROM items;
98+ `
99+ EOF
100+
101+ - name : Run failure test
102+ run : |
103+ set +e
104+ ./target/debug/sqlx-ts --config=.sqlxrc.sample.json tests/staging
105+ if [ $? -eq 0 ]; then
106+ echo "Expected failure, but command succeeded."
107+ exit 1
108+ fi
109+ echo "Command failed as expected."
110+
111+ rm -f tests/staging/failure.ts
112+
113+ - name : Add happy.ts test file
114+ run : |
115+ mkdir -p tests/staging
116+ cat << 'EOF' > tests/staging/happy.ts
117+ import { sql } from 'sqlx-ts'
118+
119+ const selectSql4 = sql`
120+ SELECT items.*
121+ FROM items;
122+ `
123+ EOF
124+
125+ - name : Run happy test
126+ run : ./target/debug/sqlx-ts --config=.sqlxrc.sample.json tests/staging
0 commit comments