|
| 1 | +name: 'Test' |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + workflow_dispatch: |
| 5 | +concurrency: |
| 6 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + version-bump: |
| 12 | + name: 'Version Bump' |
| 13 | + runs-on: [self-hosted, linux, flyweight] |
| 14 | + steps: |
| 15 | + - name: 'Check out code' |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + token: ${{ secrets.JENKINS_GITHUB_PAT }} |
| 19 | + fetch-depth: 0 |
| 20 | + ref: ${{ github.event.pull_request.head.sha }} |
| 21 | + - name: 'Configure GitHub user' |
| 22 | + run: | |
| 23 | + git config user.name devops |
| 24 | + git config user.email [email protected] |
| 25 | + - name: 'Update version' |
| 26 | + run: | |
| 27 | + og_version=$(git show origin/${GITHUB_BASE_REF}:package/version) |
| 28 | + ./package/version.sh bump ${og_version} |
| 29 | + ./package/version.sh sub |
| 30 | + new_version=$(cat package/version) |
| 31 | + git add --update && git commit --message "Set Version: ${new_version}" || true |
| 32 | + - name: 'Push updates' |
| 33 | + run: git push origin HEAD:${GITHUB_HEAD_REF} |
| 34 | + |
| 35 | + code-quality-checks: |
| 36 | + needs: version-bump |
| 37 | + name: 'Code Quality Checks' |
| 38 | + runs-on: [self-hosted, linux, flyweight] |
| 39 | + steps: |
| 40 | + - name: 'Check out code' |
| 41 | + uses: actions/checkout@v3 |
| 42 | + - name: 'Run code quality checks' |
| 43 | + run: make check |
| 44 | + - name: 'Run pyupgrade' |
| 45 | + run: make pyupgrade |
| 46 | + - name: 'Run unit tests' |
| 47 | + run: make test-unit |
| 48 | + |
| 49 | + integration-tests: |
| 50 | + needs: code-quality-checks |
| 51 | + name: 'Integration Tests' |
| 52 | + runs-on: [self-hosted, linux, normal] |
| 53 | + env: |
| 54 | + CONTAINER: ksoroban-integration-${{ github.sha }} |
| 55 | + steps: |
| 56 | + - name: 'Check out code' |
| 57 | + uses: actions/checkout@v3 |
| 58 | + with: |
| 59 | + fetch-depth: 0 |
| 60 | + - name: 'Set up Docker' |
| 61 | + uses: ./.github/actions/with-docker |
| 62 | + with: |
| 63 | + container-name: ${CONTAINER} |
| 64 | + - name: 'Build ksoroban' |
| 65 | + run: docker exec --user user ${CONTAINER} poetry install |
| 66 | + - name: 'Build semantics' |
| 67 | + run: docker exec --user user ${CONTAINER} make kdist-build |
| 68 | + - name: 'Run integration tests' |
| 69 | + run: docker exec --user user ${CONTAINER} make test-integration |
| 70 | + - name: 'Tear down Docker' |
| 71 | + if: always() |
| 72 | + run: docker stop --time=0 ${CONTAINER} |
0 commit comments