generated from hyper63/adapter-template
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (122 loc) · 3.87 KB
/
test-and-publish.yml
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
131
132
133
134
135
136
137
138
139
140
name: 💾 Test & Publish Adapter
on:
pull_request:
branches:
- main
push:
branches:
- main
# Perform a release using a workflow dispatch
workflow_dispatch:
inputs:
# See https://github.com/hyper63/hyper-ci-bump#inputs for available inputs for the bump action
version:
description: the semver version to bump to
required: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
deno-version: [1.x]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: 🦕 Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}
- name: ⚡ Run Tests
run: |
deno task test
env:
CI: true
# Run the test suite against a Mongo Instance Self Hosted
# using the mongodb: protocol
#
# This is meant to represent a self-hosted instance of MongoDB
test-native-integration-self-hosted:
runs-on: ubuntu-latest
strategy:
matrix:
deno-version: [1.x]
mongodb-version: [7]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: 🦕 Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}
# Start a Mongo Instance in the local CI runner environment
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: ⚡ Run Native Integration Tests
run: |
deno task test:integration-native
env:
CI: true
MONGO_URL: mongodb://127.0.0.1:27017
# Run the test suite against a Mongo Instance Deployed on MongoDB Atlas
# a common hosting platform for MongoDB.
#
# The main distinction is that MongoDB Atlas uses the mongodb+srv: protocol
test-native-integration-atlas:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-test-native-integration-atlas
strategy:
matrix:
# See https://github.com/hyper63/hyper-adapter-mongodb/issues/53
deno-version: [1.45.4]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: 🦕 Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}
- name: ⚡ Run Native Integration Tests (Atlas 🧭)
run: |
deno task test:integration-native
env:
CI: true
MONGO_URL: ${{ secrets.INTEGRATION_ATLAS_MONGO_URL }}
publish:
# Releases are performed via a workflow dispatch
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [test, test-native-integration-self-hosted, test-native-integration-atlas]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 👀 Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
VER=`node --version`; echo "Node ver: $VER"
VER=`npm --version`; echo "npm ver: $VER"
- name: 🤓 Set Git User
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: ✊ Bump
id: bump
uses: hyper63/hyper-ci-bump@main
with:
bump-to: ${{ github.event.inputs.version }}
- name: ⬆️ Push
run: |
git push
git push --tags
- name: 🤖 Create Github Release
if: steps.bump.outputs.tag
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.bump.outputs.tag }}