Skip to content

Commit

Permalink
chore: Bring over nightly build
Browse files Browse the repository at this point in the history
  • Loading branch information
scouten-adobe committed Sep 29, 2024
1 parent 9dfbc57 commit b8635b2
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Nightly build

on:
workflow_dispatch:
schedule:
- cron: "0 5 * * *" # 0500 UTC every day

jobs:
# Create snapshot of main branch for nightly build
nightly-snapshot:
name: Create snapshot
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_ADMIN_COMMIT_TOKEN }}

- name: Set new proposed version
uses: paulhatch/semantic-version@v5.4.0
id: set-version
with:
tag_prefix: "v"
version_format: "${major}.${minor}.${patch}"
major_pattern: "(MAJOR)"
minor_pattern: "(MINOR)"

- name: Add -nightly+(date)-(commit ID) prefix to version
id: set-nightly-version
run: |
echo version=${{ steps.set-version.outputs.version }}-nightly+`date +%F`-`git rev-parse --short HEAD` >> "$GITHUB_OUTPUT"
- name: Log new version & changelog
run: |
echo "Proposed new version: $VERSION"
echo "Nightly version: $NIGHTLY_VERSION"
env:
VERSION: ${{ steps.set-version.outputs.version }}
NIGHTLY_VERSION: ${{ steps.set-nightly-version.outputs.version }}

- name: Bump crate versions
run: |
sed -i "s/^version = \"[^\"]*\"$/version = \"$VERSION\"/;" sdk/Cargo.toml
env:
VERSION: ${{ steps.set-nightly-version.outputs.version }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: cargo

- name: Create or update Cargo.lock
run: |
cargo update -w
git add -f Cargo.lock
- name: Report differences for "prepare (release)" commit
run: git diff

- name: Commit Cargo.toml and Cargo.lock
uses: stefanzweifel/git-auto-commit-action@v5
id: commit
with:
branch: nightly
push_options: '--force'
commit_message: Prepare ${{ steps.set-nightly-version.outputs.version }} release
commit_user_name: Adobe CAI Team
commit_user_email: noreply@adobe.com
create_branch: true

tests:
name: Unit tests
runs-on: ${{ matrix.os }}
needs: nightly-snapshot

strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: nightly

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Run unit tests (cross build)
run: cargo test --all-targets --all-features

test-direct-minimal-versions:
name: Unit tests with minimum versions of direct dependencies
runs-on: ${{ matrix.os }}
needs: nightly-snapshot

strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: nightly

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo +nightly test -Z direct-minimal-versions --all-targets --all-features

0 comments on commit b8635b2

Please sign in to comment.