diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 4aee047f0..000000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Coverage and linter - -on: - pull_request: - workflow_dispatch: - push: - branches: - - main - -jobs: - linter: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Markdown Linter - uses: docker://avtodev/markdown-lint:v1 - with: - args: README.md CONTRIBUTING.md docs - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - coverage: - runs-on: ubuntu-latest - needs: [linter] - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest tox - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Run tests and collect coverage - run: | - tox -e coverage -- --xml - - name: Upload coverage reports to Codecov with GitHub Action - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 4474058a5..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build and Release - -on: - workflow_run: - workflows: [Test] - types: - - completed - -jobs: - dist: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - name: Build package - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v2 - with: - python-version: "3.8" - - run: python -m pip install -U setuptools - - run: python -m pip install -e .[testing] - - name: Build package - run: tox -e build - - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist - - dist_upload: - runs-on: ubuntu-latest - needs: [dist] - name: Upload to PyPi - steps: - - uses: actions/download-artifact@v2 - with: - name: dist - path: dist - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d199db298..fa705adfa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,44 +1,28 @@ -name: Test +name: Lint and test on: + pull_request: + branches: + - cairo-1 push: - tags: - - "v*" + branches: + - cairo-1 jobs: - validate: + lint_and_test: + name: Lint and test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Get commits - id: commits - run: | - echo "MAIN=$(git show -s --format="%H" origin/main)" >> $GITHUB_OUTPUT - echo "TAG=$(git rev-list -n 1 ${GITHUB_REF#refs/*/})" >> $GITHUB_OUTPUT - - name: Print commits - run: | - echo "Main commit: ${{ steps.commits.outputs.MAIN }}" - echo "Tag commit: ${{ steps.commits.outputs.TAG }}" - - name: Compare commits - if: ${{ steps.commits.outputs.MAIN != steps.commits.outputs.TAG }} - uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3 + - uses: actions/checkout@v3 with: - script: | - core.setFailed('Tagged commit does not match main') - - test: - runs-on: ubuntu-latest - needs: [validate] - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + submodules: recursive + - name: Markdown lint + uses: DavidAnson/markdownlint-cli2-action@5b7c9f74fec47e6b15667b2cc23c63dff11e449e # v9 with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest tox - - name: Run tests - run: | - tox + globs: | + *.md + !PULL_REQUEST_TEMPLATE.md + - name: Cairo lint + run: make check-format + - name: Cairo test + run: make test diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc new file mode 100644 index 000000000..97c4068dc --- /dev/null +++ b/.markdownlint.jsonc @@ -0,0 +1,5 @@ +{ + // Disable line length check to enable paragraphs without internal line breaks. + // See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md013---line-length + "MD013": false +} diff --git a/.markdownlintrc b/.markdownlintrc deleted file mode 100644 index a90ec93ab..000000000 --- a/.markdownlintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - // Disable line length check to enable paragraphs without internal line breaks. - // See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md013---line-length - "MD013": false, - // Disable inline HTML check to enable duplicate headers with separate ids. - // See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md033---inline-html - "MD033": false -} diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 5d0b808a3..f751872d8 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -8,7 +8,6 @@ Fixes #??? - #### PR Checklist diff --git a/SECURITY.md b/SECURITY.md index 7c633259e..8bd19014b 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,4 +1,6 @@ +# Security + > ⚠️ Warning! ⚠️ > This project is still in a very early and experimental phase. It has never been audited nor thoroughly reviewed for security vulnerabilities. Do not use in production. -Please report any security issues you find to security@openzeppelin.com. \ No newline at end of file +Please report any security issues you find to security@openzeppelin.com. diff --git a/src/openzeppelin/security/initializable.cairo b/src/openzeppelin/security/initializable.cairo index 80df38da6..00079d280 100644 --- a/src/openzeppelin/security/initializable.cairo +++ b/src/openzeppelin/security/initializable.cairo @@ -1,7 +1,7 @@ #[contract] mod Initializable { struct Storage { - initialized: bool, + initialized: bool } #[internal] diff --git a/src/openzeppelin/security/pausable.cairo b/src/openzeppelin/security/pausable.cairo index 4fcd68384..0a9018f51 100644 --- a/src/openzeppelin/security/pausable.cairo +++ b/src/openzeppelin/security/pausable.cairo @@ -4,7 +4,7 @@ mod Pausable { use starknet::get_caller_address; struct Storage { - paused: bool, + paused: bool } #[event] diff --git a/src/openzeppelin/tests/test_initializable.cairo b/src/openzeppelin/tests/test_initializable.cairo index bcbb7c503..37e1b6b78 100644 --- a/src/openzeppelin/tests/test_initializable.cairo +++ b/src/openzeppelin/tests/test_initializable.cairo @@ -3,9 +3,9 @@ use openzeppelin::security::initializable::Initializable; #[test] #[available_gas(2000000)] fn test_initialize() { - assert(!Initializable::is_initialized(),'Should not be initialized'); + assert(!Initializable::is_initialized(), 'Should not be initialized'); Initializable::initialize(); - assert(Initializable::is_initialized(),'Should be initialized'); + assert(Initializable::is_initialized(), 'Should be initialized'); } #[test] diff --git a/src/openzeppelin/tests/test_pausable.cairo b/src/openzeppelin/tests/test_pausable.cairo index 6fe484505..598f98be9 100644 --- a/src/openzeppelin/tests/test_pausable.cairo +++ b/src/openzeppelin/tests/test_pausable.cairo @@ -3,7 +3,7 @@ use openzeppelin::tests::mocks::mock_pausable::MockPausable; #[test] #[available_gas(2000000)] fn test_pause_when_unpaused() { - assert(! MockPausable::is_paused(), 'Should not be paused'); + assert(!MockPausable::is_paused(), 'Should not be paused'); assert(MockPausable::get_count() == 0, 'Should be 0'); MockPausable::assert_unpaused_and_increment(); assert(MockPausable::get_count() == 1, 'Should increment'); @@ -33,7 +33,7 @@ fn test_unpause_when_paused() { MockPausable::pause(); assert(MockPausable::is_paused(), 'Should be paused'); MockPausable::unpause(); - assert(! MockPausable::is_paused(), 'Should not be paused'); + assert(!MockPausable::is_paused(), 'Should not be paused'); MockPausable::assert_unpaused_and_increment(); assert(MockPausable::get_count() == 1, 'Should increment'); } @@ -42,6 +42,6 @@ fn test_unpause_when_paused() { #[available_gas(2000000)] #[should_panic(expected = ('Pausable: not paused', ))] fn test_unpause_when_unpaused() { - assert(! MockPausable::is_paused(), 'Should be unpaused'); + assert(!MockPausable::is_paused(), 'Should be unpaused'); MockPausable::unpause(); }