diff --git a/.github/workflows/dhis2-verify-app.yml b/.github/workflows/dhis2-verify-app.yml new file mode 100644 index 00000000..eb761191 --- /dev/null +++ b/.github/workflows/dhis2-verify-app.yml @@ -0,0 +1,188 @@ +name: 'dhis2: verify (app)' + +on: + push: + branches: + +env: + GIT_AUTHOR_NAME: '@dhis2-bot' + GIT_AUTHOR_EMAIL: 'apps@dhis2.org' + GIT_COMMITTER_NAME: '@dhis2-bot' + GIT_COMMITTER_EMAIL: 'apps@dhis2.org' + GH_TOKEN: ${{secrets.DHIS2_BOT_GITHUB_TOKEN}} + CI: 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: 12.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@v1 + with: + node-version: 12.x + + - uses: actions/cache@v2 + id: yarn-cache + with: + path: '**/node_modules' + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + + - name: Build + run: yarn build + + - uses: actions/upload-artifact@v2 + with: + name: app-build + path: | + **/build + !**/node_modules + retention-days: 1 + + 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@v1 + with: + node-version: 12.x + + - uses: actions/cache@v2 + id: yarn-cache + with: + path: '**/node_modules' + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + + - 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: 12.x + # + # - uses: actions/cache@v2 + # id: yarn-cache + # with: + # 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 test + + #e2e: + # runs-on: ubuntu-latest + # if: "!contains(github.event.head_commit.message, '[skip ci]')" + # needs: [install] + # + # strategy: + # matrix: + # containers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + # + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + # + # - uses: actions/setup-node@v1 + # with: + # node-version: 12.x + # + # - uses: actions/cache@v2 + # id: yarn-cache + # with: + # 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: + # 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: + # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + # 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 test if you use them + 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: 12.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 + github-token: ${{ env.GH_TOKEN }} + + release: + runs-on: ubuntu-latest + needs: [publish] + if: "github.event_name == 'push' && !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: 12.x + + - name: Publish release to GitHub + run: npx @dhis2/cli-utils release diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f3f98ddd..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: node_js -node_js: - - 10 -cache: - directories: - - node_modules -script: - - yarn lint - - yarn build -deploy: - - provider: script - script: npx --package @dhis2/deploy-build deploy-build d2-ci build - skip_cleanup: true - on: - all_branches: true -env: - global: - secure: Zam/mb7xjs7fvimVlK5L3Hvga2Pt4O/FfxLwRsJq/nfvHctCxj1fQ9iKbXfZm1ODDNRC1UHp+F/vUCU46oGe6uosoXc4VWTWzfUbxoslgTZUv7M5kcicmxeSw4eT1HpPQ0vqn1vwm3Zx+CR1GpoHlJMo8AWmVObM3Z1SgFdHuAzPjKjwGH/9/4WlDmjbjwu3S45xZJf8aSvu8q5c7ZfzZj8Uv8xgf2c/VsP5URBdDua9VGDvle66whjExlFcx6MUKhIUBb0BKswR3axsIk1uNzY+tveZ/QXLBwLUGWurihFlBNXq2zoAwRkzft94eXsK8WCQbGP3gIyHSzIO4MHIU73cwPUUjCVd/wsJRGHqdjsHq/lmEVWypILlpPuLKzTDMh5ULXL1v3gW7gx9sBYC4NqbvjmducN6f2EBY6HCdS6RSPRB36JicGfDBAUyscnDynVUzBqYDkmmHza21+tq7LyL1uf0XyGVEYJWu2keFtI9mPovReeVMGW8O2jHRvCSr5aZie8n3XInY4va28Gx+5Kr7MWM2JdtdiMZEcPcZWLHTKS0UA4SsIG8Phr5v8YVJvGhybV2fu3RbkWamwLiNNjkRsdkIdwBlU4KCmnV7J6VSdisoU3du3XHyOsyq4UMvo14vZEYr4tWKncsEXRvez+GRhU/W4kDuxjcfHZkB4g= -notifications: - slack: - secure: ROTYWbxHa48xePhTepBBxrGjBZ0CCu/tyQtjOnT4JFO8AXFTR8hwtFEIQ8UYXh5QXDbvCra/u951S4mtfR3vlyyEGzJmEZK8ASXTA/4ya29ewQ67GgmQfD7734obPvCzO+sizSVo9V4+DUKCkv+bgYUaCWcI8SbIio8v2wLQaSlcNZ29dcBSAb4CZ6iqa4hHWnpVcdri0iBC91ybUFSUVAOr7OqBJPM+tzjYD1sS7/K4Tvt26npz9hvdMRgbfyGt+NLjr0x1xDzNfCBuYLNXYEAjLpd8royA5zxKk3eSKPOlpOPTstHY59pHW2m8gnoBWKuKG3JofWmpCUG5ipduNz2qJ4aDCvV5ybVjtR5GgATUIpAKekHTTJ3/fuNv46VmVcbfvSFcVNX+Af0hjKXPVXSEvNyLX+GMeM8Y2bOx7zjizfMKkozCclVuTvrCaVOVSFKVxifWOnamCptKTGSr+oCsgbEXQ33gu3F3uVZ+mZooOuGn/rJ+tyoCvKqW9eON4aA36Oxo9ACkumkZXwhEh1k1x9IgKX/7amvqOzLgbKO6saKSEDnCnOHezWZBdbOOKZdvolaXRu2OxnVYiH2btm9fUfL1af3e30vWNlxjpNjQMoCFLfnXgYeO1nlOmfhm/PFrNFct6Kr770zmgGk+3AJOYWtt21e2RF37zx2nAQM= - on_success: change - on_failure: always