Skip to content

Commit

Permalink
ci: Switch to AF github actions shared workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dincho authored and davidyuk committed Nov 20, 2023
1 parent 7f7d011 commit d124b0c
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 274 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/_validate-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
workflow_call:

jobs:
build_test:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm config set fund false
- run: npm ci
working-directory: 'backend'
- run: npm test
working-directory: 'backend'
- run: npm ci --legacy-peer-deps # TODO: remove --legacy-peer-deps after updating dependencies
- run: docker-compose up -d compiler
- run: perl -i -pe 's/https:\/\/compiler\.aepps\.com/http:\/\/localhost:3078/g' src/lib/networksRegistry.js
- run: npm test
- uses: stefanzweifel/git-auto-commit-action@v4
if: failure()
with:
commit_message: "fixme: update e2e screenshots"
file_pattern: 'tests/e2e/*.png'
- run: docker-compose logs
if: always()
24 changes: 24 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: integration

on:
push:
branches: [ develop ]

jobs:
validate:
uses: ./.github/workflows/_validate-npm.yml
publish:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [ validate ]
secrets: inherit
with:
DOCKERHUB_REPO: "aeternitybot/${{ github.event.repository.name }}"
deploy:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [publish]
secrets: inherit
with:
DEPLOY_ENV: stg
DEPLOY_APP: "${{ github.event.repository.name }}"
DEPLOY_VERSION: develop
DEPLOY_HOST_PREFIX: ""
112 changes: 0 additions & 112 deletions .github/workflows/prod-docker.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/pull-request-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: pull-request-cleanup

on:
pull_request:
branches: [ develop ]
types: [ closed ]

jobs:
rollback:
uses: aeternity/github-actions/.github/workflows/[email protected]
secrets: inherit
with:
DEPLOY_ENV: stg
DEPLOY_APP: ${{ github.event.repository.name }}
DEPLOY_VERSION: "pr-${{ github.event.number }}"
DEPLOY_HOST_PREFIX: "pr-${{ github.event.number }}-"
delete-tag:
uses: aeternity/github-actions/.github/workflows/[email protected]
secrets: inherit
with:
DOCKERHUB_REPO: "aeternitybot/${{ github.event.repository.name }}"
DOCKERHUB_TAG: "pr-${{ github.event.number }}"
24 changes: 24 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: pull-request

on:
pull_request:
branches: [ develop ]

jobs:
validate:
uses: ./.github/workflows/_validate-npm.yml
publish:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [ validate ]
secrets: inherit
with:
DOCKERHUB_REPO: "aeternitybot/${{ github.event.repository.name }}"
deploy:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [publish]
secrets: inherit
with:
DEPLOY_ENV: stg
DEPLOY_APP: ${{ github.event.repository.name }}
DEPLOY_VERSION: "pr-${{ github.event.number }}"
DEPLOY_HOST_PREFIX: "pr-${{ github.event.number }}-"
17 changes: 17 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: release-please

on:
push:
branches: [ master ]

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: ""
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"ci","section":"CI / CD","hidden":false},{"type":"test","section":"Testing","hidden":false},{"type":"refactor","section":"Refactorings","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]'
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: release

on:
push:
tags: [ v* ]

jobs:
publish:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [ validate ]
secrets: inherit
deploy:
uses: aeternity/github-actions/.github/workflows/[email protected]
needs: [publish]
secrets: inherit
with:
DEPLOY_ENV: prd
DEPLOY_APP: ${{ github.event.repository.name }}
DEPLOY_TAG: ${{ github.ref_name }}
131 changes: 0 additions & 131 deletions .github/workflows/staging-docker.yml

This file was deleted.

Loading

0 comments on commit d124b0c

Please sign in to comment.