Skip to content

CI

CI #61

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
reserve-ci-instance:
runs-on: ubuntu-latest
container: alpine:3.20
outputs:
mpkit-url: ${{ steps.reserve.outputs.mpkit-url }}
report-path: ${{ steps.reserve.outputs.report-path }}
steps:
- name: Get ci-instance-url
id: reserve
uses: Platform-OS/ci-repository-reserve-instance-url@mask-token
with:
repository-url: ${{ vars.CI_REPOSITORY_URL }}
method: reserve
pos-ci-repo-token: ${{ secrets.POS_CI_REPO_ACCESS_TOKEN }}
deploy:
needs: ["reserve-ci-instance"]
runs-on: ubuntu-latest
container: platformos/playwright:5.1.5-1.47.2
env:
MPKIT_EMAIL: ${{ secrets.MPKIT_EMAIL }}
MPKIT_URL: ${{ needs.reserve-ci-instance.outputs.mpkit-url }}
POS_CI_REPO_ACCESS_TOKEN: ${{ secrets.POS_CI_REPO_ACCESS_TOKEN }}
CI: true
steps:
- name: Get MPKIT token
id: get-token
uses: Platform-OS/ci-repository-reserve-instance-url@mask-token
with:
method: get-token
repository-url: ${{ vars.CI_REPOSITORY_URL }}
pos-ci-repo-token: ${{ secrets.POS_CI_REPO_ACCESS_TOKEN }}
- name: Checkout your repository
uses: actions/checkout@v4
- name: Deploy your project to the reserved instance
env:
MPKIT_TOKEN: ${{ steps.get-token.outputs.mpkit-token }}
shell: sh
run: |
set -eu
mkdir -p /tmp/allow-data-clean/app
cp app/config.yml /tmp/allow-data-clean/app
cd /tmp/allow-data-clean
echo 'allow_data_clean: true' >> app/config.yml
pos-cli deploy -p
cd -
rm -rf /tmp/allow-data-clean
export CONFIRMATION_TEXT=$(echo "$MPKIT_URL" | sed 's|https://||')
pos-cli data clean --auto-confirm --include-schema
pos-cli deploy
tests:
needs: ["reserve-ci-instance", "deploy"]
runs-on: ubuntu-latest
container: platformos/playwright:5.1.5-1.47.2
env:
MPKIT_EMAIL: ${{ secrets.MPKIT_EMAIL }}
MPKIT_URL: ${{ needs.reserve-ci-instance.outputs.mpkit-url }}
REPORT_PATH: ${{ needs.reserve-ci-instance.outputs.report-path }}
UPLOAD_HOST: ${{ vars.TEST_REPORTS_UPLOAD_HOST }}
CI: true
steps:
- name: Checkout your repository
uses: actions/checkout@v4
- name: Run e2e tests
shell: sh
run: |
set -eu
npm run test
env:
HOME: /root
cleanup:
if: ${{ always() }}
needs: ["reserve-ci-instance", "deploy", "tests"]
runs-on: ubuntu-latest
container: alpine:3.20
steps:
- name: release ci-instance-url
uses: Platform-OS/ci-repository-reserve-instance-url@mask-token
with:
method: release
repository-url: ${{ vars.CI_REPOSITORY_URL }}
pos-ci-repo-token: ${{ secrets.POS_CI_REPO_ACCESS_TOKEN }}
# deploy-qa: # Deploy to QA on push to master and after tests pass
# if: ${{ github.ref_name == 'master' }}
# needs: ["tests"] # Don't run this job until the tests job is done and successful
# runs-on: ubuntu-latest
# env:
# MPKIT_EMAIL: ${{ secrets.MPKIT_EMAIL }}
# MPKIT_TOKEN: ${{ secrets.MPKIT_TOKEN }}
# MPKIT_URL: ${{ QA-HOST-URL }}
# POS_CI_REPO_ACCESS_TOKEN: ${{ secrets.POS_CI_REPO_ACCESS_TOKEN }}
# CI: true
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
#
# - name: Build
# shell: sh
# run: |
# set -eu
# npm ci
# npm run build
#
# - name: Deploy
# shell: sh
# run: |
# set -eu
# pos-cli deploy