diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index fedf1d8..b28c1e6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -4,13 +4,17 @@ on: push: branches: [main] pull_request: +# Spend CI time only on latest ref: https://github.com/jonhoo/rust-ci-conf/pull/5 +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true name: check jobs: fmt: runs-on: ubuntu-latest name: stable / fmt steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install stable @@ -30,7 +34,7 @@ jobs: matrix: toolchain: [stable, beta] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install ${{ matrix.toolchain }} @@ -46,7 +50,7 @@ jobs: runs-on: ubuntu-latest name: nightly / doc steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install nightly @@ -59,7 +63,7 @@ jobs: runs-on: ubuntu-latest name: ubuntu / stable / features steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install stable @@ -75,10 +79,10 @@ jobs: # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability strategy: matrix: - msrv: [1.53.0] # https://github.com/rust-lang/rust/pull/83707 + msrv: ["1.53.0"] # https://github.com/rust-lang/rust/pull/83707 name: ubuntu / ${{ matrix.msrv }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install ${{ matrix.msrv }} diff --git a/.github/workflows/safety.yml b/.github/workflows/safety.yml index c07feec..3714640 100644 --- a/.github/workflows/safety.yml +++ b/.github/workflows/safety.yml @@ -4,12 +4,16 @@ on: push: branches: [main] pull_request: +# Spend CI time only on latest ref: https://github.com/jonhoo/rust-ci-conf/pull/5 +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true name: safety jobs: sanitizers: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install nightly @@ -19,8 +23,15 @@ jobs: sudo apt install llvm # to fix buggy leak analyzer: # https://github.com/japaric/rust-san#unrealiable-leaksanitizer - sed -i '/\[features\]/i [profile.dev]' Cargo.toml - sed -i '/profile.dev/a opt-level = 1' Cargo.toml + # ensure there's a profile.dev section + if ! grep -qE '^[ \t]*[profile.dev]' Cargo.toml; then + echo >> Cargo.toml + echo '[profile.dev]' >> Cargo.toml + fi + # remove pre-existing opt-levels in profile.dev + sed -i '/^\s*\[profile.dev\]/,/^\s*\[/ {/^\s*opt-level/d}' Cargo.toml + # now set opt-level to 1 + sed -i '/^\s*\[profile.dev\]/a opt-level = 1' Cargo.toml cat Cargo.toml name: Enable debug symbols - name: cargo test -Zsanitizer=address @@ -38,7 +49,7 @@ jobs: miri: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - run: | diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 0215432..4607f3e 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -6,6 +6,10 @@ on: pull_request: schedule: - cron: '7 7 * * *' +# Spend CI time only on latest ref: https://github.com/jonhoo/rust-ci-conf/pull/5 +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true name: rolling jobs: # https://twitter.com/mycoliza/status/1571295690063753218 @@ -13,7 +17,7 @@ jobs: runs-on: ubuntu-latest name: ubuntu / nightly steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install nightly @@ -32,7 +36,7 @@ jobs: # Unfortunately, hashFiles only works in if on steps, so we reepeat it. # if: hashFiles('Cargo.lock') != '' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install beta diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c675b38..56bd560 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,10 @@ on: push: branches: [main] pull_request: +# Spend CI time only on latest ref: https://github.com/jonhoo/rust-ci-conf/pull/5 +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true name: test jobs: required: @@ -13,7 +17,7 @@ jobs: matrix: toolchain: [stable, beta] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install ${{ matrix.toolchain }} @@ -33,7 +37,7 @@ jobs: runs-on: ubuntu-latest name: ubuntu / stable / minimal-versions steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install stable @@ -54,7 +58,13 @@ jobs: matrix: os: [macos-latest, windows-latest] steps: - - uses: actions/checkout@v3 + # if your project needs OpenSSL, uncommment this to fix Windows builds. + # it's commented out by default as tthe install command takes 5-10m. + # - run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append + # if: runner.os == 'Windows' + # - run: vcpkg install openssl:x64-windows-static-md + # if: runner.os == 'Windows' + - uses: actions/checkout@v4 with: submodules: true - name: Install stable @@ -68,7 +78,7 @@ jobs: runs-on: ubuntu-latest name: ubuntu / stable / coverage steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install stable