Skip to content

Commit

Permalink
Merge pull request #24 from apimeister/release-pipe
Browse files Browse the repository at this point in the history
implement release pipeline
  • Loading branch information
alexkunde authored Aug 28, 2023
2 parents 480520c + 29a667a commit d2ef79d
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ jobs:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install cargo-llvm-cov and nextest
uses: taiki-e/install-action@v2
with:
tool: nextest,cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
env:
RUST_LOG: debug
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info nextest --no-fail-fast
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,31 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: rustup update stable
- name: Add Musl Target
run: rustup target add x86_64-unknown-linux-musl
- name: Run rustfmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all -- -D warnings
run: cargo clippy --all-targets -- -D warnings
- uses: taiki-e/install-action@nextest
- name: Cargo Test
run: cargo nextest run
run: cargo nextest run --no-fail-fast
- name: merge
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
run: |
gh pr merge --merge $GITHUB_HEAD_REF
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Compile
run: |
sudo apt-get install musl-tools
cargo build --release --target x86_64-unknown-linux-musl;
ldd target/x86_64-unknown-linux-musl/release/unpatched-agent;
- name: dtz upload
if: github.ref_name == 'main'
uses: DownToZero-cloud/objectstore-upload@main
with:
api_key: ${{ secrets.DTZ_API_KEY }}
context_id: ${{ secrets.DTZ_CONTEXT_ID }}
object_key: unpatched-agent
name: target/x86_64-unknown-linux-musl/release/unpatched-agent
107 changes: 107 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
create-winlinux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.rustup
/usr/local/cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: rustup update stable
- name: Run rustfmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets -- -D warnings
- uses: taiki-e/install-action@nextest
- name: Cargo Test
run: cargo nextest run --no-fail-fast
- name: Install Targets
run: |
rustup target add x86_64-pc-windows-gnu x86_64-unknown-linux-musl
sudo apt install -y musl-tools gcc-mingw-w64
- name: Compile
run: |
cargo build --release --target x86_64-pc-windows-gnu
cargo build --release --target x86_64-unknown-linux-musl
- name: Pack
working-directory: target
run: |
tar -czvf unpatched-agent_x86_64-unknown-linux-musl.tar.gz ../README.md ../LICENSE -C x86_64-unknown-linux-musl/release unpatched-agent
zip -jv unpatched-agent_x86_64-pc-windows-gnu.zip x86_64-pc-windows-gnu/release/unpatched-agent.exe ../README.md ../LICENSE
- uses: actions/upload-artifact@v3
with:
name: winlinux
path: |
target/unpatched-agent_x86_64-unknown-linux-musl.tar.gz
target/unpatched-agent_x86_64-pc-windows-gnu.zip
if-no-files-found: error
create-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.rustup
/usr/local/cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: rustup update stable
- name: Run rustfmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets -- -D warnings
- uses: taiki-e/install-action@nextest
- name: Cargo Test
run: cargo nextest run --no-fail-fast
- name: Compile
run: cargo build --release
- name: Pack
working-directory: target
run: zip -jv unpatched-agent_x86_64-apple-darwin.zip release/unpatched-agent ../README.md ../LICENSE
- uses: actions/upload-artifact@v3
with:
name: mac
path: target/unpatched-agent_x86_64-apple-darwin.zip
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: ["create-winlinux", "create-mac"]
steps:
- uses: actions/download-artifact@v3
with:
name: winlinux
- uses: actions/download-artifact@v3
with:
name: mac
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
files: |
unpatched-agent_x86_64-unknown-linux-musl.tar.gz
unpatched-agent_x86_64-apple-darwin.zip
unpatched-agent_x86_64-pc-windows-gnu.zip

0 comments on commit d2ef79d

Please sign in to comment.