Melhoria de código #61
Workflow file for this run
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: tests | |
on: | |
pull_request: | |
branches: [ "main", "feature/**", "refactor/**", "fix/**", "hotfix/**", ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
name: Lintagem | |
steps: | |
- name: Cancela execuções anteriores | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Faz checkout no Pull Request | |
uses: actions/checkout@v3 | |
- name: Instala o Nix | |
run: | | |
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \ | |
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \ | |
&& NIX_RELEASE_VERSION='2.10.2' \ | |
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \ | |
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \ | |
&& . ~/."$(basename $SHELL)"rc \ | |
&& export TMPDIR=/tmp \ | |
&& nix flake --version \ | |
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \ | |
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \ | |
&& . ~/."$(basename $SHELL)"rc \ | |
&& direnv --version | |
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH | |
- name: Testa lintagem do código | |
run: nix develop .# --command sh -c 'cd brado && cargo fmt --verbose' | |
tests: | |
runs-on: ubuntu-latest | |
needs: lint | |
name: Testes | |
steps: | |
- name: Faz checkout no Pull Request | |
uses: actions/checkout@v3 | |
- name: Instala o Nix | |
run: | | |
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \ | |
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \ | |
&& NIX_RELEASE_VERSION='2.10.2' \ | |
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \ | |
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \ | |
&& . ~/."$(basename $SHELL)"rc \ | |
&& export TMPDIR=/tmp \ | |
&& nix flake --version \ | |
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \ | |
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \ | |
&& . ~/."$(basename $SHELL)"rc \ | |
&& direnv --version | |
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH | |
- name: Build | |
run: nix develop .# --command sh -c 'cd brado && cargo build --verbose' | |
- name: Run tests | |
run: nix develop .# --command sh -c 'cd brado && cargo test --verbose' | |
clippy: | |
runs-on: ubuntu-latest | |
needs: tests | |
name: Clippy | |
steps: | |
- name: Faz checkout no Pull Request | |
uses: actions/checkout@v3 | |
- name: Instala o Nix | |
run: | | |
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \ | |
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \ | |
&& NIX_RELEASE_VERSION='2.10.2' \ | |
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \ | |
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \ | |
&& . ~/."$(basename $SHELL)"rc \ | |
&& export TMPDIR=/tmp \ | |
&& nix flake --version \ | |
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \ | |
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \ | |
&& . ~/."$(basename $SHELL)"rc \ | |
&& direnv --version | |
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH | |
- name: Verifica qualidade do código | |
run: nix develop .# --command sh -c 'cd brado && cargo clippy --verbose' |