From 5d4616f30dc03eb745bb92b771f10d6616bad661 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 9 Jan 2025 13:11:59 +0000 Subject: [PATCH 1/7] Add stress step to CI --- .github/workflows/stress.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/stress.yml diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml new file mode 100644 index 00000000..994c45e7 --- /dev/null +++ b/.github/workflows/stress.yml @@ -0,0 +1,67 @@ +name: Stress test the package + +on: + push: + branches: + - main + pull_request: + paths: + - 'bin/**' + - 'fitsio/**' + - 'fitsio-derive/**' + - 'fitsio-sys/**' + - 'testdata/**' + - 'Cargo.toml' + - 'Cargo.lock' + - 'Cross.toml' + - 'rust-toolchain.toml' + - '.github/workflows/*.yml' + +# Only one pull-request triggered run should be executed at a time +# (head_ref is only set for PR events, otherwise fallback to run_id which differs for every run). +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + stress: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - macos-13 + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install ubuntu dependencies + run: | + sudo apt-get update && sudo apt-get install --no-install-recommends -y \ + llvm-dev \ + libcfitsio-dev \ + pkg-config \ + libssl-dev \ + python3 + + - name: Install toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: beta + + - uses: Swatinem/rust-cache@v2 + + - name: cargo generate-lockfile + # enable this ci template to run regardless of whether the lockfile is checked in or not + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + + - name: Install cargo-stress + run: cargo install cargo-stress + + - name: Stress test the code + working-directory: fitsio + run: cargo stress + From 9d6657f8d0e5327dd012de175c350b24ba6b5848 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 9 Jan 2025 13:12:32 +0000 Subject: [PATCH 2/7] Add ubuntu to os test matrix --- .github/workflows/stress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml index 994c45e7..a0c878a0 100644 --- a/.github/workflows/stress.yml +++ b/.github/workflows/stress.yml @@ -30,6 +30,7 @@ jobs: fail-fast: false matrix: os: + - ubuntu-latest - macos-latest - macos-13 From 0f85c3679bee2970aef80e441be231ec558f8033 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 9 Jan 2025 13:13:21 +0000 Subject: [PATCH 3/7] Fix yaml formatting --- .github/workflows/stress.yml | 52 +++++++++++++++++------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml index a0c878a0..c834d084 100644 --- a/.github/workflows/stress.yml +++ b/.github/workflows/stress.yml @@ -6,11 +6,9 @@ on: - main pull_request: paths: - - 'bin/**' - 'fitsio/**' - 'fitsio-derive/**' - 'fitsio-sys/**' - - 'testdata/**' - 'Cargo.toml' - 'Cargo.lock' - 'Cross.toml' @@ -34,35 +32,35 @@ jobs: - macos-latest - macos-13 - steps: - - name: Checkout sources - uses: actions/checkout@v4 + steps: + - name: Checkout sources + uses: actions/checkout@v4 - - name: Install ubuntu dependencies - run: | - sudo apt-get update && sudo apt-get install --no-install-recommends -y \ - llvm-dev \ - libcfitsio-dev \ - pkg-config \ - libssl-dev \ - python3 + - name: Install ubuntu dependencies + run: | + sudo apt-get update && sudo apt-get install --no-install-recommends -y \ + llvm-dev \ + libcfitsio-dev \ + pkg-config \ + libssl-dev \ + python3 - - name: Install toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: beta + - name: Install toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: beta - - uses: Swatinem/rust-cache@v2 + - uses: Swatinem/rust-cache@v2 - - name: cargo generate-lockfile - # enable this ci template to run regardless of whether the lockfile is checked in or not - if: hashFiles('Cargo.lock') == '' - run: cargo generate-lockfile + - name: cargo generate-lockfile + # enable this ci template to run regardless of whether the lockfile is checked in or not + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile - - name: Install cargo-stress - run: cargo install cargo-stress + - name: Install cargo-stress + run: cargo install cargo-stress - - name: Stress test the code - working-directory: fitsio - run: cargo stress + - name: Stress test the code + working-directory: fitsio + run: cargo stress From 95ca3934d2be3653f7e9267ae6c6ff5e9997b628 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 9 Jan 2025 13:16:38 +0000 Subject: [PATCH 4/7] Empty From d734d2e6a21c214bbed7d5c0eb044bd5bc7e4dc6 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 9 Jan 2025 23:24:47 +0000 Subject: [PATCH 5/7] Install macos dependencies on macos --- .github/workflows/stress.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml index c834d084..3f6b7902 100644 --- a/.github/workflows/stress.yml +++ b/.github/workflows/stress.yml @@ -36,14 +36,9 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 - - name: Install ubuntu dependencies + - name: Install dependencies run: | - sudo apt-get update && sudo apt-get install --no-install-recommends -y \ - llvm-dev \ - libcfitsio-dev \ - pkg-config \ - libssl-dev \ - python3 + brew install cfitsio python3 - name: Install toolchain uses: dtolnay/rust-toolchain@master From fefc539705e9aee9f3af3591da582b603c53b983 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 9 Jan 2025 23:29:42 +0000 Subject: [PATCH 6/7] Set up workflow dispatch mode --- .github/workflows/stress.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml index 3f6b7902..ee4a5b2e 100644 --- a/.github/workflows/stress.yml +++ b/.github/workflows/stress.yml @@ -1,9 +1,8 @@ name: Stress test the package on: - push: - branches: - - main + # workflow_dispatch: + # TMP: only add this automatic step while developing pull_request: paths: - 'fitsio/**' From 30248130125b80c8e5f67336110981cd9cafd5f4 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Thu, 9 Jan 2025 23:29:53 +0000 Subject: [PATCH 7/7] Handle ubuntu and macos platforms --- .github/workflows/stress.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml index ee4a5b2e..588f7d13 100644 --- a/.github/workflows/stress.yml +++ b/.github/workflows/stress.yml @@ -36,9 +36,20 @@ jobs: uses: actions/checkout@v4 - name: Install dependencies + if: matrix.os != 'ubuntu-latest' run: | brew install cfitsio python3 + - name: Install ubuntu dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update && sudo apt-get install --no-install-recommends -y \ + llvm-dev \ + libcfitsio-dev \ + pkg-config \ + libssl-dev \ + python3 + - name: Install toolchain uses: dtolnay/rust-toolchain@master with: