Skip to content

🏎 Test & Publish Adapter #10

🏎 Test & Publish Adapter

🏎 Test & Publish Adapter #10

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@v4
- 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-integration:
runs-on: ubuntu-latest
strategy:
matrix:
deno-version: [1.x]
redis-version: [7]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- 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 Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
- name: ⚑ Run Integration Tests
run: |
deno task test:integration
env:
CI: true
REDIS_URL: http://127.0.0.1:6379
publish:
# Releases are performed via a workflow dispatch
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [test, test-integration]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
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 }}