diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml deleted file mode 100644 index d2a2fb66..00000000 --- a/.github/workflows/makefile.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Makefile CI - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: '0 13 * * 1' -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Nodejs - uses: actions/setup-node@v3 - with: - node-version: 14 - - # see https://github.com/localstack/localstack/pull/6831 - # remove once no longer needed - - name: Fix pyOpenSSL version - run: pip install --upgrade pyOpenSSL - - - name: Install LocalStack - run: pip install localstack awscli-local[ver1] - - - name: Install Dependencies - run: | - pip install virtualenv - pip install --upgrade pyopenssl - npm install -g serverless - - - name: Setup config - run: | - echo "Configuring git for codecommit sample" - git config --global user.email "localstack.sample@localstack.cloud" - git config --global user.name "Localstack Pro-Samples" - - - name: Pull the latest docker image - run: docker pull localstack/localstack-pro - - - name: Execute tests - env: - LOCALSTACK_API_KEY: ${{ secrets.TEST_LOCALSTACK_API_KEY }} - DNS_ADDRESS: 127.0.0.1 - DEBUG: 1 - timeout-minutes: 200 - run: make test-ci-all - - - name: Send a Slack notification - if: failure() || github.event_name != 'pull_request' - uses: ravsamhq/notify-slack-action@v2 - with: - status: ${{ job.status }} - token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "{workflow} has {status_message}" - message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" - footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>" - notify_when: "failure" - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..30a6a6e3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,57 @@ +name: Run tests for all samples + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + prepare-list: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: set-matrix + run: | + mapfile -t dirs < <(find . -mindepth 2 -type f -name "Makefile" ! -path "./sample-archive/*" | sed "s|/Makefile||" | sort) + echo "matrix=$(printf '%s\n' "${dirs[@]}" | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT" + + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + run-tests: + name: Run dependency test (${{ matrix.directory }}) + runs-on: ubuntu-latest + needs: prepare-list + strategy: + fail-fast: false + max-parallel: 8 + matrix: + directory: ${{ fromJSON(needs.prepare-list.outputs.matrix) }} + + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install LocalStack + run: pip install localstack awscli-local[ver1] virtualenv + - name: Setup config + run: | + echo "Configuring git for codecommit sample" + git config --global user.email "localstack.sample@localstack.cloud" + git config --global user.name "Localstack Pro-Samples" + - name: Pull the latest docker image + run: docker pull localstack/localstack-pro + - name: Execute a simple test + timeout-minutes: 10 + run: | + cd ${{ matrix.directory }} + make test-ci + env: + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} + DEBUG: 1 + DNS_ADDRESS: 127.0.0.1