Merge pull request #34 from rage/ci #502
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: macOS | |
on: | |
push: | |
branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] | |
pull_request: | |
branches: [main, "v[0-9]+.[0-9]+.[0-9]+"] | |
release: | |
types: | |
- created | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: ${{ github.event_name == 'release' }} | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: google-github-actions/setup-gcloud@v2 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
credentials_json: ${{ 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 | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
- 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 }} |