Skip to content

Commit

Permalink
ci: fix windows tests with .exe suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbaliasnikov committed Jun 28, 2024
1 parent bffc569 commit 6540d83
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
4 changes: 0 additions & 4 deletions .github/actions/cli-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ runs:
working-directory: cli-tests
run: |
npm install
which solc
which zksolc
solc --version
zksolc --version
npx jest --ci --reporters=default --reporters=jest-junit
- name: Upload results Linux
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/install-solc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ runs:
SOLC_DOWNLOAD_FILENAME="solc-macosx-amd64-${SOLC_VERSION}"
;;
Windows*)
WIN_SUFFIX=".exe"
SOLC_DOWNLOAD_FILENAME="solc-windows-amd64-${SOLC_VERSION}.exe"
;;
esac
OUTPUT="${OUTPUT}${WIN_SUFFIX}"
curl --location -o "${OUTPUT}" "${SOLC_URL}/${SOLC_VERSION}/${SOLC_DOWNLOAD_FILENAME}" && \
chmod a+x "${OUTPUT}"
[ ${SOLC_VERSION} = ${{ inputs.solc-version-latest }} ] && cp "${OUTPUT}" "${{ inputs.output-dir }}/${{ inputs.solc-default-name }}" && cp "${OUTPUT}" "${{ inputs.solc-default-name }}"
[ ${SOLC_VERSION} = ${{ inputs.solc-version-latest }} ] && cp "${OUTPUT}" "${{ inputs.output-dir }}/${{ inputs.solc-default-name }}${WIN_SUFFIX}"
done
echo "${PWD}/${{ inputs.output-dir }}" >> "${GITHUB_PATH}"
# Tweak
echo "${PWD}" >> "${GITHUB_PATH}"
ls -la ${PWD}/${{ inputs.output-dir }}
- name: Install upstream solc on Windows
if: runner.os == 'Windows'
Expand All @@ -69,6 +69,6 @@ runs:
curl --location -o "${SOLC_DOWNLOAD}.zip" "${SOLC_URL}/${SOLC_DOWNLOAD}.zip"
unzip -d ${SOLC_DOWNLOAD} "${SOLC_DOWNLOAD}.zip"
SOLC_SHORT_VERSION=$(echo "${SOLC_VERSION}" | cut -d+ -f1 | tr -d v)
mv "${SOLC_DOWNLOAD}/solc.exe" "${{ inputs.output-dir }}/${{ inputs.solc-default-name }}-${SOLC_SHORT_VERSION}"
mv "${SOLC_DOWNLOAD}/solc.exe" "${{ inputs.output-dir }}/${{ inputs.solc-default-name }}-${SOLC_SHORT_VERSION}.exe"
done
ls -la "${PWD}/${{ inputs.output-dir }}"
ls -la ${PWD}/${{ inputs.output-dir }}
36 changes: 18 additions & 18 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ jobs:
fail-fast: false # finalize testing of all targets even if one failed
matrix:
include:
# - name: "MacOS x86"
# runner: macos-12-large
# - name: "MacOS arm64"
# runner: [self-hosted, macOS, ARM64]
# - name: "Linux x86"
# runner: matterlabs-ci-runner
# image: matterlabs/llvm_runner:ubuntu22-llvm17-latest
# target: "x86_64-unknown-linux-musl"
# - name: "Linux ARM64"
# runner: matterlabs-ci-runner-arm
# image: matterlabs/llvm_runner:ubuntu22-llvm17-latest
# target: "aarch64-unknown-linux-musl"
- name: "MacOS x86"
runner: macos-12-large
- name: "MacOS arm64"
runner: [self-hosted, macOS, ARM64]
- name: "Linux x86"
runner: matterlabs-ci-runner
image: matterlabs/llvm_runner:ubuntu22-llvm17-latest
target: "x86_64-unknown-linux-musl"
- name: "Linux ARM64"
runner: matterlabs-ci-runner-arm
image: matterlabs/llvm_runner:ubuntu22-llvm17-latest
target: "aarch64-unknown-linux-musl"
- name: "Windows"
runner: windows-2022-github-hosted-16core
runs-on: ${{ matrix.runner }}
Expand Down Expand Up @@ -93,14 +93,14 @@ jobs:
- name: Install solc compiler
uses: ./.github/actions/install-solc

- name: Run tests
if: steps.changed-files-yaml.outputs.cli_tests_only_changed != 'true'
uses: ./.github/actions/unit-tests
with:
target: ${{ matrix.target || '' }}

- name: Run CLI tests
uses: ./.github/actions/cli-tests
with:
use-prebuilt-zksolc: ${{ steps.changed-files-yaml.outputs.cli_tests_only_changed }}
zksolc-version: ${{ github.event.inputs.zksolc-version }}

- name: Run tests
if: steps.changed-files-yaml.outputs.cli_tests_only_changed != 'true'
uses: ./.github/actions/unit-tests
with:
target: ${{ matrix.target || '' }}
15 changes: 7 additions & 8 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::path::PathBuf;
use std::str::FromStr;
use std::env::consts::EXE_EXTENSION;

use crate::message_type::MessageType;
use crate::project::Project;
Expand Down Expand Up @@ -46,7 +47,7 @@ pub fn build_solidity(
let _ = crate::process::EXECUTABLE.set(PathBuf::from(crate::r#const::DEFAULT_EXECUTABLE_NAME));

let solc_compiler = SolcCompiler::new(
format!("{}-{}", SolcCompiler::DEFAULT_EXECUTABLE_NAME, solc_version).as_str(),
format!("{}-{}{}", SolcCompiler::DEFAULT_EXECUTABLE_NAME, solc_version, EXE_EXTENSION).as_str()
)?;

let solc_input = SolcStandardJsonInput::try_from_solidity_sources(
Expand Down Expand Up @@ -132,7 +133,7 @@ pub fn build_solidity_and_detect_missing_libraries(
let _ = crate::process::EXECUTABLE.set(PathBuf::from(crate::r#const::DEFAULT_EXECUTABLE_NAME));

let solc_compiler = SolcCompiler::new(
format!("{}-{}", SolcCompiler::DEFAULT_EXECUTABLE_NAME, solc_version).as_str(),
format!("{}-{}{}", SolcCompiler::DEFAULT_EXECUTABLE_NAME, solc_version, EXE_EXTENSION).as_str()
)?;

let solc_input = SolcStandardJsonInput::try_from_solidity_sources(
Expand Down Expand Up @@ -375,7 +376,7 @@ pub fn check_solidity_message(
check_dependencies(Some(solc_version));

let solc_compiler = SolcCompiler::new(
format!("{}-{}", SolcCompiler::DEFAULT_EXECUTABLE_NAME, solc_version).as_str(),
format!("{}-{}{}", SolcCompiler::DEFAULT_EXECUTABLE_NAME, solc_version, EXE_EXTENSION).as_str(),
)?;
if skip_for_zksync_edition && solc_compiler.version.l2_revision.is_some() {
return Ok(true);
Expand Down Expand Up @@ -424,11 +425,9 @@ pub fn check_solidity_message(
fn check_dependencies(solc_version: Option<&semver::Version>) {
let mut executables = vec![crate::r#const::DEFAULT_EXECUTABLE_NAME.to_owned()];
if let Some(solc_version) = solc_version {
executables.push(format!(
"{}-{}",
SolcCompiler::DEFAULT_EXECUTABLE_NAME,
solc_version
));
executables.push(
format!("{}-{}{}", SolcCompiler::DEFAULT_EXECUTABLE_NAME, solc_version, EXE_EXTENSION)
);
}
for executable in executables.into_iter() {
assert!(
Expand Down
21 changes: 13 additions & 8 deletions src/tests/standard_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![cfg(test)]

use std::path::PathBuf;
use std::env::consts::EXE_EXTENSION;

use crate::solc::standard_json::input::Input as SolcStandardJsonInput;
use crate::solc::Compiler as SolcCompiler;
Expand Down Expand Up @@ -42,9 +43,10 @@ fn standard_json_yul_default_validated() {
.expect("Standard JSON reading error");
let solc_compiler = SolcCompiler::new(
format!(
"{}-{}",
"{}-{}{}",
SolcCompiler::DEFAULT_EXECUTABLE_NAME,
SolcCompiler::LAST_SUPPORTED_VERSION
SolcCompiler::LAST_SUPPORTED_VERSION,
EXE_EXTENSION
)
.as_str(),
)
Expand Down Expand Up @@ -102,9 +104,10 @@ fn standard_json_yul_default_urls_validated() {
.expect("Standard JSON reading error");
let solc_compiler = SolcCompiler::new(
format!(
"{}-{}",
"{}-{}{}",
SolcCompiler::DEFAULT_EXECUTABLE_NAME,
SolcCompiler::LAST_SUPPORTED_VERSION
SolcCompiler::LAST_SUPPORTED_VERSION,
EXE_EXTENSION
)
.as_str(),
)
Expand Down Expand Up @@ -162,9 +165,10 @@ fn standard_json_yul_eravm_validated() {
.expect("Standard JSON reading error");
let solc_compiler = SolcCompiler::new(
format!(
"{}-{}",
"{}-{}{}",
SolcCompiler::DEFAULT_EXECUTABLE_NAME,
SolcCompiler::LAST_SUPPORTED_VERSION
SolcCompiler::LAST_SUPPORTED_VERSION,
EXE_EXTENSION
)
.as_str(),
)
Expand Down Expand Up @@ -222,9 +226,10 @@ fn standard_json_yul_eravm_urls_validated() {
.expect("Standard JSON reading error");
let solc_compiler = SolcCompiler::new(
format!(
"{}-{}",
"{}-{}{}",
SolcCompiler::DEFAULT_EXECUTABLE_NAME,
SolcCompiler::LAST_SUPPORTED_VERSION
SolcCompiler::LAST_SUPPORTED_VERSION,
EXE_EXTENSION
)
.as_str(),
)
Expand Down

0 comments on commit 6540d83

Please sign in to comment.