aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/dependabot.yml27
-rw-r--r--.github/workflows/beam.yml56
-rw-r--r--.github/workflows/c.yml6
-rw-r--r--.github/workflows/changesets.yml41
-rw-r--r--.github/workflows/deno.yml37
-rw-r--r--.github/workflows/dependabot-auto.yaml1
-rw-r--r--.github/workflows/docker.yml18
-rw-r--r--.github/workflows/dotnet.yml17
-rw-r--r--.github/workflows/go.yml4
-rw-r--r--.github/workflows/jvm.yml100
-rw-r--r--.github/workflows/lint.yml90
-rw-r--r--.github/workflows/node.yml16
-rw-r--r--.github/workflows/python.yml10
-rw-r--r--.github/workflows/ruby.yml84
-rw-r--r--.github/workflows/rust.yml27
15 files changed, 419 insertions, 115 deletions
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 317b202..998ee1a 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -50,3 +50,30 @@ updates:
applies-to: version-updates
patterns:
- "*"
+ - package-ecosystem: "gradle"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ groups:
+ jvm-dependencies:
+ applies-to: version-updates
+ patterns:
+ - "*"
+ - package-ecosystem: "gomod"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ groups:
+ golang-dependencies:
+ applies-to: version-updates
+ patterns:
+ - "*"
+ - package-ecosystem: "bundler"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ groups:
+ ruby-dependencies:
+ applies-to: version-updates
+ patterns:
+ - "*" \ No newline at end of file
diff --git a/.github/workflows/beam.yml b/.github/workflows/beam.yml
new file mode 100644
index 0000000..c8785d7
--- /dev/null
+++ b/.github/workflows/beam.yml
@@ -0,0 +1,56 @@
+name: BEAM
+
+on:
+ push:
+ paths:
+ - "**.ex*"
+ - "**.erl"
+ - "**.beam"
+ pull_request:
+ paths:
+ - "**.ex*"
+ - "**.erl"
+ - "**.beam"
+
+jobs:
+ lint-build-and-test:
+ name: Lint, Build and Test
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup the BEAM
+ uses: erlef/setup-beam@v1
+ with:
+ otp-version: latest
+ elixir-version: latest
+ gleam-version: latest
+ - name: Install dependencies
+ run: mix deps.get
+ - name: Lint
+ run: mix format --check-formatted
+ - name: Test
+ run: mix test
+ publish:
+ name: Publish to hex.pm
+ needs: lint-build-and-test
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Setup the BEAM
+ uses: erlef/setup-beam@v1
+ with:
+ otp-version: latest
+ elixir-version: latest
+ gleam-version: latest
+ - name: Publish
+ run: mix hex.publish --yes
+ env:
+ HEX_API_KEY: ${{ secrets.HEX_TOKEN }} \ No newline at end of file
diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml
index 2d610ca..0d9ea06 100644
--- a/.github/workflows/c.yml
+++ b/.github/workflows/c.yml
@@ -8,7 +8,7 @@ on:
- "CMakeLists.txt"
- "meson.build"
- "configure.ac"
- - "GNUMakefile.am"
+ - "GNUmakefile.am"
- "ocusts.pc.in"
- ".github/workflows/c.yml"
pull_request:
@@ -18,7 +18,7 @@ on:
- "CMakeLists.txt"
- "meson.build"
- "configure.ac"
- - "GNUMakefile.am"
+ - "GNUmakefile.am"
- "ocusts.pc.in"
- ".github/workflows/c.yml"
@@ -85,7 +85,7 @@ jobs:
- name: Install dependencies
run: python -m pip install meson ninja
- name: Configure Meson
- run: meson build
+ run: meson setup build
- name: Build
run: ninja -C build
- name: Test
diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml
new file mode 100644
index 0000000..643c5aa
--- /dev/null
+++ b/.github/workflows/changesets.yml
@@ -0,0 +1,41 @@
+name: Changesets
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ changesets:
+ name: Changesets
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Cache turborepo
+ uses: actions/cache@v4
+ with:
+ path: .turbo
+ key: ${{ runner.os }}-turbo-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-turbo-
+ - name: Install needed softwares
+ run: sudo apt-get -y install ripgrep moreutils
+ - name: Install pnpm and dependencies
+ uses: pnpm/action-setup@v4
+ with:
+ run_install: true
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "latest"
+ - name: Create PR or Publish
+ id: changesets
+ uses: changesets/action@v1
+ with:
+ version: pnpm versioning
+ publish: pnpm publish-packages
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ NPM_CONFIG_PROVENANCE: tre
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file
diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml
new file mode 100644
index 0000000..4f861bd
--- /dev/null
+++ b/.github/workflows/deno.yml
@@ -0,0 +1,37 @@
+name: Deno
+
+on:
+ push:
+ paths:
+ - "src/packages/locusts/mod.ts"
+ - "**/deno.json"
+ - ".github/workflows/deno.yml"
+ pull_request:
+ paths:
+ - "src/packages/locusts/mod.ts"
+ - "**/deno.json"
+ - ".github/workflows/deno.yml"
+
+jobs:
+ lint-test-and-publish:
+ name: Lint and Test
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ id-token: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Deno
+ uses: denoland/setup-deno@v2
+ with:
+ deno-version: v2.x
+ - name: Lint
+ run: |
+ deno lint
+ # Weirdly broken
+ # deno fmt --check
+ - name: Test
+ run: deno test src/packages/locusts/mod.ts
+ - name: Publish on Tag
+ run: deno run -A jsr:@david/publish-on-tag --allow-dirty \ No newline at end of file
diff --git a/.github/workflows/dependabot-auto.yaml b/.github/workflows/dependabot-auto.yaml
index 911b094..d7a7adb 100644
--- a/.github/workflows/dependabot-auto.yaml
+++ b/.github/workflows/dependabot-auto.yaml
@@ -10,6 +10,7 @@ permissions:
jobs:
review-dependabot-pr:
+ name: Review Dependabot PR
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
steps:
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 0b10a77..c35c7d4 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -13,7 +13,6 @@ on:
- ".github/workflows/docker.yml"
env:
- REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
@@ -30,15 +29,26 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
+ - name: Lint
+ uses: hadolint/hadolint-action@v3.1.0
+ with:
+ dockerfile: Dockerfile
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- - name: Login to GitHub Registry
+ images: |
+ ghcr.io/${{ env.IMAGE_NAME }}
+ rosstheross/locusts
+ - name: Login to DockerHub
+ uses: docker/login-action@v3
+ with:
+ username: rosstheross
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Login to GHCR
uses: docker/login-action@v3
with:
- registry: ${{ env.REGISTRY }}
+ registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index eb34285..6c525bd 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -15,8 +15,8 @@ on:
- ".github/workflows/dotnet.yml"
jobs:
- build-and-test:
- name: Build and Test
+ build-lint-and-test:
+ name: Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -30,12 +30,14 @@ jobs:
uses: actions/setup-dotnet@v4
- name: Install dependencies
run: dotnet restore
+ - name: Lint
+ run: dotnet format --verify-no-changes
- name: Test
run: dotnet test --no-restore
publish-preview:
name: Publish Preview NuGet to GitHub Packages
- needs: build-and-test
+ needs: build-lint-and-test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
permissions:
@@ -61,8 +63,9 @@ jobs:
publish-release:
name: Publish Release NuGet to NuGet.org
- needs: build-and-test
- if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') }}
+ needs: build-lint-and-test
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -72,11 +75,11 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
env:
- NUGET_AUTH_TOKEN: ${{ secrets.NUGET_KEY }}
+ NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
- name: Install dependencies
run: dotnet restore
- name: Build the package
run: dotnet build --configuration Release --no-restore -p:SymbolPackageFormat=snupkg
- name: Publish the package
run: |
- dotnet nuget push src/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json
+ dotnet nuget push src/bin/Release/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_TOKEN }}
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 43adef1..6fbe548 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -13,8 +13,8 @@ on:
- ".github/workflows/go.yml"
jobs:
- build:
- name: Build and Test
+ lint-build-and-test:
+ name: Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
diff --git a/.github/workflows/jvm.yml b/.github/workflows/jvm.yml
new file mode 100644
index 0000000..2ea4fbc
--- /dev/null
+++ b/.github/workflows/jvm.yml
@@ -0,0 +1,100 @@
+name: JVM
+
+on:
+ push:
+ paths:
+ - "**.java"
+ - "**.kt"
+ - "**.kts"
+ - "**.gradle"
+ - ".github/workflows/jvm.yml"
+ pull_request:
+ paths:
+ - "**.java"
+ - "**.kt"
+ - "**.kts"
+ - "**.gradle"
+ - ".github/workflows/jvm.yml"
+
+jobs:
+ lint-build-and-test:
+ name: Lint, Build and Test
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ lfs: true
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ cache: 'gradle'
+ distribution: 'adopt'
+ java-version: '11'
+ - name: Build with Gradle
+ run: ./gradlew build
+
+ publish-snapshot:
+ name: Publish Snapshot to GitHub Packages
+ needs: lint-build-and-test
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
+ runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: read
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ lfs: true
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ cache: 'gradle'
+ distribution: 'adopt'
+ java-version: '11'
+ - name: Snapshot version
+ run: sed '/^version/ s/$/-SNAPSHOT/' gradle.properties -i
+ - name: Build with Gradle
+ run: ./gradlew build
+ - name: Publish the preview package
+ run: ./gradlew publishAllPublicationsToGitHubPackagesRepository
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+
+ publish-release:
+ name: Publish Packages to Maven Central and GitHub Packages
+ needs: lint-build-and-test
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
+ runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ lfs: true
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ cache: 'gradle'
+ distribution: 'adopt'
+ java-version: '11'
+ - name: Build with Gradle
+ run: ./gradlew build
+ - name: Publish the package
+ run: ./gradlew publish
+ env:
+ MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index bd65a3a..0000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,90 +0,0 @@
-# MegaLinter GitHub Action configuration file
-# More info at https://megalinter.io
-name: Lint with MegaLinter
-
-on:
- # Trigger mega-linter at every push. Action will also be visible from Pull Requests to main
- push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
- pull_request:
- branches: [master]
-
-env: # Comment env block if you don't want to apply fixes
- # Apply linter fixes configuration
- APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
- APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
- APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)
-
-concurrency:
- group: ${{ github.ref }}-${{ github.workflow }}
- cancel-in-progress: true
-
-jobs:
- megalinter:
- name: MegaLinter
- runs-on: ubuntu-latest
- permissions:
- # Give the default GITHUB_TOKEN write permission to commit and push, comment issues & post new PR
- # Remove the ones you do not need
- contents: write
- issues: write
- pull-requests: write
- steps:
- # Git Checkout
- - name: Checkout Code
- uses: actions/checkout@v4
- with:
- token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
- fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances
-
- # MegaLinter
- - name: MegaLinter
- id: ml
- # You can override MegaLinter flavor used to have faster performances
- # More info at https://megalinter.io/flavors/
- uses: oxsecurity/megalinter@v8
- env:
- # All available variables are described in documentation
- # https://megalinter.io/configuration/
- VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} # 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
- 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
- # DISABLE: COPYPASTE,SPELL # Uncomment to disable copy-paste and spell checks
-
- # Upload MegaLinter artifacts
- - name: Archive production artifacts
- if: success() || failure()
- uses: actions/upload-artifact@v4
- with:
- name: MegaLinter reports
- path: |
- megalinter-reports
- mega-linter.log
-
- # Create pull request if applicable (for now works only on PR from same repository, not from forks)
- - name: Create Pull Request with applied fixes
- id: cpr
- if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- uses: peter-evans/create-pull-request@v7
- 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: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- run: |
- echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
- echo "Pull Request 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: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- run: sudo chown -Rc $UID .git/
- - name: Commit and push applied linter fixes
- if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
- uses: stefanzweifel/git-auto-commit-action@v5
- 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 \ No newline at end of file
diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml
index 82c5c82..03cac87 100644
--- a/.github/workflows/node.yml
+++ b/.github/workflows/node.yml
@@ -10,6 +10,7 @@ on:
- "turbo.json"
- ".github/workflows/node.yml"
- ".syncpackrc"
+ - "**.svelte"
pull_request:
paths:
- "**.js"
@@ -19,11 +20,15 @@ on:
- "turbo.json"
- ".github/workflows/node.yml"
- ".syncpackrc"
+ - "**.svelte"
jobs:
- build-and-test:
- name: Build and Test
- runs-on: ubuntu-latest
+ lint-build-and-test:
+ name: Lint, Build and Test
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Cache turborepo
@@ -37,11 +42,12 @@ jobs:
uses: pnpm/action-setup@v4
with:
run_install: true
- version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
cache: "pnpm"
- - name: Build and Test
+ - name: Check formatting
+ run: pnpm lint
+ - name: Lint, Build and Test
run: pnpm build && pnpm test
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml
index 240049e..6ad222c 100644
--- a/.github/workflows/python.yml
+++ b/.github/workflows/python.yml
@@ -34,15 +34,19 @@ jobs:
- name: Build
run: python -m build
- name: Test
- run: python -m unittest discover -s src/locusts-r-us
+ run: python -m unittest discover -s src
publish:
name: Publish to PyPI
needs: build-and-test
- if: ${{ github.event_name == 'tag' && startsWith(github.ref, 'refs/tags') }}
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
permissions:
id-token: write
+ environment:
+ name: pypi
+ url: https://pypi.org/r/locusts-r-us
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -58,3 +62,5 @@ jobs:
run: python -m build --sdist --wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ attestations: true
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
new file mode 100644
index 0000000..8ec504e
--- /dev/null
+++ b/.github/workflows/ruby.yml
@@ -0,0 +1,84 @@
+name: Ruby
+
+on:
+ push:
+ paths:
+ - "**.rb"
+ - "**.gemspec"
+ - "Gemfile"
+ - "Gemfile.lock"
+ - "Rakefile"
+ - ".github/workflows/ruby.yml"
+ pull_request:
+ paths:
+ - "**.rb"
+ - "**.gemspec"
+ - "Gemfile"
+ - "Gemfile.lock"
+ - "Rakefile"
+ - ".github/workflows/ruby.yml"
+
+jobs:
+ lint-build-and-test:
+ runs-on: ubuntu-latest
+ name: Ruby
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ruby
+ bundler-cache: true
+ - name: Lint, Build and Test with Rake
+ run: bundle exec rake
+
+ publish-preview:
+ runs-on: ubuntu-latest
+ needs: lint-build-and-test
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
+ name: Publish Preview to GitHub Package Registry
+ permissions:
+ packages: write
+ contents: read
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set version to pre-release
+ run: |
+ sed "s/$(jq -r .version package.json)/$(jq -r .version package.json).pre/" locusts.gemspec -i
+ sed "s/$(jq -r .version package.json)/$(jq -r .version package.json).pre/" Gemfile.lock -i
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ruby
+ bundler-cache: true
+ - name: Build gem
+ run: bundle exec rake build
+ - name: Set up GitHub Package Registry for RubyGems
+ run: |
+ mkdir -p ~/.gem
+ touch ~/.gem/credentials
+ chmod 0600 ~/.gem/credentials
+ echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
+ - name: Publish gem
+ run: gem push --key github --host https://rubygems.pkg.github.com/locusts-r-us pkg/*.gem
+
+ publish-release:
+ name: Push gem to RubyGems.org
+ needs: lint-build-and-test
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
+ steps:
+ # Set up
+ - uses: actions/checkout@v4
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ ruby-version: ruby
+ - name: Build gem
+ run: bundle exec rake build
+ - name: Publish gem
+ uses: rubygems/release-gem@v1 \ No newline at end of file
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 7defc50..2f86db0 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -13,8 +13,8 @@ on:
- ".github/workflows/rust.yml"
jobs:
- rust:
- name: Build and Test
+ lint-build-test:
+ name: Lint, Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -24,5 +24,28 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: Lint
+ run: |
+ cargo fmt --all --check
+ cargo clippy
- name: Test
run: cargo test --verbose
+
+ publish:
+ name: Publish to crates.io
+ needs: lint-build-test
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: Publish
+ run: cargo publish
+ env:
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} \ No newline at end of file