Skip to content

Commit

Permalink
ci: add workflow to update public api fixtures
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan committed Sep 18, 2023
1 parent 5f11811 commit 3dc36f6
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/update-public-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check release

permissions:
id-token: write # Enable OIDC
pull-requests: write
contents: write

on:
workflow_dispatch:

env:
UPDATE_EXPECT: 1

jobs:
update-fixtures:
name: Update Public API fixtures
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
rust: [stable]
job:
- os: macos-latest
- os: ubuntu-latest
- os: windows-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
with:
command: test
args: -r --test public_api -- --ignored
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: "tests/public_api_fixtures"
commit-message: "Update Public API fixtures"
branch: "update-public-api-fixtures"
delete-branch: true
base: "main"
title: "Update Public API fixtures"
9 changes: 6 additions & 3 deletions tests/public_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ fn public_api() {

// Assert that the public API looks correct
#[cfg(target_os = "windows")]
expect_test::expect_file!["public_api_data/public-api_win.txt"]
expect_test::expect_file!["public_api_fixtures/public-api_win.txt"]
.assert_eq(&public_api.to_string());
#[cfg(not(target_os = "windows"))]
expect_test::expect_file!["public_api_data/public-api_linux.txt"]
#[cfg(target_os = "unix")]
expect_test::expect_file!["public_api_fixtures/public-api_linux.txt"]
.assert_eq(&public_api.to_string());
#[cfg(target_os = "macos")]
expect_test::expect_file!["public_api_fixtures/public-api_macos.txt"]
.assert_eq(&public_api.to_string());
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3dc36f6

Please sign in to comment.