Skip to content

Commit

Permalink
Improve structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Heliozoa committed Aug 9, 2023
1 parent 671da9b commit a90c2fd
Show file tree
Hide file tree
Showing 30 changed files with 847 additions and 1,441 deletions.
39 changes: 25 additions & 14 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@ env:
CARGO_TERM_COLOR: always

jobs:

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install fmt and clippy
run: |
rustup component add rustfmt
rustup component add clippy
- name: Run fmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --tests --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v2

- name: Install fmt, clippy and nightly for the fmt
run: |
rustup component add rustfmt
rustup component add clippy
rustup toolchain install nightly
rustup component add --toolchain nightly rustfmt
- name: Run fmt
run: cargo +nightly fmt -- --check

- name: Run clippy
run: cargo clippy -- -D warnings

- name: Build
run: cargo build --tests --verbose

- name: Run tests
run: cargo test --verbose

deploy:
needs: test
Expand All @@ -33,23 +39,28 @@ jobs:
target: [i686-unknown-linux-gnu, x86_64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v2

- uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}

- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y gcc-multilib libssl-dev:i386 # required to build for 32-bit arch
- name: Cargo build
run: |
export I686_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/i386-linux-gnu # required to build for 32-bit arch
export I686_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include/i386-linux-gnu # required to build for 32-bit arch
rustup target add i686-unknown-linux-gnu
cargo build -p tmc --release --verbose --target ${{ matrix.target }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Deploy
run: gsutil cp target/${{ matrix.target }}/release/tmc gs://${{ secrets.GCP_BUCKET }}/tmc-cli-rust/tmc-cli-rust-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}
37 changes: 23 additions & 14 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,49 @@ env:
CARGO_TERM_COLOR: always

jobs:

test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install fmt and clippy
run: |
rustup component add rustfmt
rustup component add clippy
- name: Run fmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --tests --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v2

- name: Install fmt and clippy
run: |
rustup component add rustfmt
rustup component add clippy
- name: Run fmt
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy -- -D warnings

- name: Build
run: cargo build --tests --verbose

- name: Run tests
run: cargo test --verbose

deploy:
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}

- name: Cargo build
run: cargo build -p tmc --release --verbose

- name: Sign
run: codesign --force -s - target/release/tmc

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Deploy
run: gsutil cp target/release/tmc gs://${{ secrets.GCP_BUCKET }}/tmc-cli-rust/tmc-cli-rust-x86_64-apple-darwin-${{ steps.get_version.outputs.VERSION }}
44 changes: 28 additions & 16 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@ env:
CARGO_TERM_COLOR: always

jobs:

test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install fmt and clippy
run: |
rustup component add rustfmt
rustup component add clippy
- name: Run fmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --tests --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v2

- name: Enable long paths for git
run: git config --system core.longpaths true # allow long paths from git deps

- name: Install fmt and clippy
run: |
rustup component add rustfmt
rustup component add clippy
- name: Run fmt
run: cargo fmt -- --check

- name: Run clippy
run: cargo clippy -- -D warnings

- name: Build
run: cargo build --tests --verbose

- name: Run tests
run: cargo test --verbose

deploy:
needs: test
Expand All @@ -33,23 +40,28 @@ jobs:
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
steps:
- uses: actions/checkout@v2

- uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}

- name: Enable long paths for git
run: git config --system core.longpaths true # allow long paths from git deps

- name: Cargo build # crt-static is set with RUSTFLAGS to statically link MSVCRT (VCRUNTIME140.dll)
run: |
rustup target add i686-pc-windows-msvc
$env:RUSTFLAGS="-C target-feature=+crt-static"
cargo build -p tmc --release --verbose --target ${{ matrix.target }}
- name: Get the version
id: get_version
shell: bash
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Deploy
run: |
$env:python_version=$(python -c 'import sys; print(\".\".join(map(str, sys.version_info[:3])))')
$env:CLOUDSDK_PYTHON="C:\hostedtoolcache\windows\Python\$env:python_version\x64\python"
gsutil cp target/${{ matrix.target }}/release/tmc.exe gs://${{ secrets.GCP_BUCKET }}/tmc-cli-rust/tmc-cli-rust-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}.exe
37 changes: 25 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ serde = "1.0.136"
serde_json = "1.0.79"
termcolor = "1.1.3"
terminal_size = "0.2.1"
tmc-langs = { git = "https://github.com/rage/tmc-langs-rust", tag = "0.32.0" }
tmc-langs = { git = "https://github.com/rage/tmc-langs-rust", tag = "0.33.0" }
toml = "0.7.2"
tui = { version = "0.19.0", default-features = false, features = ['crossterm'] }
url = "2.2.2"
Expand All @@ -44,10 +44,11 @@ uuid = { version = "1.4.0", features = ["v4"] }
assert_cmd = "2.0.4"
mockito = "1.1.0"
predicates = "3.0.3"
tempfile = "3.6.0"

[build-dependencies]
clap = { version = "4.0.7", features = ["derive"] }
clap_complete = "4.0.2"

[patch."https://github.com/rage/tmc-langs-rust"]
tmc-langs = { path = "../tmc-langs-rust/crates/tmc-langs" }
# [patch."https://github.com/rage/tmc-langs-rust"]
# tmc-langs = { path = "../tmc-langs-rust/crates/tmc-langs" }
Loading

0 comments on commit a90c2fd

Please sign in to comment.