From a31131a71a53c4a95de39f1d5e9a18a3e61373d9 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 6 May 2024 16:14:34 +0200 Subject: [PATCH 1/6] feat: ci --- .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 13 ++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..413fe27 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + artifact: + permissions: + contents: write + pull-requests: write + + name: artifact + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build contracts + run: scarb build + - name: Archive contracts + uses: actions/upload-artifact@v2 + with: + name: artifacts + path: ./target/dev + - name: Generate checksums + run: | + cd ./target/dev + for file in *; do + sha256sum "$file" > "$file.sha256" + md5sum "$file" > "$file.md5" + done + release: + needs: artifact + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: artifacts + path: ./target/dev + + - name: Release Artifact + uses: softprops/action-gh-release@v1 + with: + files: | + ./target/dev/* \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d61632a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,13 @@ +name: Tests +on: + push: + pull_request: +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: software-mansion/setup-scarb@v1 + - run: scarb fmt --check + - run: scarb build + - run: scarb test \ No newline at end of file From e5ad64905a05660a9970ea3752b0c4c6387b5dba Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 6 May 2024 16:18:07 +0200 Subject: [PATCH 2/6] fix: snforge test --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d61632a..1b34d75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: software-mansion/setup-scarb@v1 + - uses: foundry-rs/setup-snfoundry@v3 - run: scarb fmt --check - run: scarb build - - run: scarb test \ No newline at end of file + - run: snforge test \ No newline at end of file From 8c8de70504e4085e6fef3a25b2b031cc840c561d Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 6 May 2024 16:50:28 +0200 Subject: [PATCH 3/6] fix: release typo --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 413fe27..a02fa50 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,6 @@ jobs: permissions: contents: write pull-requests: write - name: artifact runs-on: ubuntu-latest steps: @@ -22,7 +21,7 @@ jobs: with: name: artifacts path: ./target/dev - - name: Generate checksums + - name: Generate checksums run: | cd ./target/dev for file in *; do From 1df7a37e357b4cd124447b7efb41adc845f813fc Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 6 May 2024 18:17:05 +0200 Subject: [PATCH 4/6] fix: filter artifacts --- .github/workflows/release.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a02fa50..72b0841 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,20 +14,27 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: software-mansion/setup-scarb@v1 - name: Build contracts run: scarb build - name: Archive contracts - uses: actions/upload-artifact@v2 - with: - name: artifacts - path: ./target/dev + run: | + mkdir -p filtered_artifacts + find ./target/dev -type f -name '*.contract_class.json' -exec cp {} filtered_artifacts/ \; - name: Generate checksums run: | - cd ./target/dev + cd filtered_artifacts for file in *; do sha256sum "$file" > "$file.sha256" md5sum "$file" > "$file.md5" done + - name: Build artifact zip + run: | + cd filtered_artifacts + zip -r ../artifacts.zip . + cd .. + sha256sum artifacts.zip > artifacts.zip.sha256 + md5sum artifacts.zip > artifacts.zip.md5 release: needs: artifact runs-on: ubuntu-latest @@ -35,11 +42,13 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v2 with: - name: artifacts - path: ./target/dev + name: filtered_artifacts + path: ./filtered_artifacts - name: Release Artifact uses: softprops/action-gh-release@v1 with: files: | - ./target/dev/* \ No newline at end of file + filtered_artifacts/* + tag_name: ${{ github.ref }} + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 31c8762cb19376aeedab182ecb15409e0d2230cf Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 6 May 2024 18:37:14 +0200 Subject: [PATCH 5/6] fix: artifacts push --- .github/workflows/release.yml | 22 ++++++++++------------ .github/workflows/test.yml | 14 -------------- 2 files changed, 10 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 72b0841..c3dfbdd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,20 +35,18 @@ jobs: cd .. sha256sum artifacts.zip > artifacts.zip.sha256 md5sum artifacts.zip > artifacts.zip.md5 - release: - needs: artifact - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v2 - with: - name: filtered_artifacts - path: ./filtered_artifacts + + - name: Find zip files + run: | + find ./filtered_artifacts -type f -name '*.zip' -exec echo "::set-output name=zip_files::{}" \; + id: find_zip_files - name: Release Artifact uses: softprops/action-gh-release@v1 with: files: | - filtered_artifacts/* - tag_name: ${{ github.ref }} - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + artifacts.zip + artifacts.zip.sha256 + artifacts.zip.md5 + + \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1b34d75..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Tests -on: - push: - pull_request: -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: software-mansion/setup-scarb@v1 - - uses: foundry-rs/setup-snfoundry@v3 - - run: scarb fmt --check - - run: scarb build - - run: snforge test \ No newline at end of file From 5d4c61b926398ebd207314535d172d49d1c78663 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 6 May 2024 18:37:56 +0200 Subject: [PATCH 6/6] fix: revert test --- .github/workflows/test.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1b34d75 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Tests +on: + push: + pull_request: +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: software-mansion/setup-scarb@v1 + - uses: foundry-rs/setup-snfoundry@v3 + - run: scarb fmt --check + - run: scarb build + - run: snforge test \ No newline at end of file