Skip to content

Update github pipeline #918

Update github pipeline

Update github pipeline #918

Workflow file for this run

name: Build & test all configs
on: [ push, pull_request ]
jobs:
release-notice:
name: This is a release build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Show version
run: echo "This is a release build for v${GITHUB_REF/refs\/tags\/v/}"
build:
strategy:
matrix:
crate:
- vhdl_lang
- vhdl_ls
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-pc-windows-msvc
- aarch64-apple-darwin
rust:
- stable
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
ext: ""
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
ext: ""
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
- target: aarch64-apple-darwin
os: macos-latest
ext: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: x86_64-unknown-linux-musl
components: rustfmt, clippy
- name: Add Apple Silicon Dependencies
run: rustup target add aarch64-apple-darwin
- uses: awalsh128/cache-apt-pkgs-action@v1
if: matrix.os == 'ubuntu-latest'
with:
packages: musl-tools # provides musl-gcc
version: 1.0
- name: Build
run: cargo build --manifest-path ${{ matrix.crate }}/Cargo.toml --release --target ${{ matrix.target }}
- name: Test
if: matrix.os != 'macos-latest' # There are no free runners for Apple Silicon available at the moment
run: cargo test --manifest-path ${{ matrix.crate }}/Cargo.toml --release --target ${{ matrix.target }}
- name: rustfmt
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'
run: cargo fmt --package ${{ matrix.crate }} -- --check
- name: clippy
if: matrix.os == 'ubuntu-latest'
run: cargo clippy --package ${{ matrix.crate }} --all-targets --all-features -- -D warnings
- name: Assemble
if: matrix.rust == 'stable'
run: |
mkdir ${{ matrix.crate }}-${{ matrix.target }}
mkdir ${{ matrix.crate }}-${{ matrix.target }}/bin
cp -R vhdl_libraries ${{ matrix.crate }}-${{ matrix.target }}
cp target/${{ matrix.target }}/release/${{ matrix.crate }}${{ matrix.ext }} ${{ matrix.crate }}-${{ matrix.target }}/bin
- name: Upload
if: matrix.rust == 'stable'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.crate }}-${{ matrix.target }}
path: ${{ matrix.crate }}-${{ matrix.target }}
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Get version
id: v
run: |
echo ::set-output name=v::${GITHUB_REF/refs\/tags\/v/}
echo "Version is v${GITHUB_REF/refs\/tags\/v/}"
- uses: actions/checkout@v4
- name: Get vhdl_lang linux-musl
uses: actions/download-artifact@v4
with:
name: vhdl_lang-x86_64-unknown-linux-musl
- name: Check vhdl_lang version
run: |
chmod u+x vhdl_lang-x86_64-unknown-linux-musl/bin/vhdl_lang
version_string=$(vhdl_lang-x86_64-unknown-linux-musl/bin/vhdl_lang --version)
if [ "$version_string" != "vhdl_lang ${{ steps.v.outputs.v }}" ]
then
echo "Version string mismatch (\"$version_string\" != \"vhdl_lang ${{ steps.v.outputs.v }}\""
exit 1
else
echo "Version string matched"
fi
- name: Get vhdl_ls linux-musl
uses: actions/download-artifact@v4
with:
name: vhdl_ls-x86_64-unknown-linux-musl
- name: Check vhdl_ls version
run: |
chmod u+x vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls
version_string=$(vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --version)
if [ "$version_string" != "vhdl_ls ${{ steps.v.outputs.v }}" ]
then
echo "Version string mismatch (\"$version_string\" != \"vhdl_lang ${{ steps.v.outputs.v }}\""
exit 1
else
echo "Version string matched"
fi
- name: Get vhdl_lang linux-gnu
uses: actions/download-artifact@v4
with:
name: vhdl_lang-x86_64-unknown-linux-gnu
- name: Get vhdl_ls linux-gnu
uses: actions/download-artifact@v4
with:
name: vhdl_ls-x86_64-unknown-linux-gnu
- name: Get vhdl_lang windows
uses: actions/download-artifact@v4
with:
name: vhdl_lang-x86_64-pc-windows-msvc
- name: Get vhdl_ls windows
uses: actions/download-artifact@v4
with:
name: vhdl_ls-x86_64-pc-windows-msvc
- name: Get vhdl_lang macos
uses: actions/download-artifact@v4
with:
name: vhdl_lang-aarch64-apple-darwin
- name: Get vhdl_ls macos
uses: actions/download-artifact@v4
with:
name: vhdl_ls-aarch64-apple-darwin
- name: Zip artifacts
run: |
zip -r vhdl_lang-x86_64-unknown-linux-gnu.zip vhdl_lang-x86_64-unknown-linux-gnu
zip -r vhdl_ls-x86_64-unknown-linux-gnu.zip vhdl_ls-x86_64-unknown-linux-gnu
zip -r vhdl_lang-x86_64-unknown-linux-musl.zip vhdl_lang-x86_64-unknown-linux-musl
zip -r vhdl_ls-x86_64-unknown-linux-musl.zip vhdl_ls-x86_64-unknown-linux-musl
zip -r vhdl_lang-x86_64-pc-windows-msvc.zip vhdl_lang-x86_64-pc-windows-msvc
zip -r vhdl_ls-x86_64-pc-windows-msvc.zip vhdl_ls-x86_64-pc-windows-msvc
zip -r vhdl_ls-aarch64-apple-darwin.zip vhdl_ls-aarch64-apple-darwin
zip -r vhdl_lang-aarch64-apple-darwin.zip vhdl_lang-aarch64-apple-darwin
- name: Do release
uses: ncipollo/release-action@v1
with:
draft: false
artifacts: "vhdl_lang-x86_64-unknown-linux-gnu.zip,vhdl_ls-x86_64-unknown-linux-gnu.zip,vhdl_lang-x86_64-unknown-linux-musl.zip,vhdl_ls-x86_64-unknown-linux-musl.zip,vhdl_lang-x86_64-pc-windows-msvc.zip,vhdl_ls-x86_64-pc-windows-msvc.zip,vhdl_lang-aarch64-apple-darwin.zip,vhdl_ls-aarch64-apple-darwin.zip"
token: ${{ secrets.GITHUB_TOKEN }}