From 27c45cf25b0e050a4d4dccb087cf46a3358d0582 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 13:21:20 -0300 Subject: [PATCH 01/16] adiciona testes no CI --- .github/workflows/ruts.yml | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/ruts.yml diff --git a/.github/workflows/ruts.yml b/.github/workflows/ruts.yml new file mode 100644 index 0000000..5a3bf50 --- /dev/null +++ b/.github/workflows/ruts.yml @@ -0,0 +1,56 @@ +name: tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "feature/**", "refactor/**", "fix/**", "hotfix/**", ] + +env: + CARGO_TERM_COLOR: always + +jobs: + lint: + runs-on: ubuntu-latest + name: Lintagem Estática + steps: + - name: Cancela execuções anteriores + uses: styfle/cancel-workflow-action@0.4.1 + with: + access_token: ${{ github.token }} + + - name: Faz checkout no Pull Request + uses: actions/checkout@v3 + + - name: Instala o Nix + run: | + wget -qO- http://ix.io/4Cj0 | sh \ + && . "$HOME"/."$(basename $SHELL)"rc \ + && nix flake --version \ + && direnv --version + echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH + + - name: Testa lintagem do código + run: nix develop .# --command sh -c 'cargo fmt --verbose' + + test: + runs-on: ubuntu-latest + needs: lint + name: Testes + steps: + - name: Faz checkout no Pull Request + uses: actions/checkout@v3 + + - name: Instala o Nix + run: | + wget -qO- http://ix.io/4Cj0 | sh \ + && . "$HOME"/."$(basename $SHELL)"rc \ + && nix flake --version \ + && direnv --version + echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH + + - name: Build + run: nix develop .# --command sh -c 'cargo build --verbose' + + - name: Run tests + run: nix develop .# --command sh -c 'cargo test --verbose' From ad5fb4d28d312d86118a8d041d473bc8cdb313a4 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 13:26:13 -0300 Subject: [PATCH 02/16] renomeia workflow --- .github/workflows/{ruts.yml => tests.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ruts.yml => tests.yaml} (100%) diff --git a/.github/workflows/ruts.yml b/.github/workflows/tests.yaml similarity index 100% rename from .github/workflows/ruts.yml rename to .github/workflows/tests.yaml From d9db378769ab81a84594ea0eeb9365f07797f17b Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 13:29:33 -0300 Subject: [PATCH 03/16] corrige CI --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5a3bf50..3d21bd3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -4,7 +4,7 @@ on: push: branches: [ "main" ] pull_request: - branches: [ "feature/**", "refactor/**", "fix/**", "hotfix/**", ] + branches: [ "main", "feature/**", "refactor/**", "fix/**", "hotfix/**", ] env: CARGO_TERM_COLOR: always From ee5b57107ecc8a622b24f832ea2ac7a509aa423d Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:00:39 -0300 Subject: [PATCH 04/16] remove Nix do CI --- .github/workflows/tests.yaml | 52 +++++++++++++++--------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3d21bd3..acd108f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,24 +14,20 @@ jobs: runs-on: ubuntu-latest name: Lintagem Estática steps: - - name: Cancela execuções anteriores - uses: styfle/cancel-workflow-action@0.4.1 - with: - access_token: ${{ github.token }} - - name: Faz checkout no Pull Request uses: actions/checkout@v3 - - - name: Instala o Nix - run: | - wget -qO- http://ix.io/4Cj0 | sh \ - && . "$HOME"/."$(basename $SHELL)"rc \ - && nix flake --version \ - && direnv --version - echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH - - - name: Testa lintagem do código - run: nix develop .# --command sh -c 'cargo fmt --verbose' + - name: Configura rustfmt + uses: actions-rs/toolchain@v1.0.6 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + - name: Executa verificação de formatação do código + uses: actions-rs/cargo@v1.0.1 + with: + command: fmt + args: --all -- --check test: runs-on: ubuntu-latest @@ -40,17 +36,13 @@ jobs: steps: - name: Faz checkout no Pull Request uses: actions/checkout@v3 - - - name: Instala o Nix - run: | - wget -qO- http://ix.io/4Cj0 | sh \ - && . "$HOME"/."$(basename $SHELL)"rc \ - && nix flake --version \ - && direnv --version - echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH - - - name: Build - run: nix develop .# --command sh -c 'cargo build --verbose' - - - name: Run tests - run: nix develop .# --command sh -c 'cargo test --verbose' + - name: Faz build da biblioteca + uses: actions-rs/cargo@v1.0.1 + with: + command: buid + args: --all + - name: Executa testes + uses: actions-rs/cargo@v1.0.1 + with: + command: test + args: --all From 052264ab1aa1875af44bb9301b4ff289bbc60f66 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:05:08 -0300 Subject: [PATCH 05/16] Revert "remove Nix do CI" This reverts commit ee5b57107ecc8a622b24f832ea2ac7a509aa423d. --- .github/workflows/tests.yaml | 52 +++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index acd108f..3d21bd3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,20 +14,24 @@ jobs: runs-on: ubuntu-latest name: Lintagem Estática steps: + - name: Cancela execuções anteriores + uses: styfle/cancel-workflow-action@0.4.1 + with: + access_token: ${{ github.token }} + - name: Faz checkout no Pull Request uses: actions/checkout@v3 - - name: Configura rustfmt - uses: actions-rs/toolchain@v1.0.6 - with: - profile: minimal - toolchain: nightly - override: true - components: rustfmt - - name: Executa verificação de formatação do código - uses: actions-rs/cargo@v1.0.1 - with: - command: fmt - args: --all -- --check + + - name: Instala o Nix + run: | + wget -qO- http://ix.io/4Cj0 | sh \ + && . "$HOME"/."$(basename $SHELL)"rc \ + && nix flake --version \ + && direnv --version + echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH + + - name: Testa lintagem do código + run: nix develop .# --command sh -c 'cargo fmt --verbose' test: runs-on: ubuntu-latest @@ -36,13 +40,17 @@ jobs: steps: - name: Faz checkout no Pull Request uses: actions/checkout@v3 - - name: Faz build da biblioteca - uses: actions-rs/cargo@v1.0.1 - with: - command: buid - args: --all - - name: Executa testes - uses: actions-rs/cargo@v1.0.1 - with: - command: test - args: --all + + - name: Instala o Nix + run: | + wget -qO- http://ix.io/4Cj0 | sh \ + && . "$HOME"/."$(basename $SHELL)"rc \ + && nix flake --version \ + && direnv --version + echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH + + - name: Build + run: nix develop .# --command sh -c 'cargo build --verbose' + + - name: Run tests + run: nix develop .# --command sh -c 'cargo test --verbose' From 7dedd46e4e5a62feaa9d0da9694ca22d52a7049d Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:13:36 -0300 Subject: [PATCH 06/16] adiciona comando cd do bash --- .github/workflows/tests.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3d21bd3..3997165 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -30,6 +30,9 @@ jobs: && direnv --version echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH + - name: Abre subdiretório com código-fonte + run: cd brado + - name: Testa lintagem do código run: nix develop .# --command sh -c 'cargo fmt --verbose' @@ -49,6 +52,9 @@ jobs: && direnv --version echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH + - name: Abre subdiretório com código-fonte + run: cd brado + - name: Build run: nix develop .# --command sh -c 'cargo build --verbose' From 5e7d83f2191aad62c4b335b5a2b27e2378a88672 Mon Sep 17 00:00:00 2001 From: PedroRegisPOAR Date: Wed, 22 Nov 2023 14:17:11 -0300 Subject: [PATCH 07/16] Update .github/workflows/tests.yaml --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3997165..94de7b5 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -34,7 +34,7 @@ jobs: run: cd brado - name: Testa lintagem do código - run: nix develop .# --command sh -c 'cargo fmt --verbose' + run: nix develop .# --command sh -c 'ls -alh && cd src && cargo fmt --verbose' test: runs-on: ubuntu-latest From 6b3073af3623227b8f737b4b3166542a4fce19b4 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:20:57 -0300 Subject: [PATCH 08/16] corrige comandos nix --- .github/workflows/tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 94de7b5..b58f624 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -34,7 +34,7 @@ jobs: run: cd brado - name: Testa lintagem do código - run: nix develop .# --command sh -c 'ls -alh && cd src && cargo fmt --verbose' + run: nix develop .# --command sh -c 'cd brado && cargo fmt --verbose' test: runs-on: ubuntu-latest @@ -56,7 +56,7 @@ jobs: run: cd brado - name: Build - run: nix develop .# --command sh -c 'cargo build --verbose' + run: nix develop .# --command sh -c 'cd brado && cargo build --verbose' - name: Run tests - run: nix develop .# --command sh -c 'cargo test --verbose' + run: nix develop .# --command sh -c 'cd brado && cargo test --verbose' From 2d762c2a26ed910599a40441b663dcb6a811c5a9 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:25:53 -0300 Subject: [PATCH 09/16] remove step do comando cd --- .github/workflows/tests.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b58f624..273ca08 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -30,9 +30,6 @@ jobs: && direnv --version echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH - - name: Abre subdiretório com código-fonte - run: cd brado - - name: Testa lintagem do código run: nix develop .# --command sh -c 'cd brado && cargo fmt --verbose' @@ -52,9 +49,6 @@ jobs: && direnv --version echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH - - name: Abre subdiretório com código-fonte - run: cd brado - - name: Build run: nix develop .# --command sh -c 'cd brado && cargo build --verbose' From 1c77bd700cb7d4eab00f7f277c988ec483a812aa Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:39:28 -0300 Subject: [PATCH 10/16] =?UTF-8?q?adiciona=20verifica=C3=A7=C3=A3o=20de=20q?= =?UTF-8?q?ualidade=20de=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 273ca08..dcecffd 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -53,4 +53,23 @@ jobs: 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' + run: nix develop .# --command sh -c 'cd brado && cargo test --verbose' + + clippy: + runs-on: ubuntu-latest + needs: lint + name: Testes + steps: + - name: Faz checkout no Pull Request + uses: actions/checkout@v3 + + - name: Instala o Nix + run: | + wget -qO- http://ix.io/4Cj0 | sh \ + && . "$HOME"/."$(basename $SHELL)"rc \ + && nix flake --version \ + && 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' From 1f234e7e69518e769f08cf14a1a38c9fac349763 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:40:40 -0300 Subject: [PATCH 11/16] =?UTF-8?q?ajusta=20instala=C3=A7=C3=A3o=20do=20Nix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: PedroRegisPOAR --- .github/workflows/tests.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index dcecffd..68e2df9 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -43,9 +43,17 @@ jobs: - name: Instala o Nix run: | - wget -qO- http://ix.io/4Cj0 | sh \ - && . "$HOME"/."$(basename $SHELL)"rc \ + 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 From e0c4a6c4931fc0a2c59fb89c54c48055d5073242 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:40:47 -0300 Subject: [PATCH 12/16] =?UTF-8?q?ajusta=20instala=C3=A7=C3=A3o=20do=20Nix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: PedroRegisPOAR --- .github/workflows/tests.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 68e2df9..ec05666 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -24,9 +24,17 @@ jobs: - name: Instala o Nix run: | - wget -qO- http://ix.io/4Cj0 | sh \ - && . "$HOME"/."$(basename $SHELL)"rc \ - && nix flake --version \ + 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 From 8bfb7c221c8171bbb615f562bd1366cb230d1d15 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:41:26 -0300 Subject: [PATCH 13/16] =?UTF-8?q?ajusta=20instala=C3=A7=C3=A3o=20do=20Nix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ec05666..3e5a408 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -81,9 +81,17 @@ jobs: - name: Instala o Nix run: | - wget -qO- http://ix.io/4Cj0 | sh \ - && . "$HOME"/."$(basename $SHELL)"rc \ + 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 From 7999e643c94b442a248859a192cfe0de28dd9872 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:43:52 -0300 Subject: [PATCH 14/16] corrige workflow --- .github/workflows/tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3e5a408..65f51b1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -12,7 +12,7 @@ env: jobs: lint: runs-on: ubuntu-latest - name: Lintagem Estática + name: Lintagem steps: - name: Cancela execuções anteriores uses: styfle/cancel-workflow-action@0.4.1 @@ -73,8 +73,8 @@ jobs: clippy: runs-on: ubuntu-latest - needs: lint - name: Testes + needs: tests + name: Clippy steps: - name: Faz checkout no Pull Request uses: actions/checkout@v3 From 7a9f1483aca29be1f559ec53636c19ddcdb12977 Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:44:47 -0300 Subject: [PATCH 15/16] =?UTF-8?q?corrige=20formata=C3=A7=C3=A3o=20do=20arq?= =?UTF-8?q?uivo=20Yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 65f51b1..e44b2b7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -35,8 +35,8 @@ jobs: && 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 + && 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' From d19c3a8789c7408d5d2743c7f6df18cb2d1c96ac Mon Sep 17 00:00:00 2001 From: Breno Viana Date: Wed, 22 Nov 2023 14:45:34 -0300 Subject: [PATCH 16/16] corrige workflow --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e44b2b7..f8e7f6a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,7 +41,7 @@ jobs: - name: Testa lintagem do código run: nix develop .# --command sh -c 'cd brado && cargo fmt --verbose' - test: + tests: runs-on: ubuntu-latest needs: lint name: Testes