release: 2.25.1 (#644) #1290
Workflow file for this run
This file contains hidden or 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: Rust | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "**" | |
pull_request: | |
jobs: | |
pre_job: | |
runs-on: ubuntu-22.04 | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
paths_result: ${{ steps.skip_check.outputs.paths_result }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@c449d86cf33a2a6c7a4193264cc2578e2c3266d4 # pin@v4 | |
with: | |
paths_ignore: '["docs/**", "*.md"]' | |
build: | |
needs: pre_job | |
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/') | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Linux x86_64 | |
os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
artifact_name: squawk-linux-x64 | |
vscode_artifact_name: linux-x64 | |
- name: Linux arm64 | |
os: ubuntu-22.04 | |
target: aarch64-unknown-linux-gnu | |
artifact_name: squawk-linux-arm64 | |
vscode_artifact_name: linux-arm64 | |
rustflags: "-C linker=aarch64-linux-gnu-gcc" | |
- name: Linux Alpine x86_64 | |
os: ubuntu-22.04 | |
target: x86_64-unknown-linux-musl | |
artifact_name: squawk-linux-musl-x64 | |
vscode_artifact_name: alpine-x64 | |
rustflags: "-C linker=rust-lld" | |
- name: Windows x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
artifact_name: squawk-windows-x64.exe | |
vscode_artifact_name: win32-x64 | |
- name: macOS x86_64 | |
os: macos-latest | |
target: x86_64-apple-darwin | |
artifact_name: squawk-darwin-x64 | |
vscode_artifact_name: darwin-x64 | |
- name: macOS arm64 | |
os: macos-latest | |
target: aarch64-apple-darwin | |
artifact_name: squawk-darwin-arm64 | |
vscode_artifact_name: darwin-arm64 | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update apt repositories | |
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'aarch64-unknown-linux-gnu' | |
run: sudo apt-get update | |
- name: Install AArch64 target toolchain | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: sudo apt-get install gcc-aarch64-linux-gnu | |
- name: Install x86_64-musl target toolchain | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: sudo apt-get install musl-tools | |
- name: Install Toolchain | |
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable | |
with: | |
toolchain: 1.88.0 | |
targets: ${{ matrix.target }} | |
- name: Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # pin@v2 | |
- name: Build | |
run: RUSTFLAGS="${{ matrix.rustflags }}" cargo build --target ${{ matrix.target }} --release | |
shell: bash | |
- name: Rename artifact (windows) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
run: mv target/${{ matrix.target }}/release/squawk.exe target/release/${{ matrix.artifact_name }} | |
- name: Rename artifact (linux, mac) | |
if: matrix.target != 'x86_64-pc-windows-msvc' | |
run: mv target/${{ matrix.target }}/release/squawk target/release/${{ matrix.artifact_name }} | |
- name: Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-${{ matrix.artifact_name }} | |
path: target/release/${{ matrix.artifact_name }} | |
- name: VSCode - Make server dir | |
shell: bash | |
run: mkdir squawk-vscode/server | |
- name: VSCode - Copy binary into extension (windows) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
shell: bash | |
run: cp target/release/${{ matrix.artifact_name }} squawk-vscode/server/squawk.exe | |
- name: VSCode - Copy binary into extension (linux, mac) | |
if: matrix.target != 'x86_64-pc-windows-msvc' | |
shell: bash | |
run: cp target/release/${{ matrix.artifact_name }} squawk-vscode/server/squawk | |
- name: VSCode - Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: VSCode - Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: "squawk-vscode/package.json" | |
cache-dependency-path: "squawk-vscode/pnpm-lock.yaml" | |
cache: "pnpm" | |
- name: VSCode - Install JS dependencies | |
working-directory: "squawk-vscode" | |
run: pnpm install | |
- name: VSCode - Build | |
working-directory: "squawk-vscode" | |
run: pnpm exec vsce pack --no-dependencies --target ${{ matrix.vscode_artifact_name }} | |
- name: VSCode - Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: squawk-vscode-${{ matrix.vscode_artifact_name }} | |
path: squawk-vscode/*.vsix | |
- name: Release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
target/release/${{ matrix.artifact_name }} | |
squawk-vscode/*.vsix | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-npm: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | |
publish-docker: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=raw,value=latest | |
type=ref,event=branch | |
type=sha | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy-playground: | |
needs: pre_job | |
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # pin@v2 | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: "playground/package.json" | |
cache-dependency-path: "playground/pnpm-lock.yaml" | |
cache: "pnpm" | |
- name: Install JS dependencies | |
working-directory: "playground" | |
run: pnpm install | |
- name: Build | |
working-directory: "playground" | |
run: pnpm build | |
- name: Deploy to Netlify | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: nwtgck/actions-netlify@v2 | |
with: | |
publish-dir: "playground/dist" | |
production-branch: main | |
production-deploy: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: "Deploy from GitHub Actions" | |
fails-without-credentials: true | |
enable-pull-request-comment: false | |
enable-commit-comment: false | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.PLAYGROUND_NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.PLAYGROUND_NETLIFY_SITE_ID }} | |
lint: | |
needs: pre_job | |
if: needs.pre_job.outputs.should_skip != 'true' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Toolchain | |
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable | |
with: | |
toolchain: 1.88.0 | |
components: clippy, rustfmt | |
- name: Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # pin@v2 | |
- name: Get Clippy Version | |
run: cargo clippy --version | |
- name: Lint | |
run: ./s/lint | |
test: | |
needs: pre_job | |
if: needs.pre_job.outputs.should_skip != 'true' | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Toolchain | |
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable | |
with: | |
toolchain: 1.88.0 | |
- name: Cache | |
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # pin@v2 | |
- name: Test | |
run: ./s/test | |
check_version: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version-file: ".python-version" | |
- name: Check versions are consistent | |
run: ./s/check-version | |
publish-vscode: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: "squawk-vscode/package.json" | |
cache-dependency-path: "squawk-vscode/pnpm-lock.yaml" | |
cache: "pnpm" | |
- name: Install JS dependencies | |
working-directory: "squawk-vscode" | |
run: pnpm install | |
- name: Download all VS Code artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: squawk-vscode-* | |
path: ./dist | |
- name: Publish Extension (VS Code Marketplace) | |
working-directory: ./squawk-vscode | |
run: pnpm exec vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../dist/squawk-vscode-*/*.vsix | |
- name: Publish Extension (Open VSX) | |
working-directory: ./squawk-vscode | |
run: pnpm exec ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../dist/squawk-vscode-*/*.vsix | |
timeout-minutes: 2 |