Test CI CD pipeline #17
Workflow file for this run
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: Test Updates | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/test.yml' | |
- 'src/**' | |
workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI | |
permissions: | |
issues: write | |
id-token: write | |
contents: read | |
actions: read | |
pull-requests: write | |
jobs: | |
test-project: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build docker images | |
run: docker-compose -f docker-compose.yaml build test-action | |
- name: Test | |
run: docker-compose -f docker-compose.yaml run test-action | |
generate-main-contract: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: 'main' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: false | |
version: 1.5.1 | |
- name: Generate current contract | |
run: | | |
python -m venv .venv --upgrade-deps | |
source .venv/bin/activate | |
poetry install --no-interaction --no-ansi | |
aligned compile | |
- name: Archive new aligned contract | |
uses: actions/upload-artifact@v3 | |
with: | |
name: contract-latest | |
path: contract_store.json | |
retention-days: 1 | |
generate-new-contract: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: false | |
version: 1.5.1 | |
- name: Generate current contract | |
run: | | |
python -m venv .venv --upgrade-deps | |
source .venv/bin/activate | |
poetry install --no-interaction --no-ansi | |
aligned compile | |
- name: Archive new aligned contract | |
uses: actions/upload-artifact@v3 | |
with: | |
name: aligned-contract-${{ env.GITHUB_SHA }} | |
path: contract_store.json | |
retention-days: 1 | |
check-for-contract-issues: | |
needs: [generate-new-contract, generate-main-contract] | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- name: Install Aligned | |
run: pip install git+https://github.com/MatsMoll/aligned.git@matsei/load-dataset-as-job | |
- name: Download current schema | |
uses: actions/download-artifact@v3 | |
with: | |
name: contract-latest | |
path: current-contract | |
- name: Download new schema | |
uses: actions/download-artifact@v3 | |
with: | |
name: aligned-contract-${{ env.GITHUB_SHA }} | |
path: new-contract | |
- name: Generate Potentiall Issue Change Report | |
id: contract-update-report | |
run: | | |
aligned check-updates --updated-contract new-contract/contract_store.json --reference-contract current-contract/contract_store.json > report.md | |
- name: Notify about potentiall issues | |
uses: actions/github-script@v6 | |
# if: needs.contract-update-report.outputs.markdown != '' | |
with: | |
script: | | |
const fs = require('fs'); | |
const path = 'report.md'; // Update this path to your file | |
const body = fs.readFileSync(path, 'utf8'); | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) | |