Versioning #9
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: Check Example Versions | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| jobs: | |
| verify-directives: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Extract version from Cargo.toml | |
| id: get_version | |
| run: | | |
| # Grabs the first 'version = "X.Y.Z"' it sees in Cargo.toml | |
| VERSION=$(awk -F '\"' '/^version/ {print $2; exit}' Cargo.toml) | |
| echo "COMPILER_VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Detected Cargo version: $VERSION" | |
| - name: Run the example updater script | |
| run: python3 update_examples.py ${{ env.COMPILER_VERSION }} | |
| - name: Fail if examples are out of date | |
| run: | | |
| # Check both examples and functional-tests directories for changes! | |
| if ! git diff --exit-code examples/ functional-tests/; then | |
| echo "::error::The version directives in the examples/ or functional-tests/ folder are incorrect or missing!" | |
| exit 1 | |
| fi |