Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve caching of Rust build artifacts and update workflows #24

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 3 additions & 27 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,6 @@ on:
jobs:

bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: cargo install --locked --version 0.2.35 cargo-workspaces
- run: |
make bump-version VERSION=${{ inputs.version }}
- name: Create Commit
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b 'bump-version-${{ inputs.version }}'
git add .
git commit -m 'Bump version to ${{ inputs.version }}'
git push origin 'bump-version-${{ inputs.version }}'
- name: Create Pull Request
uses: actions/github-script@v6
with:
script: |
await github.rest.pulls.create({
title: 'Bump version to ${{ inputs.version }}',
owner: context.repo.owner,
repo: context.repo.repo,
head: 'bump-version-${{ inputs.version }}',
base: 'main',
body: '### What\nBump version to ${{ inputs.version }}.\n\n### Why\nTriggered by @${{ github.actor }}.'
});
uses: stellar/actions/.github/workflows/rust-bump-version.yml@main
with:
version: ${{ inputs.version }}
47 changes: 2 additions & 45 deletions .github/workflows/rust-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,5 @@ on:

jobs:

check-and-update-rust-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: cargo install --locked --version 0.2.0 cargo-set-rust-version

# Update the rust-version in all workspace crates to the latest stable
# version.
- run: cargo set-rust-version

# Check if there is any diff resulting from updating the crates. If there is
# set the update=true output for following steps.
- id: diff
run: |
if ! git diff --exit-code; then
echo "::set-output name=update::true"
fi

# If the diff step indicates an update is required, create a branch and push
# it to GitHub. If the branch already exists with a change the push should
# fail, and so we shouldn't end up with multiple PRs.
- if: steps.diff.outputs.update == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b update-rust-version
git add .
git commit -m 'Update rust-version'
git push origin update-rust-version

# If the diff step indicates an update is required, open a PR.
- if: steps.diff.outputs.update == 'true'
name: Create Pull Request
uses: actions/github-script@v6
with:
script: |
await github.rest.pulls.create({
title: 'Update rust-version',
owner: context.repo.owner,
repo: context.repo.repo,
head: 'update-rust-version',
base: 'main',
body: '### What\nUpdate rust-version to latest stable.\n\n### Why\nTracking latest stable which receives security updates.'
});
set-rust-version:
uses: stellar/actions/.github/workflows/rust-set-rust-version.yml@main
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup update
- run: cargo build
- run: cargo test
Expand All @@ -48,6 +49,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup update
- run: cargo doc

Expand All @@ -57,6 +59,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- run: rustup update
- run: rustup target add wasm32-unknown-unknown
- run: cargo install --locked --version 0.2.35 cargo-workspaces
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ fmt:
clean:
cargo clean

bump-version:
cargo workspaces version --all --force '*' --no-git-commit --yes custom $(VERSION)

publish:
cargo workspaces publish --all --force '*' --from-git --yes