From 2e9e5c5c343ddd7980bb1a6c9b56aea3c7ed4fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sch=C3=B6nauer?= <37108907+DottoDev@users.noreply.github.com> Date: Sun, 16 Oct 2022 17:27:16 +0000 Subject: [PATCH 1/3] Added github workflow test (#1) * Delete main.yml * Delete release.yml * Delete release-cross.yml * Added github workflows * Changed workflow values --- .github/workflows/check-and-lint.yaml | 55 ++++++++++++++++++ .github/workflows/main.yml | 42 -------------- .github/workflows/release-cross.yml | 66 --------------------- .github/workflows/release-packaging.yaml | 27 +++++++++ .github/workflows/release.yml | 73 ------------------------ .github/workflows/test.yaml | 56 ++++++++++++++++++ 6 files changed, 138 insertions(+), 181 deletions(-) create mode 100644 .github/workflows/check-and-lint.yaml delete mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/release-cross.yml create mode 100644 .github/workflows/release-packaging.yaml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/check-and-lint.yaml b/.github/workflows/check-and-lint.yaml new file mode 100644 index 00000000..6eb45d48 --- /dev/null +++ b/.github/workflows/check-and-lint.yaml @@ -0,0 +1,55 @@ +on: + pull_request: + push: + branches: + - main + + +name: Check and Lint + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: check + + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + override: true + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features + name: Clippy Output diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index cfec6d82..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches: - - master - -jobs: - build: - strategy: - matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] - fail-fast: false - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.57.0 - profile: minimal - override: true - components: rustfmt, clippy - - uses: actions-rs/cargo@v1.0.1 - name: Check format - with: - command: fmt - args: --all -- --check - - uses: actions-rs/cargo@v1.0.1 - name: Run clippy - with: - command: clippy - args: --all-targets --locked -- -D warnings - - uses: actions-rs/cargo@v1.0.1 - name: Run clippy (All features) - with: - command: clippy - args: --all-targets --locked --all-features -- -D warnings - - uses: actions-rs/cargo@v1.0.1 - name: Run tests - with: - command: test diff --git a/.github/workflows/release-cross.yml b/.github/workflows/release-cross.yml deleted file mode 100644 index 7d3d4ef0..00000000 --- a/.github/workflows/release-cross.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: CD Cross - -on: - release: - types: [ created ] - -jobs: - build: - strategy: - fail-fast: false - matrix: - target: [ "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", "x86_64-unknown-linux-musl" ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.57.0 - profile: minimal - default: true - override: true - target: ${{ matrix.target }} - components: rustfmt, clippy - - uses: actions-rs/cargo@v1.0.1 - name: Check format - with: - use-cross: true - command: fmt - args: --all -- --check - - uses: actions-rs/cargo@v1.0.1 - name: Run clippy - with: - command: clippy - use-cross: true - args: --all-targets --locked --target ${{matrix.target}} -- -D warnings - - uses: actions-rs/cargo@v1.0.1 - name: Run clippy (All features) - with: - command: clippy - use-cross: true - args: --locked --all-features --target ${{matrix.target}} -- -D warnings - - uses: actions-rs/cargo@v1.0.1 - name: Run tests - with: - command: test - use-cross: true - args: --target ${{matrix.target}} - - uses: actions-rs/cargo@v1.0.1 - name: Build - with: - command: build - use-cross: true - args: --release --all-features --target ${{matrix.target}} - - name: Rename Release - run: | - mkdir assets - FILENAME=topgrade-${{github.event.release.tag_name}}-${{matrix.target}} - mv target/${{matrix.target}}/release/topgrade assets - cd assets - tar --format=ustar -czf $FILENAME.tar.gz topgrade - rm topgrade - ls . - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: assets/* diff --git a/.github/workflows/release-packaging.yaml b/.github/workflows/release-packaging.yaml new file mode 100644 index 00000000..5db6e1ba --- /dev/null +++ b/.github/workflows/release-packaging.yaml @@ -0,0 +1,27 @@ +on: + push: + branches: + - main + +name: Release Packaging + +jobs: + release: + name: Release Packaging + env: + PROJECT_NAME_UNDERSCORE: topgrade_rs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Release Build + run: cargo build --release + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: ${{ env.PROJECT_NAME_UNDERSCORE }} + path: target/release/${{ env.PROJECT_NAME_UNDERSCORE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ed30643f..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: CD Native - -on: - release: - types: [ created ] - -jobs: - build: - strategy: - fail-fast: false - matrix: - platform: [ ubuntu-latest, macos-latest, windows-latest ] - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.57.0 - profile: minimal - override: true - components: rustfmt, clippy - - uses: actions-rs/cargo@v1.0.1 - name: Check format - with: - command: fmt - args: --all -- --check - - uses: actions-rs/cargo@v1.0.1 - name: Run clippy - with: - command: clippy - args: --all-targets --locked -- -D warnings - - uses: actions-rs/cargo@v1.0.1 - name: Run clippy (All features) - with: - command: clippy - args: --all-targets --locked --all-features -- -D warnings - - uses: actions-rs/cargo@v1.0.1 - name: Run tests - with: - command: test - - uses: actions-rs/cargo@v1.0.1 - name: Build - with: - command: build - args: --release --all-features - - name: Rename Release (Unix) - run: | - cargo install default-target - mkdir assets - FILENAME=topgrade-${{github.event.release.tag_name}}-$(default-target) - mv target/release/topgrade assets - cd assets - tar --format=ustar -czf $FILENAME.tar.gz topgrade - rm topgrade - ls . - if: ${{ matrix.platform != 'windows-latest' }} - shell: bash - - name: Rename Release (Windows) - run: | - cargo install default-target - mkdir assets - FILENAME=topgrade-${{github.event.release.tag_name}}-$(default-target) - mv target/release/topgrade.exe assets/topgrade.exe - cd assets - powershell Compress-Archive -Path * -Destination ${FILENAME}.zip - rm topgrade.exe - ls . - if: ${{ matrix.platform == 'windows-latest' }} - shell: bash - - name: Release - uses: softprops/action-gh-release@v1 - with: - files: assets/* diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..98bfa98a --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,56 @@ +on: + pull_request: + push: + branches: + - main + +name: Test with Code Coverage + +jobs: + test: + name: Test + env: + PROJECT_NAME_UNDERSCORE: topgrade_rs + CARGO_INCREMENTAL: 0 + RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort + RUSTDOCFLAGS: -Cpanic=abort + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - name: Cache dependencies + uses: actions/cache@v2 + env: + cache-name: cache-dependencies + with: + path: | + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin + ~/.cargo/registry/index + ~/.cargo/registry/cache + target + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }} + - name: Generate test result and coverage report + run: | + cargo install cargo2junit grcov; + cargo test $CARGO_OPTIONS -- -Z unstable-options --format json | cargo2junit > results.xml; + zip -0 ccov.zip `find . \( -name "$PROJECT_NAME_UNDERSCORE*.gc*" \) -print`; + grcov ccov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" --ignore "tests/*" -o lcov.info; + - name: Upload test results + uses: EnricoMi/publish-unit-test-result-action@v1 + with: + check_name: Test Results + github_token: ${{ secrets.GITHUB_TOKEN }} + files: results.xml + - name: Upload to CodeCov + uses: codecov/codecov-action@v1 + with: + # required for private repositories: + # token: ${{ secrets.CODECOV_TOKEN }} + files: ./lcov.info + fail_ci_if_error: true From c7edd49e662b3ec888130ebe96e09325a7ece7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sch=C3=B6nauer?= Date: Sun, 16 Oct 2022 20:55:08 +0200 Subject: [PATCH 2/3] Edit workflow --- .github/workflows/release-packaging.yaml | 2 +- .github/workflows/test.yaml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-packaging.yaml b/.github/workflows/release-packaging.yaml index 5db6e1ba..a582fa02 100644 --- a/.github/workflows/release-packaging.yaml +++ b/.github/workflows/release-packaging.yaml @@ -9,7 +9,7 @@ jobs: release: name: Release Packaging env: - PROJECT_NAME_UNDERSCORE: topgrade_rs + PROJECT_NAME_UNDERSCORE: topgrade runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 98bfa98a..9478a1e0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,3 +1,4 @@ + on: pull_request: push: @@ -10,7 +11,7 @@ jobs: test: name: Test env: - PROJECT_NAME_UNDERSCORE: topgrade_rs + PROJECT_NAME_UNDERSCORE: topgrade CARGO_INCREMENTAL: 0 RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort RUSTDOCFLAGS: -Cpanic=abort From f59fad7996205c4f6f1647aa598a3a83f9da5021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sch=C3=B6nauer?= Date: Sun, 16 Oct 2022 21:24:52 +0200 Subject: [PATCH 3/3] Changes cargo.toml to new project --- Cargo.lock | 2 +- Cargo.toml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d91d01ae..f1475251 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1833,7 +1833,7 @@ dependencies = [ ] [[package]] -name = "topgrade" +name = "topgrade-rs" version = "9.0.1" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 29b5d04e..1b9e0a7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,15 @@ [package] -name = "topgrade" +name = "topgrade-rs" description = "Upgrade all the things" categories = ["os"] keywords = ["upgrade", "update"] license-file = "LICENSE" repository = "https://github.com/topgrade-rs/topgrade" version = "9.0.1" -authors = ["Roey Darwish Dror "] +authors = ["Thomas Schönauer"] exclude = ["doc/screenshot.gif"] edition = "2018" + readme = "README.md" [dependencies]