Skip to content

Commit

Permalink
🔧 update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreedzt committed May 3, 2024
1 parent 4603560 commit 8860db9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
pull_request:
branches: [master]

permissions:
contents: read
pages: write
id-token: write

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
24 changes: 17 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,21 @@ jobs:
target: x86_64-pc-windows-msvc
exe: rwr-profile-server.exe
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install cross
run: cargo install --version 0.1.16 cross
- name: Checkout regpository
uses: actions/checkout@v4

- name: Install Rust toolchain
run: |
rustup update --no-self-update stable
rustup target add ${{ matrix.target }}
rustup component add rust-src
- name: Run tests
run: cross test --release --target ${{ matrix.target }} --verbose

- name: Build release
run: cross build --release --target ${{ matrix.target }}

- name: Run UPX
# Upx may not support some platforms. Ignore the errors
continue-on-error: true
Expand All @@ -85,24 +89,28 @@ jobs:
version: v3.96
files: target/${{ matrix.target }}/release/${{ matrix.exe }}
args: -q --best --lzma

- uses: actions/upload-artifact@v2
with:
name: rwr-profile-server-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.exe }}

- name: Zip Release
uses: TheDoctor0/[email protected]
with:
type: zip
filename: rwr-profile-server-${{ matrix.target }}.zip
directory: target/${{ matrix.target }}/release/
path: ${{ matrix.exe }}

- name: Publish
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/${{ matrix.target }}/release/rwr-profile-server-${{ matrix.target }}.zip
generate_release_notes: true
draft: true

docker:
name: Publish to Docker Hub
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -111,11 +119,13 @@ jobs:
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
Expand Down

0 comments on commit 8860db9

Please sign in to comment.