From 9108a106dc8f6d2be985341f3470b29ff90d8fe6 Mon Sep 17 00:00:00 2001 From: Per Larsen Date: Tue, 7 Jul 2020 14:29:34 -0700 Subject: [PATCH] Add GitHub Actions (#275) --- .github/workflows/internal-testsuite.yml | 94 ++++++++++++++++++++++++ README.md | 5 +- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/internal-testsuite.yml diff --git a/.github/workflows/internal-testsuite.yml b/.github/workflows/internal-testsuite.yml new file mode 100644 index 0000000000..e463b6e535 --- /dev/null +++ b/.github/workflows/internal-testsuite.yml @@ -0,0 +1,94 @@ + + +name: c2rust-testsuite + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master, feature/gh_actions ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build-on-ubuntu-1804: + # The type of runner that the job will run on + runs-on: ubuntu-18.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + # Working dir is /home/runner/work/c2rust/c2rust + - name: Checkout c2rust + uses: actions/checkout@v2 + + # Working dir is /home/runner/work/c2rust/c2rust/testsuite + - name: Checkout c2rust-testsuite + uses: actions/checkout@v2 + with: + repository: immunant/c2rust-testsuite + token: ${{ secrets.GH_ACTIONS_CONTROL_PRIV_REPOS }} + path: testsuite + submodules: true + + - name: Cache Rust artifacts & compile commands + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + $GITHUB_WORKSPACE/testsuite/tests/**/compile_commands.json + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Provision Rust + run: rustup component add rustfmt-preview rustc-dev + + - name: Provision Debian Packages + run: | + sudo apt-get -qq update + sudo apt-get -qq install \ + libbrotli-dev \ + libclang-9-dev \ + libgcrypt20 \ + libreadline-dev \ + libidn2-dev \ + libldap2-dev \ + libnghttp2-dev \ + libpcre3-dev \ + libpsl-dev \ + librtmp-dev \ + libtool \ + python3-setuptools \ + python3-wheel \ + rcs \ + zlib1g-dev + + # installs intercept-build to $HOME/.local/bin + - name: Provision Python Packages + run: python3 -m pip install -r $GITHUB_WORKSPACE/testsuite/requirements.txt + + # Runs a single command using the runners shell + # Working dir is /home/runner/work/c2rust/c2rust + - name: Build c2rust + run: | + export LLVM_CONFIG_PATH=/usr/bin/llvm-config-9 + cargo build --release + + # Runs a set of commands using the runners shell + - name: Run c2rust testsuite + run: | + export PATH=$PWD/target/release:$HOME/.local/bin:$PATH + echo "PATH=$PATH" + python3 testsuite/test.py curl json-c lua nginx zstd + + - uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,ref,job,took # selectable (default: repo,message) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # optional + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required + if: always() # Pick up events even if the job fails or is canceled. \ No newline at end of file diff --git a/README.md b/README.md index 7179bf5180..c05a837ba7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ -[![Travis Build Status]][travis] [![Azure Build Status]][azure] [![Latest Version]][crates.io] [![Rustc Version]](#) +[![Travis Build Status]][travis] [![GitHub Actions Status]][github] [![Azure Build Status]][azure] [![Latest Version]][crates.io] [![Rustc Version]](#) +[GitHub Actions Status]: https://github.com/immunant/c2rust/workflows/c2rust-testsuite/badge.svg +[github]: https://github.com/immunant/c2rust/actions [Travis Build Status]: https://api.travis-ci.org/immunant/c2rust.svg?branch=master [travis]: https://travis-ci.org/immunant/c2rust [Azure Build Status]: https://dev.azure.com/immunant/c2rust/_apis/build/status/immunant.c2rust?branchName=master [azure]: https://dev.azure.com/immunant/c2rust/_build/latest?definitionId=1&branchName=master + [Latest Version]: https://img.shields.io/crates/v/c2rust.svg [crates.io]: https://crates.io/crates/c2rust [Rustc Version]: https://img.shields.io/badge/rustc-nightly--2019--12--05-lightgrey.svg "Rustc nightly-2019-12-05"