nightly.yml (3340B)
1 name: Nightly build 2 3 on: 4 workflow_dispatch: 5 schedule: 6 - cron: "0 5 * * *" # 0500 UTC every day 7 8 jobs: 9 # Create snapshot of main branch for nightly build 10 nightly-snapshot: 11 name: Create snapshot 12 runs-on: ubuntu-latest 13 14 steps: 15 - name: Checkout repository 16 uses: actions/checkout@v3 17 with: 18 fetch-depth: 0 19 token: ${{ secrets.GH_ADMIN_COMMIT_TOKEN }} 20 21 - name: Set new proposed version 22 uses: paulhatch/semantic-version@v5.2.1 23 id: set-version 24 with: 25 tag_prefix: "v" 26 version_format: "${major}.${minor}.${patch}" 27 major_pattern: "(MAJOR)" 28 minor_pattern: "(MINOR)" 29 30 - name: Add -nightly+(date)-(commit ID) prefix to version 31 id: set-nightly-version 32 run: | 33 echo version=${{ steps.set-version.outputs.version }}-nightly+`date +%F`-`git rev-parse --short HEAD` >> "$GITHUB_OUTPUT" 34 35 - name: Log new version & changelog 36 run: | 37 echo "Proposed new version: $VERSION" 38 echo "Nightly version: $NIGHTLY_VERSION" 39 env: 40 VERSION: ${{ steps.set-version.outputs.version }} 41 NIGHTLY_VERSION: ${{ steps.set-nightly-version.outputs.version }} 42 43 - name: Bump crate versions 44 run: | 45 sed -i "s/^version = \"[^\"]*\"$/version = \"$VERSION\"/;" sdk/Cargo.toml 46 env: 47 VERSION: ${{ steps.set-nightly-version.outputs.version }} 48 49 - name: Install Rust toolchain 50 uses: dtolnay/rust-toolchain@stable 51 with: 52 components: cargo 53 54 - name: Create or update Cargo.lock 55 run: | 56 cargo update -w 57 git add -f Cargo.lock 58 59 - name: Report differences for "prepare (release)" commit 60 run: git diff 61 62 - name: Commit Cargo.toml and Cargo.lock 63 uses: stefanzweifel/git-auto-commit-action@v4 64 id: commit 65 with: 66 branch: nightly 67 push_options: '--force' 68 commit_message: Prepare ${{ steps.set-nightly-version.outputs.version }} release 69 commit_user_name: Adobe CAI Team 70 commit_user_email: noreply@adobe.com 71 create_branch: true 72 73 tests: 74 name: Unit tests 75 runs-on: ${{ matrix.os }} 76 needs: nightly-snapshot 77 78 strategy: 79 fail-fast: false 80 matrix: 81 os: [windows-latest, macos-latest, ubuntu-latest] 82 83 steps: 84 - name: Checkout repository 85 uses: actions/checkout@v3 86 with: 87 ref: nightly 88 89 - name: Install Rust toolchain 90 uses: dtolnay/rust-toolchain@stable 91 92 - name: Cache Rust dependencies 93 uses: Swatinem/rust-cache@v2 94 95 - name: Run unit tests (cross build) 96 run: cargo test --all-targets --all-features 97 98 test-direct-minimal-versions: 99 name: Unit tests with minimum versions of direct dependencies 100 runs-on: ${{ matrix.os }} 101 needs: nightly-snapshot 102 103 strategy: 104 fail-fast: false 105 matrix: 106 os: [windows-latest, macos-latest, ubuntu-latest] 107 108 steps: 109 - name: Checkout repository 110 uses: actions/checkout@v3 111 with: 112 ref: nightly 113 114 - name: Install Rust toolchain 115 uses: dtolnay/rust-toolchain@nightly 116 117 - name: Cache Rust dependencies 118 uses: Swatinem/rust-cache@v2 119 120 - name: Run tests 121 run: cargo +nightly test -Z direct-minimal-versions --all-targets --all-features