Skip to content

Commit

Permalink
Merge pull request #224 from crytic/dev-unify-ci
Browse files Browse the repository at this point in the history
ci: unify CI jobs
  • Loading branch information
elopez authored Jan 3, 2025
2 parents 5fe9d26 + 50d0d24 commit 145152e
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 126 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI

on:
push:
branches:
- master
- dev
pull_request:
schedule:
# run CI every day even if no PRs/merges occur
- cron: '0 12 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: CI (Python ${{ matrix.python }} on ${{ matrix.os }}, ${{ matrix.type }} test)
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: ["ubuntu-latest", "macos-latest", "windows-2022"]
type: ["solc", "solc_upgrade", "os_specific"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
id: python
with:
python-version: ${{ matrix.python }}
- name: Create Python virtual environment
run: |
${{ steps.python.outputs.python-path }} -m venv test-venv
- name: Install solc-select
shell: bash
run: |
source test-venv/${{ (runner.os == 'Windows' && 'Scripts') || 'bin' }}/activate
python -m pip install --upgrade pip
pip3 install .
- name: Run Tests
shell: bash
env:
TEST_TYPE: ${{ (matrix.type != 'os_specific' && matrix.type) || runner.os }}
run: |
source test-venv/${{ (runner.os == 'Windows' && 'Scripts') || 'bin' }}/activate
TEST_TYPE="$(echo "$TEST_TYPE" | tr '[:upper:]' '[:lower:]')"
bash scripts/test_${TEST_TYPE}.sh
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
# run CI every day even if no PRs/merges occur
- cron: '0 12 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: read
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/linux-ci.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/mac-ci.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/pip-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
schedule:
- cron: "0 12 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pip-audit:
runs-on: ubuntu-latest
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/windows-ci.yml

This file was deleted.

1 change: 0 additions & 1 deletion scripts/test_linux.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail

sudo pip3 install .
solc-select install all

use_version=$(solc-select use 0.4.0)
Expand Down
2 changes: 2 additions & 0 deletions scripts/test_macos.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

solc-select install all

use_version=$(solc-select use 0.3.6)
if [[ $use_version != "Switched global version to 0.3.6"* ]]; then
echo "OS X FAILED: set minimum version"
Expand Down
10 changes: 6 additions & 4 deletions scripts/test_solc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

solc-select install 0.4.5 0.5.0 0.6.0 0.7.0 0.8.0 0.8.1 0.8.9

## solc 0.4.5 ##
solc-select use 0.4.5 &> /dev/null
solc ./scripts/solidity_tests/solc045_success.sol
Expand Down Expand Up @@ -90,17 +92,17 @@ if [[ "$execute" != *"Error: Explicit type conversion not allowed"* ]]; then
fi
echo "SUCCESS: solc080_fail_compile"

UNINSTALL_PATH=$HOME/.solc-select/artifacts/solc-0.8.9
rm -rf $UNINSTALL_PATH # uninstall solc 0.8.9
UNINSTALL_PATH=${VIRTUAL_ENV:-$HOME}/.solc-select/artifacts/solc-0.8.9
rm -rf $UNINSTALL_PATH{,.exe} # uninstall solc 0.8.9
execute=$(solc-select use 0.8.9 --always-install)
if [[ "$execute" != *"Switched global version to 0.8.9"* ]]; then
echo "FAILED: use - always install"
exit 255
fi
echo "SUCCESS: use - always install"

UNINSTALL_PATH=$HOME/.solc-select/artifacts/solc-0.8.1
rm -rf $UNINSTALL_PATH # uninstall solc 0.8.1
UNINSTALL_PATH=${VIRTUAL_ENV:-$HOME}/.solc-select/artifacts/solc-0.8.1
rm -rf $UNINSTALL_PATH{,.exe} # uninstall solc 0.8.1
execute=$(solc-select use 0.8.1 2>&1 || true)
if [[ $execute != *"'0.8.1' must be installed prior to use"* ]]; then
echo "FAILED: use - no install"
Expand Down
7 changes: 4 additions & 3 deletions scripts/test_solc_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
set -euo pipefail

### Install old version of solc
sudo pip3 uninstall --yes solc-select
sudo pip3 install solc-select
pip3 uninstall --yes solc-select
pip3 install solc-select
solc-select use 0.8.0 --always-install
old_solc_version=$(solc --version)
solc-select install 0.4.11 0.5.0 0.6.12 0.7.3 0.8.3
all_old_versions=$(solc-select versions | sort)

### Install new version of solc
sudo pip3 install -e .
pip3 uninstall --yes solc-select
pip3 install -e .
new_solc_version=$(solc --version)
all_new_versions=$(solc-select versions | sort)

Expand Down
2 changes: 2 additions & 0 deletions scripts/test_windows.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

solc-select install all

use_version=$(solc-select use 0.4.5)
if [[ $use_version != "Switched global version to 0.4.5"* ]]; then
echo "WINDOWS FAILED: minimum version"
Expand Down

0 comments on commit 145152e

Please sign in to comment.