Canton v2.0.0 #2610
Workflow file for this run
This file contains hidden or 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: Daml Contracts | |
| on: | |
| push: | |
| branches: [develop, main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-frozen-release-artifacts: | |
| name: Check frozen release artifacts | |
| if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'release-artifacts') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Ensure frozen snapshots are unchanged | |
| env: | |
| GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref || 'main' }} | |
| run: | | |
| chmod +x ./contracts/scripts/check-frozen-release-artifacts.sh | |
| ./contracts/scripts/check-frozen-release-artifacts.sh "origin/${GITHUB_BASE_REF}" | |
| compile-contracts: | |
| name: Compile Contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Install DPM | |
| uses: ./.github/actions/install-dpm | |
| - name: Compile contracts | |
| run: make compile-contracts | |
| - name: Check if dev DARs are up to date | |
| run: | | |
| set -euo pipefail | |
| if ! git diff --quiet HEAD -- contracts/dars/current/; then | |
| echo "Dev DARs under \`contracts/dars/current/\` are out of date. Run \`make compile-contracts\` and commit only those files (do not rewrite \`contracts/dars/v1_0_0/\`)." >> $GITHUB_STEP_SUMMARY | |
| git diff --name-only -- contracts/dars/current/ | while read -r n ; do | |
| echo "- $n" >> $GITHUB_STEP_SUMMARY | |
| done | |
| exit 1 | |
| fi | |
| generate-bindings: | |
| name: Generate Bindings | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Generate bindings | |
| run: make generate-bindings | |
| - name: Verify dev bindings are up-to-date | |
| run: | | |
| set -euo pipefail | |
| if ! git diff --quiet HEAD -- bindings/generated/latest/; then | |
| echo "### Dev bindings are out of date!" >> $GITHUB_STEP_SUMMARY | |
| echo "The bindings under \`bindings/generated/latest/\` do not match \`make generate-bindings\`." >> $GITHUB_STEP_SUMMARY | |
| echo "Do not rewrite \`bindings/generated/v1_0_0/\` in normal PRs — use \`make freeze-release\` on a release PR (label \`release-artifacts\`)." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "#### To fix:" >> $GITHUB_STEP_SUMMARY | |
| echo '```bash' >> $GITHUB_STEP_SUMMARY | |
| echo 'make generate-bindings' >> $GITHUB_STEP_SUMMARY | |
| echo 'git add bindings/generated/latest/' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "#### Drifted files:" >> $GITHUB_STEP_SUMMARY | |
| echo '```text' >> $GITHUB_STEP_SUMMARY | |
| git diff --name-only -- bindings/generated/latest/ >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| git diff -- bindings/generated/latest/ | |
| exit 1 | |
| else | |
| echo "### Dev bindings are up-to-date" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| test-contracts: | |
| name: Test Contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| - name: Install DPM | |
| uses: ./.github/actions/install-dpm | |
| - name: Test Daml Contracts | |
| run: go run ./contracts/cmd/test --root ./contracts --plain --output ./summary.md | |
| - name: Output test summary | |
| if: always() | |
| run: cat summary.md >$GITHUB_STEP_SUMMARY |