Skip to content

nightly

nightly #12

Workflow file for this run

name: nightly
on:
workflow_dispatch:
inputs:
release_name:
type: string
description: Defaults to `nightly-YYYYMMDD`
schedule:
- cron: "0 5 * * *"
env:
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash
concurrency:
group: ci-nightly
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_changes.outputs.skip }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for changes
id: check_changes
run: |
if [ "$(git log $(git describe --tags --abbrev=0)..HEAD --oneline)" = "" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
build:
needs: check
runs-on: ${{ matrix.runs-on }}
if: needs.check.outputs.skip != 'true'
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runs-on: ubuntu-latest
target: i686-unknown-linux-gnu
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
- runs-on: macos-latest
target: x86_64-apple-darwin
- runs-on: macos-latest
target: aarch64-apple-darwin
- runs-on: windows-latest
target: x86_64-pc-windows-msvc
- runs-on: windows-latest
target: i686-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Additional setup for musl
if: contains(matrix.target, 'musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Additional setup for Linux x86
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Zip files
run: |
if [ "${{ matrix.runs-on }}" = "windows-latest" ]; then
mv ./target/${{ matrix.target }}/release/odoo-lsp.exe .
7z a -tzip odoo-lsp-${{ matrix.target }}.zip ./odoo-lsp.exe
else
mv ./target/${{ matrix.target }}/release/odoo-lsp .
tar -czvf odoo-lsp-${{ matrix.target }}.tar.gz ./odoo-lsp
fi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./odoo-lsp-${{ matrix.target }}.${{ matrix.runs-on == 'windows-latest' && 'zip' || 'tar.gz' }}
name: odoo-lsp-${{ matrix.target }}.${{ matrix.runs-on == 'windows-latest' && 'zip' || 'tar.gz' }}
build-extension:
needs: check
runs-on: ubuntu-latest
if: needs.check.outputs.skip != 'true'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- run: pnpm install
- run: pnpm package
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./odoo-lsp-*.vsix
name: odoo-lsp-extension.vsix
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build, build-extension]
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Generate checksums
run: |
for file in odoo-lsp-*/odoo-lsp-*; do
openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256";
done
- name: Get current date
run: echo "TAG=${{ inputs.release_name || 'nightly-$(date +"%Y%m%d")' }}" >> "$GITHUB_ENV"
- name: Create tag
run: git tag -f ${{ env.TAG }} && git push --tags
- name: Release
uses: softprops/action-gh-release@v1
with:
files: odoo-lsp-*/odoo-lsp-*
name: ${{ env.TAG }}
tag_name: ${{ env.TAG }}
generate_release_notes: true
prerelease: true