Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up new CI #599

Merged
merged 13 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .github/workflows/coverage.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/release.yml

This file was deleted.

54 changes: 19 additions & 35 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,28 @@
name: Test
name: Lint and test
martriay marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
branches:
- cairo-1
push:
tags:
- "v*"
branches:
- cairo-1
martriay marked this conversation as resolved.
Show resolved Hide resolved

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
martriay marked this conversation as resolved.
Show resolved Hide resolved
- name: Markdown lint
uses: DavidAnson/markdownlint-cli2-action@5b7c9f74fec47e6b15667b2cc23c63dff11e449e # v9
martriay marked this conversation as resolved.
Show resolved Hide resolved
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
5 changes: 5 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 0 additions & 8 deletions .markdownlintrc

This file was deleted.

1 change: 0 additions & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Fixes #??? <!-- Fill in with issue number -->
<!-- Describe the changes introduced in this pull request. -->
<!-- Include any context necessary for understanding the PR's purpose. -->


#### PR Checklist

<!-- Before merging the pull request all of the following must be complete. -->
Expand Down
4 changes: 3 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Security
martriay marked this conversation as resolved.
Show resolved Hide resolved

> ⚠️ 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.
Please report any security issues you find to security@openzeppelin.com.
martriay marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/openzeppelin/security/initializable.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[contract]
mod Initializable {
struct Storage {
initialized: bool,
initialized: bool
}

#[internal]
Expand Down
2 changes: 1 addition & 1 deletion src/openzeppelin/security/pausable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod Pausable {
use starknet::get_caller_address;

struct Storage {
paused: bool,
paused: bool
}

#[event]
Expand Down
4 changes: 2 additions & 2 deletions src/openzeppelin/tests/test_initializable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions src/openzeppelin/tests/test_pausable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
}
Expand All @@ -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();
}