test #38
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: [created] | |
jobs: | |
code-validation: | |
name: Code validation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Check formatting | |
run: make formatter-run | |
- name: Check linting | |
run: make linter-run | |
tests: | |
name: Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
- os: macos-latest | |
- os: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Run tests | |
run: make tests-run | |
build_binaries: | |
name: Build binaries | |
runs-on: ${{ matrix.os }} | |
# needs: | |
# - tests | |
# - code-validation | |
strategy: | |
matrix: | |
include: | |
- { os: macos-latest, target: x86_64-apple-darwin } | |
- { os: macos-latest, target: aarch64-apple-darwin } | |
- { os: windows-latest, target: x86_64-pc-windows-msvc } | |
- { os: windows-latest, target: i686-pc-windows-msvc } | |
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu } | |
- { os: ubuntu-latest, target: i686-unknown-linux-gnu } | |
env: | |
TARGET: ${{ matrix.target }} | |
ARCHIVE_NAME: txc-${{ matrix.target }} | |
ARCHIVE_FILE: txc-${{ matrix.target }}.tar.gz | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Build binary | |
run: make build DEBUG=false TARGET=${{ matrix.target }} | |
- name: "Archive binary" | |
shell: bash | |
run: | | |
mkdir -p $ARCHIVE_NAME | |
cp ./target/release/txc $ARCHIVE_NAME/txc | |
tar czvf $ARCHIVE_FILE $ARCHIVE_NAME | |
- name: "Generate sha256 for Linux/macOS" | |
shell: bash | |
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') | |
run: shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256 | |
- name: "Generate sha256 for Windows" | |
shell: bash | |
if: startsWith(matrix.os, 'windows') | |
run: sha256sum $ARCHIVE_FILE > $ARCHIVE_FILE.sha256 | |
- name: "Upload binary" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-${{ matrix.target }} | |
path: | | |
txc-${{ matrix.target }}.tar.gz | |
txc-${{ matrix.target }}.tar.gz.sha256 |