Skip to content

ci: fix windows tests with .exe suffix #111

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

Merged
merged 2 commits into from
Jun 28, 2024
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
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 }}
24 changes: 12 additions & 12 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
29 changes: 24 additions & 5 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ 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,
std::env::consts::EXE_SUFFIX,
)
.as_str(),
)?;

let solc_input = SolcStandardJsonInput::try_from_solidity_sources(
Expand Down Expand Up @@ -132,7 +138,13 @@ 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,
std::env::consts::EXE_SUFFIX,
)
.as_str(),
)?;

let solc_input = SolcStandardJsonInput::try_from_solidity_sources(
Expand Down Expand Up @@ -375,7 +387,13 @@ 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,
std::env::consts::EXE_SUFFIX,
)
.as_str(),
)?;
if skip_for_zksync_edition && solc_compiler.version.l2_revision.is_some() {
return Ok(true);
Expand Down Expand Up @@ -425,9 +443,10 @@ 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
solc_version,
std::env::consts::EXE_SUFFIX,
));
}
for executable in executables.into_iter() {
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 @@ -4,6 +4,7 @@

#![cfg(test)]

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

use crate::solc::standard_json::input::Input as SolcStandardJsonInput;
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_SUFFIX
)
.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_SUFFIX
)
.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_SUFFIX
)
.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_SUFFIX
)
.as_str(),
)
Expand Down
Loading