From 0439319a886e0372b17fbc911c1b9667707153fd Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 23 Jan 2024 21:23:07 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20remove=20CI=20(wrong=20PR)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: David Bernard --- .github/workflows/ci.yml | 39 ------- .github/workflows/mega-linter.yml | 173 ------------------------------ justfile | 83 -------------- 3 files changed, 295 deletions(-) delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/mega-linter.yml delete mode 100644 justfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ae254b4..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: ci - -on: - push: - workflow_dispatch: - -permissions: - contents: read - -jobs: - tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - env: - CARGO_TERM_COLOR: always - RUST_BACKTRACE: full - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: "true" - - uses: jdx/rtx-action@v1 - - name: Cache cargo registry - uses: actions/cache@v3 - continue-on-error: false - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - run: just check - - run: just lint_rust # megalinter is running via an other workflow - - run: just test diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml deleted file mode 100644 index 190c18b..0000000 --- a/.github/workflows/mega-linter.yml +++ /dev/null @@ -1,173 +0,0 @@ -# MegaLinter GitHub Action configuration file -# More info at https://megalinter.io ---- -name: MegaLinter - -# Trigger mega-linter at every push. Action will also be visible from Pull -# Requests to main -on: - # Comment this line to trigger action only on pull-requests - # (not recommended if you don't pay for GH Actions) - push: - - # pull_request: - # branches: - # - main - # - master - -# Comment env block if you do not want to apply fixes -env: - # Apply linter fixes configuration - # - # When active, APPLY_FIXES must also be defined as environment variable - # (in github/workflows/mega-linter.yml or other CI tool) - APPLY_FIXES: all - - # Decide which event triggers application of fixes in a commit or a PR - # (pull_request, push, all) - APPLY_FIXES_EVENT: pull_request - - # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) - # or posted in a PR (pull_request) - APPLY_FIXES_MODE: commit - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -# Give the default GITHUB_TOKEN write permission to commit and push, comment -# issues & post new PR; remove the ones you do not need -permissions: - contents: write - issues: write - pull-requests: write - -jobs: - megalinter: - name: MegaLinter - runs-on: ubuntu-latest - - steps: - # Git Checkout - - name: Checkout Code - uses: actions/checkout@v4 - with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} - - # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to - # improve performance - fetch-depth: 0 - - # MegaLinter - - name: MegaLinter - - # You can override MegaLinter flavor used to have faster performances - # More info at https://megalinter.io/flavors/ - uses: oxsecurity/megalinter@v7 - - id: ml - - # All available variables are described in documentation - # https://megalinter.io/configuration/ - env: - # Validates all source when push on main, else just the git diff with - # main. Override with true if you always want to lint all sources - # - # To validate the entire codebase, set to: - # VALIDATE_ALL_CODEBASE: true - # - # To validate only diff with main, set to: - # VALIDATE_ALL_CODEBASE: >- - # ${{ - # github.event_name == 'push' && - # contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref) - # }} - VALIDATE_ALL_CODEBASE: >- - ${{ - github.event_name == 'push' && - contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref) - }} - - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE - # .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY - - # Uncomment to disable copy-paste and spell checks - # DISABLE: COPYPASTE,SPELL - - # Upload MegaLinter artifacts - - name: Archive production artifacts - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: MegaLinter reports - path: | - megalinter-reports - mega-linter.log - - # Set APPLY_FIXES_IF var for use in future steps - - name: Set APPLY_FIXES_IF var - run: | - printf 'APPLY_FIXES_IF=%s\n' "${{ - steps.ml.outputs.has_updated_sources == 1 && - ( - env.APPLY_FIXES_EVENT == 'all' || - env.APPLY_FIXES_EVENT == github.event_name - ) && - ( - github.event_name == 'push' || - github.event.pull_request.head.repo.full_name == github.repository - ) - }}" >> "${GITHUB_ENV}" - - # Set APPLY_FIXES_IF_* vars for use in future steps - - name: Set APPLY_FIXES_IF_* vars - run: | - printf 'APPLY_FIXES_IF_PR=%s\n' "${{ - env.APPLY_FIXES_IF == 'true' && - env.APPLY_FIXES_MODE == 'pull_request' - }}" >> "${GITHUB_ENV}" - printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{ - env.APPLY_FIXES_IF == 'true' && - env.APPLY_FIXES_MODE == 'commit' && - (!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref)) - }}" >> "${GITHUB_ENV}" - - # Create pull request if applicable - # (for now works only on PR from same repository, not from forks) - - name: Create Pull Request with applied fixes - uses: peter-evans/create-pull-request@v5 - id: cpr - if: env.APPLY_FIXES_IF_PR == 'true' - with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} - commit-message: "[MegaLinter] Apply linters automatic fixes" - title: "[MegaLinter] Apply linters automatic fixes" - labels: bot - - - name: Create PR output - if: env.APPLY_FIXES_IF_PR == 'true' - run: | - echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}" - - # Push new commit if applicable - # (for now works only on PR from same repository, not from forks) - - name: Prepare commit - if: env.APPLY_FIXES_IF_COMMIT == 'true' - run: sudo chown -Rc $UID .git/ - - - name: Commit and push applied linter fixes - uses: stefanzweifel/git-auto-commit-action@v5 - if: env.APPLY_FIXES_IF_COMMIT == 'true' - with: - branch: >- - ${{ - github.event.pull_request.head.ref || - github.head_ref || - github.ref - }} - commit_message: "[MegaLinter] Apply linters fixes" - commit_user_name: megalinter-bot - commit_user_email: nicolas.vuillamy@ox.security diff --git a/justfile b/justfile deleted file mode 100644 index 82bdee5..0000000 --- a/justfile +++ /dev/null @@ -1,83 +0,0 @@ -# TODO add a task to automatically update the README with the content of examples - -default: - @just --list --unsorted - -_install_cargo-binstall: - # cargo install cargo-binstall - cargo binstall -V || curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash - -_install_cargo-nextest: _install_cargo-binstall - cargo binstall cargo-nextest -y - -_install_cargo-insta: _install_cargo-binstall - cargo binstall cargo-insta -y - -_install_cargo-release: _install_cargo-binstall - cargo binstall cargo-release -y - -_install_cargo-hack: _install_cargo-binstall - cargo binstall cargo-hack -y - -_install_cargo-deny: _install_cargo-binstall - cargo binstall cargo-deny -y - -_install_git-cliff: _install_cargo-binstall - cargo binstall git-cliff -y - -check: _install_cargo-hack - cargo hack check --each-feature --no-dev-deps - -generate: - # cd generator; cargo run - cargo run -p generator -- --templates-dir "generator/templates" --jsonschema-dir "cdevents-spec/schemas" --dest "cdevents-sdk/src/generated" - -build: - cargo build - -alias fmt := format - -# Format the code and sort dependencies -format: - cargo fmt - @# cargo sort --workspace --grouped - just --unstable --fmt - -deny: _install_cargo-deny - cargo deny check advisories - cargo deny check bans licenses sources - -# Lint all the code (megalinter + lint_rust) -lint: lint_rust megalinter - -# Lint the rust code -lint_rust: - just --unstable --fmt --check - cargo fmt --all -- --check # generated code is not formatted - # cargo sort --workspace --grouped --check - cargo clippy --workspace --all-features --all-targets -- --deny warnings --allow deprecated --allow unknown-lints - -# Lint with megalinter (locally via docker) -megalinter: - # rm -rf megalinter-reports - docker run --rm --name megalinter -it --env "DEFAULT_WORKSPACE=/tmp/lint" -v "${DOCKER_HOST:-/var/run/docker.sock}:/var/run/docker.sock:rw" -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter:v7" - -# Launch tests -test: _install_cargo-nextest - cargo nextest run - cargo test --doc - @# cargo hack test --each-feature - @# cargo hack nextest --each-feature -- --test-threads=1 # [cargo-hack and cargo-nextest don't compose well](https://github.com/nextest-rs/nextest/issues/1029) - -changelog: _install_git-cliff - git-cliff -o "CHANGELOG.md" - git add CHANGELOG.md && git commit -m "📝 update CHANGELOG" - -release *arguments: _install_cargo-release _install_git-cliff - cargo release --workspace --execute {{ arguments }} - @# git-cliff could not be used as `pre-release-hook` of cargo-release because it uses tag - git-cliff -o "CHANGELOG.md" - git add CHANGELOG.md && git commit -m "📝 update CHANGELOG" && git push - -run_examples: - cargo run --example pipelinerun_finished