Skip to content

Commit

Permalink
chore: prepare continuous release
Browse files Browse the repository at this point in the history
  • Loading branch information
Chisomchima committed Feb 29, 2024
1 parent 83af876 commit 337fc73
Showing 1 changed file with 115 additions and 57 deletions.
172 changes: 115 additions & 57 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
name: 'dhis2: verify (app)'

# Requirements:
#
# - Org secrets:
# DHIS2_BOT_GITHUB_TOKEN
# DHIS2_BOT_APPHUB_TOKEN
# - Enable the 'jobs.e2e' section if applicable
# - Customize the properties if needed:
# 'jobs.release.steps.*.cwd'
# 'jobs.release.steps.*.build-dir'

on: push

concurrency:
Expand All @@ -22,20 +12,47 @@ env:
GIT_COMMITTER_EMAIL: '[email protected]'
D2_VERBOSE: true



jobs:
install:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

build:
runs-on: ubuntu-latest
needs: install
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/setup-node@v1
with:
node-version: 16
cache: 'yarn'
node-version: 16.x

- run: yarn install --frozen-lockfile
- uses: actions/cache@v2
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Build
run: yarn d2-app-scripts build
run: yarn build

- uses: actions/upload-artifact@v2
with:
Expand All @@ -47,76 +64,116 @@ jobs:

lint:
runs-on: ubuntu-latest
needs: install
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/setup-node@v1
with:
node-version: 16
cache: 'yarn'

- run: yarn install --frozen-lockfile
node-version: 16.x

# Can be removed if translations aren't required for tests,
# or if not using the App Platform
- name: Generate translations
run: yarn d2-app-scripts i18n generate

- name: Lint
run: yarn d2-style check

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/cache@v2
id: yarn-cache
with:
node-version: 16
cache: 'yarn'

- run: yarn install --frozen-lockfile
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

# Can be removed if translations aren't required for tests,
# or if not using the App Platform
- name: Generate translations
run: yarn d2-app-scripts i18n generate

- name: Test
run: yarn d2-app-scripts test
- name: Lint
run: yarn lint

# test:
# runs-on: ubuntu-latest
# needs: install
# if: "!contains(github.event.head_commit.message, '[skip ci]')"
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 16.x

# - uses: actions/cache@v2
# id: yarn-cache
# with:
# path: '**/node_modules'
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

# - name: Generate translations
# run: yarn d2-app-scripts i18n generate

# - name: Test
# run: yarn test --passWithNoTests

#e2e:
# runs-on: ubuntu-latest
# if: "!github.event.push.repository.fork && github.actor != 'dependabot[bot]'"
# if: "!contains(github.event.head_commit.message, '[skip ci]')"
# needs: [install]
#
# strategy:
# fail-fast: false
# matrix:
# containers: [1, 2, 3, 4]
# containers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
#
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - uses: actions/setup-node@v3
# - uses: actions/setup-node@v1
# with:
# node-version: 16.x
#
# - uses: actions/cache@v2
# id: yarn-cache
# with:
# node-version: 16
# cache: 'yarn'
# path: '**/node_modules'
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
#
# - name: Install Cypress binary
# run: yarn cypress install
#
# - name: End-to-End tests
# uses: cypress-io/github-action@v2
# with:
# # This should be a command that serves the app.
# start: yarn d2-app-scripts start
# wait-on: 'http://localhost:3000'
# wait-on-timeout: 300
# install: false
# record: true
# parallel: true
# start: ${{ env.SERVER_START_CMD }}
# wait-on: ${{ env.SERVER_URL }}
# wait-on-timeout: 300
# cache-key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# group: 'e2e'
# tag: ${{ github.event_name }}
# env:
# BROWSER: none
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# CYPRESS_dhis2BaseUrl: https://debug.dhis2.org/dev
# CYPRESS_dhis2ApiVersion: 37
# CYPRESS_networkMode: stub
# COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
# STORYBOOK_TESTING: true
# SERVER_START_CMD: 'yarn cy:server'
# SERVER_URL: 'http://localhost:5001'

publish:
runs-on: ubuntu-latest
needs: [build, lint] # add e2e and/or test if you use it
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
with:
token: ${{env.GH_TOKEN}}

- uses: actions/setup-node@v1
with:
node-version: 16.x

- uses: actions/download-artifact@v2
with:
name: app-build

- uses: dhis2/deploy-build@master
with:
# uncomment following line for monorepo apps:
#cwd: ./packages/app
build-dir: build/app
github-token: ${{ env.GH_TOKEN }}

release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -151,4 +208,5 @@ jobs:
# uncomment following line for monorepo apps:
#cwd: ./packages/app
build-dir: build/app
github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}
github-token: ${{ secrets.DHIS2_BOT_GITHUB_TOKEN }}

0 comments on commit 337fc73

Please sign in to comment.