From 2b6f9cd546ce688005184f1400bfded7a4a4bbf0 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 17 Aug 2023 21:43:14 +0100 Subject: [PATCH 1/3] ci, gha: Add Windows jobs based on Linux image --- .../actions/run-in-docker-action/action.yml | 37 +++++++++ .github/workflows/ci.yml | 76 +++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 .github/actions/run-in-docker-action/action.yml diff --git a/.github/actions/run-in-docker-action/action.yml b/.github/actions/run-in-docker-action/action.yml new file mode 100644 index 0000000000..203383d0b1 --- /dev/null +++ b/.github/actions/run-in-docker-action/action.yml @@ -0,0 +1,37 @@ +name: 'Run in Docker with environment' +description: 'Run a command in a Docker container, while passing explicitly set environment variables into the container.' +inputs: + dockerfile: + description: 'A Dockerfile that defines an image' + required: true + tag: + description: 'A tag of an image' + required: true + command: + description: 'A command to run in a container' + required: true +runs: + using: "composite" + steps: + - uses: docker/setup-buildx-action@v2 + with: + # See: https://github.com/moby/buildkit/issues/3969. + driver-opts: | + network=host + + - uses: docker/build-push-action@v4 + with: + context: . + file: ${{ inputs.dockerfile }} + tags: ${{ inputs.tag }} + load: true + cache-from: type=gha + + - # Tell Docker to pass environment variables in `env` into the container. + run: > + docker run \ + $(echo '${{ toJSON(env) }}' | jq -r 'keys[] | "--env \(.) "') \ + --volume ${{ github.workspace }}:${{ github.workspace }} \ + --workdir ${{ github.workspace }} \ + ${{ inputs.tag }} bash -c "${{ inputs.command }}" + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c172abb0ee..66df646576 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,82 @@ env: EXAMPLES: 'yes' jobs: + docker_cache: + name: "Build Docker image" + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + # See: https://github.com/moby/buildkit/issues/3969. + driver-opts: | + network=host + + - name: Build container + uses: docker/build-push-action@v4 + with: + file: ./ci/linux-debian.Dockerfile + tags: linux-debian-image + cache-from: type=gha + cache-to: type=gha,mode=min + + mingw_debian: + name: ${{ matrix.configuration.job_name }} + runs-on: ubuntu-latest + needs: docker_cache + + env: + WRAPPER_CMD: 'wine' + WITH_VALGRIND: 'no' + ECDH: 'yes' + RECOVERY: 'yes' + SCHNORRSIG: 'yes' + ELLSWIFT: 'yes' + CTIMETESTS: 'no' + + strategy: + fail-fast: false + matrix: + configuration: + - job_name: 'x86_64 (mingw32-w64): Windows (Debian stable, Wine)' + env_vars: + HOST: 'x86_64-w64-mingw32' + - job_name: 'i686 (mingw32-w64): Windows (Debian stable, Wine)' + env_vars: + HOST: 'i686-w64-mingw32' + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: CI script + env: ${{ matrix.configuration.env_vars }} + uses: ./.github/actions/run-in-docker-action + with: + dockerfile: ./ci/linux-debian.Dockerfile + tag: linux-debian-image + command: > + git config --global --add safe.directory ${{ github.workspace }} && + ./ci/cirrus.sh + + - run: cat tests.log || true + if: ${{ always() }} + - run: cat noverify_tests.log || true + if: ${{ always() }} + - run: cat exhaustive_tests.log || true + if: ${{ always() }} + - run: cat ctime_tests.log || true + if: ${{ always() }} + - run: cat bench.log || true + if: ${{ always() }} + - run: cat config.log || true + if: ${{ always() }} + - run: cat test_env.log || true + if: ${{ always() }} + - name: CI env + run: env + if: ${{ always() }} + macos-native: name: "x86_64: macOS Ventura" # See: https://github.com/actions/runner-images#available-images. From d6281dd0086a37c77311b4acbbacad89738163c7 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 17 Aug 2023 21:44:24 +0100 Subject: [PATCH 2/3] ci: Remove Windows tasks from Cirrus CI --- .cirrus.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 1762007c60..79a13b4c05 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -187,27 +187,6 @@ task: - ./ci/cirrus.sh << : *CAT_LOGS -task: - << : *LINUX_CONTAINER - env: - WRAPPER_CMD: wine - WITH_VALGRIND: no - ECDH: yes - RECOVERY: yes - SCHNORRSIG: yes - ELLSWIFT: yes - CTIMETESTS: no - matrix: - - name: "x86_64 (mingw32-w64): Windows (Debian stable, Wine)" - env: - HOST: x86_64-w64-mingw32 - - name: "i686 (mingw32-w64): Windows (Debian stable, Wine)" - env: - HOST: i686-w64-mingw32 - test_script: - - ./ci/cirrus.sh - << : *CAT_LOGS - # Sanitizers task: << : *LINUX_CONTAINER From 87d35f30c0a322e9b4bc5ee1addc1d0cd463562a Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 17 Aug 2023 21:44:35 +0100 Subject: [PATCH 3/3] ci: Rename `cirrus.sh` to more general `ci.sh` This makes sense in the process of moving stuff to GitHub Actions. --- .cirrus.yml | 18 +++++++++--------- .github/workflows/ci.yml | 4 ++-- ci/{cirrus.sh => ci.sh} | 0 3 files changed, 11 insertions(+), 11 deletions(-) rename ci/{cirrus.sh => ci.sh} (100%) diff --git a/.cirrus.yml b/.cirrus.yml index 79a13b4c05..9d3807f4eb 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -93,7 +93,7 @@ task: - env: CC: clang-snapshot test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS task: @@ -111,7 +111,7 @@ task: - env: CC: clang --target=i686-pc-linux-gnu -isystem /usr/i686-linux-gnu/include test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS task: @@ -130,7 +130,7 @@ task: test_script: # https://sourceware.org/bugzilla/show_bug.cgi?id=27008 - rm /etc/ld.so.cache - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS task: @@ -150,7 +150,7 @@ task: - env: {} - env: {EXPERIMENTAL: yes, ASM: arm32} test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS task: @@ -167,7 +167,7 @@ task: ELLSWIFT: yes CTIMETESTS: no test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS task: @@ -184,7 +184,7 @@ task: ELLSWIFT: yes CTIMETESTS: no test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS # Sanitizers @@ -228,7 +228,7 @@ task: HOST: i686-linux-gnu CC: i686-linux-gnu-gcc test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS # Memory sanitizers @@ -255,7 +255,7 @@ task: ECMULTWINDOW: 2 CFLAGS: "-fsanitize=memory -g -O3" test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS task: @@ -271,7 +271,7 @@ task: SCHNORRSIG: yes ELLSWIFT: yes test_script: - - ./ci/cirrus.sh + - ./ci/ci.sh << : *CAT_LOGS task: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66df646576..f9518c4ac4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,7 +98,7 @@ jobs: tag: linux-debian-image command: > git config --global --add safe.directory ${{ github.workspace }} && - ./ci/cirrus.sh + ./ci/ci.sh - run: cat tests.log || true if: ${{ always() }} @@ -156,7 +156,7 @@ jobs: - name: CI script env: ${{ matrix.env_vars }} - run: ./ci/cirrus.sh + run: ./ci/ci.sh - run: cat tests.log || true if: ${{ always() }} diff --git a/ci/cirrus.sh b/ci/ci.sh similarity index 100% rename from ci/cirrus.sh rename to ci/ci.sh