Skip to content

Commit 145152e

Browse files
authored
Merge pull request #224 from crytic/dev-unify-ci
ci: unify CI jobs
2 parents 5fe9d26 + 50d0d24 commit 145152e

File tree

11 files changed

+70
-126
lines changed

11 files changed

+70
-126
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- dev
8+
pull_request:
9+
schedule:
10+
# run CI every day even if no PRs/merges occur
11+
- cron: '0 12 * * *'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
tests:
19+
name: CI (Python ${{ matrix.python }} on ${{ matrix.os }}, ${{ matrix.type }} test)
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
matrix:
23+
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
24+
os: ["ubuntu-latest", "macos-latest", "windows-2022"]
25+
type: ["solc", "solc_upgrade", "os_specific"]
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-python@v5
29+
id: python
30+
with:
31+
python-version: ${{ matrix.python }}
32+
- name: Create Python virtual environment
33+
run: |
34+
${{ steps.python.outputs.python-path }} -m venv test-venv
35+
- name: Install solc-select
36+
shell: bash
37+
run: |
38+
source test-venv/${{ (runner.os == 'Windows' && 'Scripts') || 'bin' }}/activate
39+
python -m pip install --upgrade pip
40+
pip3 install .
41+
- name: Run Tests
42+
shell: bash
43+
env:
44+
TEST_TYPE: ${{ (matrix.type != 'os_specific' && matrix.type) || runner.os }}
45+
run: |
46+
source test-venv/${{ (runner.os == 'Windows' && 'Scripts') || 'bin' }}/activate
47+
TEST_TYPE="$(echo "$TEST_TYPE" | tr '[:upper:]' '[:lower:]')"
48+
bash scripts/test_${TEST_TYPE}.sh

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
# run CI every day even if no PRs/merges occur
1414
- cron: '0 12 * * *'
1515

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
1620
permissions:
1721
contents: read
1822
packages: read

.github/workflows/linux-ci.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/mac-ci.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/pip-audit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
schedule:
99
- cron: "0 12 * * *"
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
pip-audit:
1317
runs-on: ubuntu-latest

.github/workflows/windows-ci.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

scripts/test_linux.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
sudo pip3 install .
54
solc-select install all
65

76
use_version=$(solc-select use 0.4.0)

scripts/test_macos.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
solc-select install all
5+
46
use_version=$(solc-select use 0.3.6)
57
if [[ $use_version != "Switched global version to 0.3.6"* ]]; then
68
echo "OS X FAILED: set minimum version"

scripts/test_solc.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
solc-select install 0.4.5 0.5.0 0.6.0 0.7.0 0.8.0 0.8.1 0.8.9
5+
46
## solc 0.4.5 ##
57
solc-select use 0.4.5 &> /dev/null
68
solc ./scripts/solidity_tests/solc045_success.sol
@@ -90,17 +92,17 @@ if [[ "$execute" != *"Error: Explicit type conversion not allowed"* ]]; then
9092
fi
9193
echo "SUCCESS: solc080_fail_compile"
9294

93-
UNINSTALL_PATH=$HOME/.solc-select/artifacts/solc-0.8.9
94-
rm -rf $UNINSTALL_PATH # uninstall solc 0.8.9
95+
UNINSTALL_PATH=${VIRTUAL_ENV:-$HOME}/.solc-select/artifacts/solc-0.8.9
96+
rm -rf $UNINSTALL_PATH{,.exe} # uninstall solc 0.8.9
9597
execute=$(solc-select use 0.8.9 --always-install)
9698
if [[ "$execute" != *"Switched global version to 0.8.9"* ]]; then
9799
echo "FAILED: use - always install"
98100
exit 255
99101
fi
100102
echo "SUCCESS: use - always install"
101103

102-
UNINSTALL_PATH=$HOME/.solc-select/artifacts/solc-0.8.1
103-
rm -rf $UNINSTALL_PATH # uninstall solc 0.8.1
104+
UNINSTALL_PATH=${VIRTUAL_ENV:-$HOME}/.solc-select/artifacts/solc-0.8.1
105+
rm -rf $UNINSTALL_PATH{,.exe} # uninstall solc 0.8.1
104106
execute=$(solc-select use 0.8.1 2>&1 || true)
105107
if [[ $execute != *"'0.8.1' must be installed prior to use"* ]]; then
106108
echo "FAILED: use - no install"

scripts/test_solc_upgrade.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
set -euo pipefail
33

44
### Install old version of solc
5-
sudo pip3 uninstall --yes solc-select
6-
sudo pip3 install solc-select
5+
pip3 uninstall --yes solc-select
6+
pip3 install solc-select
77
solc-select use 0.8.0 --always-install
88
old_solc_version=$(solc --version)
99
solc-select install 0.4.11 0.5.0 0.6.12 0.7.3 0.8.3
1010
all_old_versions=$(solc-select versions | sort)
1111

1212
### Install new version of solc
13-
sudo pip3 install -e .
13+
pip3 uninstall --yes solc-select
14+
pip3 install -e .
1415
new_solc_version=$(solc --version)
1516
all_new_versions=$(solc-select versions | sort)
1617

0 commit comments

Comments
 (0)