diff --git a/.github/workflows/upload-binaries.yml b/.github/workflows/upload-binaries.yml index f6c3273b2dd..cc8434d955f 100644 --- a/.github/workflows/upload-binaries.yml +++ b/.github/workflows/upload-binaries.yml @@ -9,35 +9,6 @@ env: TAG: ${{ github.event.release.tag_name }} # had some issue using this directly on windows jobs: - linux: - runs-on: ubuntu-18.04 - strategy: - matrix: - target: [i686-unknown-linux-gnu, x86_64-unknown-linux-gnu] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '16' - - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master - with: - project_id: ${{ secrets.GCP_PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - - name: Install dependencies - run: | - sudo apt update - sudo apt install -y gcc-multilib # required to build for 32-bit arch - - name: Build - run: | - rustup target add ${{ matrix.target }} - cargo build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }} - npm --prefix ./bindings/tmc-langs-node install - npm --prefix ./bindings/tmc-langs-node run build -- --release --verbose --target ${{ matrix.target }} - - name: Deploy - run: | - gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG - gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node - windows: runs-on: windows-latest strategy: @@ -57,7 +28,7 @@ jobs: rustup target add ${{ matrix.target }} $env:RUSTFLAGS="-C target-feature=+crt-static" cargo build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }} - cd ./bindings/tmc-langs-node && npm install && npm run build -- --release --verbose --target ${{ matrix.target }} + cd ./bindings/tmc-langs-node && npm install && npm run build -- --release --target ${{ matrix.target }} - name: Deploy run: | $env:python_version=$(python -c 'import sys; print(\".\".join(map(str, sys.version_info[:3])))') @@ -80,7 +51,7 @@ jobs: run: | cargo build -p tmc-langs-cli --release --verbose npm --prefix ./bindings/tmc-langs-node install - npm run --prefix ./bindings/tmc-langs-node build -- --release --verbose + npm run --prefix ./bindings/tmc-langs-node build -- --release - name: Sign run: codesign --force -s - target/release/tmc-langs-cli - name: Deploy @@ -88,11 +59,8 @@ jobs: gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-x86_64-apple-darwin-$TAG gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-x86_64-apple-darwin-$TAG.node - arm: + ubuntu: runs-on: ubuntu-18.04 - strategy: - matrix: - target: [aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf] steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 @@ -102,14 +70,64 @@ jobs: with: project_id: ${{ secrets.GCP_PROJECT_ID }} service_account_key: ${{ secrets.GCP_SA_KEY }} - - name: Cargo build + - name: Install dependencies run: | - rustup target add ${{ matrix.target }} - cargo install cross - cross build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }} + sudo apt update + sudo apt install -y gcc-multilib # required to build for 32-bit arch + sudo apt install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf # linkers for ARM targets + + - name: x86_64-unknown-linux-gnu + env: + TARGET: x86_64-unknown-linux-gnu + run: | + # build and deploy CLI + rustup target add $TARGET + cargo build -p tmc-langs-cli --release --verbose --target $TARGET + gsutil cp target/$TARGET/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-$TARGET-$TAG + + # build and deploy Node module npm --prefix ./bindings/tmc-langs-node install - npm --prefix ./bindings/tmc-langs-node run cross -- --release --verbose --target ${{ matrix.target }} - - name: Deploy + npm --prefix ./bindings/tmc-langs-node run build -- --release --target $TARGET + gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-$TARGET-$TAG.node + + - name: i686-unknown-linux-gnu + env: + TARGET: i686-unknown-linux-gnu run: | - gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG - gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node + # build and deploy CLI + rustup target add $TARGET + cargo build -p tmc-langs-cli --release --verbose --target $TARGET + gsutil cp target/$TARGET/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-$TARGET-$TAG + + # build and deploy Node module + npm --prefix ./bindings/tmc-langs-node install + npm --prefix ./bindings/tmc-langs-node run build -- --release --target $TARGET + gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-$TARGET-$TAG.node + + - name: aarch64-unknown-linux-gnu + env: + TARGET: aarch64-unknown-linux-gnu + run: | + # build and deploy CLI + rustup target add $TARGET + cargo build -p tmc-langs-cli --release --verbose --target $TARGET + gsutil cp target/$TARGET/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-$TARGET-$TAG + + # build and deploy Node module + npm --prefix ./bindings/tmc-langs-node install + npm --prefix ./bindings/tmc-langs-node run build -- --release --target $TARGET + gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-$TARGET-$TAG.node + + - name: armv7-unknown-linux-gnueabihf + env: + TARGET: armv7-unknown-linux-gnueabihf + run: | + # build and deploy CLI + rustup target add $TARGET + cargo build -p tmc-langs-cli --release --verbose --target $TARGET + gsutil cp target/$TARGET/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-$TARGET-$TAG + + # build and deploy Node module + npm --prefix ./bindings/tmc-langs-node install + npm --prefix ./bindings/tmc-langs-node run build -- --release --target $TARGET + gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-$TARGET-$TAG.node diff --git a/bindings/tmc-langs-node/package.json b/bindings/tmc-langs-node/package.json index 34bd92a70b4..240d5587a0f 100644 --- a/bindings/tmc-langs-node/package.json +++ b/bindings/tmc-langs-node/package.json @@ -11,7 +11,6 @@ "types": "index.d.ts", "scripts": { "build": "cargo-cp-artifact -nc ts/functions.node -- cargo build --message-format=json-render-diagnostics", - "cross": "cargo-cp-artifact -nc ts/functions.node -- cross build --message-format=json-render-diagnostics", "test": "cargo test && npm run jest", "jest": "npm install && npm run build && jest" }, @@ -45,4 +44,4 @@ "d.ts" ] } -} +} \ No newline at end of file