chore: release (#8) #65
This file contains 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: "ci" | |
permissions: | |
pull-requests: write | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
lint: | |
timeout-minutes: 45 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup | |
uses: ./.github/actions/devenv | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
nix-cache: /tmp/nixcache | |
- name: lint formatting | |
run: lint:format | |
shell: bash | |
- uses: clechasseur/rs-clippy-check@v3 | |
with: | |
args: --all-features | |
docs: | |
timeout-minutes: 45 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup | |
uses: ./.github/actions/devenv | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
nix-cache: /tmp/nixcache | |
- name: build docs | |
run: build:docs | |
shell: bash | |
test: | |
timeout-minutes: 45 | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
version: ["1.76.0", stable, ""] | |
env: | |
RUSTUP_TOOLCHAIN: ${{ matrix.version }} | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup | |
uses: ./.github/actions/devenv | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
nix-cache: /tmp/nixcache | |
- name: test `wallet_standard_wallets` with `ssr` | |
run: cargo test_wallet_standard_wallets_ssr | |
shell: bash | |
- name: test `wallet_standard_wallets` with `docs` | |
run: cargo test_wallet_standard_wallets_docs | |
shell: bash | |
- name: test `wasm_client_solana` with `ssr` | |
run: cargo test_wasm_client_solana_ssr | |
shell: bash | |
- name: test `wasm_client_solana` with `docs` | |
run: cargo test_wasm_client_solana_docs | |
shell: bash | |
- name: test `test_utils_solana` with `ssr` and `test_validator` | |
run: cargo test_streams | |
shell: bash | |
- name: test `example_client` | |
run: cargo test_example_client | |
shell: bash | |
- name: test `wasm` with background validator | |
run: | | |
rustup target add wasm32-unknown-unknown | |
test:validator | |
shell: bash | |
coverage: | |
timeout-minutes: 45 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup | |
uses: ./.github/actions/devenv | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
nix-cache: /tmp/nixcache | |
- name: test coverage | |
run: coverage:all | |
shell: bash | |
- name: upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
files: codecov.json | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build: | |
timeout-minutes: 45 | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
version: ["1.76.0", stable, ""] | |
env: | |
RUSTUP_TOOLCHAIN: ${{ matrix.version }} | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup | |
uses: ./.github/actions/devenv | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
nix-cache: /tmp/nixcache | |
- name: build | |
run: cargo build --locked | |
shell: bash | |
- name: build all features | |
run: build:all | |
shell: bash | |
release: | |
timeout-minutes: 45 | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: [test, lint, build] | |
steps: | |
- name: generate token | |
uses: actions/create-github-app-token@v1 | |
id: generate-token | |
with: | |
app-id: ${{ secrets.APP_ID }} # <-- GitHub App ID secret name | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} # <-- GitHub App private key secret name | |
- name: setup rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: release | |
uses: MarcoIeni/[email protected] | |
id: release-plz | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
- name: tag released prs | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
RELEASES: ${{ steps.release-plz.outputs.releases }} | |
run: | | |
set -e | |
# Iterate over released packages and add a label to the PRs | |
# shipped with the release. | |
for release in $(echo "$RELEASES" | jq -r -c '.[]'); do | |
package_name=$(echo "$release" | jq -r '.package_name') | |
version=$(echo "$release" | jq -r '.version') | |
prs_length=$(echo "$release" | jq '.prs | length') | |
if [ "$prs_length" -gt 0 ]; then | |
# Create label. | |
# Use `--force` to overwrite the label, | |
# so that the command does not fail if the label already exists. | |
label="released:$package_name-$version" | |
echo "Creating label $label" | |
gh label create $label --color BFD4F2 --force | |
for pr in $(echo "$release" | jq -r -c '.prs[]'); do | |
pr_number=$(echo "$pr" | jq -r '.number') | |
echo "Adding label $label to PR #$pr_number" | |
gh pr edit $pr_number --add-label $label | |
done | |
else | |
echo "No PRs found for package $package_name" | |
fi | |
done | |
shell: bash |