From 63c7b6cdec4971dd42265b44c2d1df2536560afe Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Fri, 8 Sep 2023 06:07:38 -0700 Subject: [PATCH] Switches to github actions --- .github/workflows/lint.yml | 11 +++++++ .github/workflows/release.yml | 19 +++++++++++ .github/workflows/test.yml | 20 ++++++++++++ .mergify.yml | 9 +++--- .travis.yml | 60 ----------------------------------- 5 files changed, 54 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..adf38b65 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,11 @@ +name: Run lint and static analyis checks +on: + pull_request: + +concurrency: + group: lint-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + lint: + uses: plus3it/actions-workflows/.github/workflows/lint.yml@93a9326e07945e5441d0fadef735563290edd729 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..55929772 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Create GitHub Release + +on: + # Run on demand + workflow_dispatch: + + # Run on push to main when .bumpversion.cfg version is updated + push: + branches: + - main + - master + paths: + - .bumpversion.cfg + +jobs: + release: + uses: plus3it/actions-workflows/.github/workflows/release.yml@93a9326e07945e5441d0fadef735563290edd729 + secrets: + release-token: ${{ secrets.GH_RELEASES_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..dfc792d6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Run test jobs +on: + pull_request: + +concurrency: + group: test-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test: + uses: plus3it/actions-workflows/.github/workflows/test.yml@93a9326e07945e5441d0fadef735563290edd729 + + unit-test: + runs-on: ubuntu-latest + steps: + - name: Clone this git repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + + - name: Run python lambda unit tests + run: make docker/run target=pytest/lambda/tests diff --git a/.mergify.yml b/.mergify.yml index eef0352c..0c77e195 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -1,15 +1,14 @@ pull_request_rules: - - name: automatic approve dependabot pull requests + - name: approve dependabot pull requests conditions: - - author~=dependabot\[bot\]|dependabot-preview\[bot\] - - status-success=Travis CI - Pull Request + - author=dependabot[bot] actions: review: type: APPROVE - - name: automatic merge for dependabot pull requests + - name: merge dependabot pull requests conditions: - - author~=dependabot\[bot\]|dependabot-preview\[bot\] + - author=dependabot[bot] - "#approved-reviews-by>=1" actions: merge: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 234d1f8f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -dist: focal - -language: minimal - -stages: - - lint - - test - - deploy - -if: branch = master OR type = pull_request - -before_install: - - tmpdaemon=$(mktemp) - - sudo jq '."registry-mirrors" += ["https://mirror.gcr.io"]' /etc/docker/daemon.json > "$tmpdaemon" - - sudo mv "$tmpdaemon" /etc/docker/daemon.json - - sudo systemctl daemon-reload - - sudo systemctl restart docker - - docker system info - -jobs: - include: - - stage: lint - name: Project Syntax Verification - script: make docker/run target=lint - - stage: test - name: Run unit tests - script: make docker/run target=pytest/lambda/tests - - stage: test - name: Run integration tests against a mock AWS stack - install: - - make docker-compose/install - - make mockstack/up - script: make mockstack/pytest/lambda - after_script: - - docker-compose -f ./tests/docker-compose-localstack.yml logs - - make mockstack/clean - - stage: deploy - if: branch = master AND type = push AND repo = plus3it/terraform-aws-org-new-account-iam-role - before_script: - - | - PRIOR_VERSION=$(git describe --abbrev=0 --tags) - RELEASE_VERSION=$(grep current_version $TRAVIS_BUILD_DIR/.bumpversion.cfg | sed 's/^.*= //' ) - RELEASE_BODY="* [terraform-aws-org-new-account-iam-role v$RELEASE_VERSION CHANGELOG](https://github.com/plus3it/terraform-aws-org-new-account-iam-role/blob/$RELEASE_VERSION/CHANGELOG.md)" - export PRIOR_VERSION RELEASE_VERSION RELEASE_BODY - script: skip - before_deploy: - - | - (set -x; git tag -a $RELEASE_VERSION -m $RELEASE_VERSION) - deploy: - provider: releases - api_key: $GH_RELEASES_TOKEN - name: $RELEASE_VERSION - body: $RELEASE_BODY - tag_name: $RELEASE_VERSION - target_commitish: $TRAVIS_COMMIT - draft: false - on: - branch: master - repo: plus3it/terraform-aws-org-new-account-iam-role - condition: '"$PRIOR_VERSION" != "$RELEASE_VERSION"'