Merge pull request #259 from aws-samples/dependabot/pip/dbt-tests-ada… #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration Tests | |
on: | |
push: | |
branches: | |
- "main" | |
- "*.latest" | |
- "releases/*" | |
paths-ignore: | |
- "**.MD" | |
- "**.md" | |
permissions: | |
id-token: write | |
contents: read | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
integ: | |
name: integration test / python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] # Use single version to avoid resource conflicts in an AWS account | |
env: | |
TOXENV: "integration" | |
PYTEST_ADDOPTS: "-v --color=yes --csv unit_results.csv" | |
DBT_AWS_ACCOUNT: ${{ secrets.DBT_AWS_ACCOUNT }} | |
DBT_GLUE_ROLE_ARN: ${{ secrets.DBT_GLUE_ROLE_ARN }} | |
DBT_GLUE_REGION: ${{ secrets.DBT_GLUE_REGION }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install python dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libsasl2-dev | |
python -m pip install --user --upgrade pip | |
python -m pip --version | |
python -m pip install tox | |
tox --version | |
- name: Generate session name | |
id: session | |
run: | | |
repo="${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" | |
echo "name=${repo}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" >> "${GITHUB_OUTPUT}" | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-session-name: ${{ steps.session.outputs.name }} | |
role-to-assume: arn:aws:iam::${{ secrets.DBT_AWS_ACCOUNT }}:role/dbt-glue | |
aws-region: ${{ secrets.DBT_GLUE_REGION }} | |
mask-aws-account-id: true | |
- name: Run tox | |
run: | | |
export DBT_S3_LOCATION=${{ secrets.DBT_S3_LOCATION }}/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}/${{ matrix.python-version }} | |
tox | |
- name: Get current date | |
if: always() | |
id: date | |
run: echo "date=$(date +'%Y-%m-%dT%H_%M_%S')" >> $GITHUB_OUTPUT #no colons allowed for artifacts | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: unit_results_${{ matrix.python-version }}-${{ steps.date.outputs.date }}.csv | |
path: unit_results.csv |