From 5d7a7869f6890b9e130ecf7bd0a8beb601298292 Mon Sep 17 00:00:00 2001 From: Noah Kennedy Date: Thu, 16 Jun 2022 16:37:22 -0500 Subject: [PATCH 1/3] ci: move to github actions This should allow non-cloudflare contributors to see PR status check results. This also makes it easier to add hooks for pushing tags and such to automatically do releases builds. --- .github/workflows/on-push.yaml | 51 +++++++++++++++++++++++++++++++ ci/azure-build.yml | 29 ------------------ ci/azure-create-release-build.yml | 14 --------- ci/azure-install-rust.yml | 14 --------- 4 files changed, 51 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/on-push.yaml delete mode 100644 ci/azure-build.yml delete mode 100644 ci/azure-create-release-build.yml delete mode 100644 ci/azure-install-rust.yml diff --git a/.github/workflows/on-push.yaml b/.github/workflows/on-push.yaml new file mode 100644 index 00000000..42109ddf --- /dev/null +++ b/.github/workflows/on-push.yaml @@ -0,0 +1,51 @@ +name: PR Status Checks +on: [ push ] + +jobs: + check_features: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: taiki-e/install-action@cargo-hack + - run: cargo hack check --each-feature + - run: RUSTFLAGS="--cfg loom" cargo hack check --each-feature + clippy: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - run: cargo clippy + rustfmt: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - run: cargo fmt --all --check + tests: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: taiki-e/install-action@cargo-hack + - run: cargo hack test --each-feature \ No newline at end of file diff --git a/ci/azure-build.yml b/ci/azure-build.yml deleted file mode 100644 index 7150ecfb..00000000 --- a/ci/azure-build.yml +++ /dev/null @@ -1,29 +0,0 @@ -parameters: - runBinaryTests: 'true' - -steps: - - script: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable - export PATH=$PATH:$HOME/.cargo/bin - displayName: 'Install cargo' - - script: | - export PATH=$PATH:$HOME/.cargo/bin - cargo build --lib --no-default-features - displayName: 'Build library' - - script: | - export PATH=$PATH:$HOME/.cargo/bin - cargo test --lib --no-default-features -- --test-threads=1 - displayName: 'Test library' - - script: | - export PATH=$PATH:$HOME/.cargo/bin - cargo test --lib --no-default-features -- --ignored --test-threads=1 - displayName: 'Library integration tests' - - script: | - export PATH=$PATH:$HOME/.cargo/bin - cargo build --bin boringtun-cli - displayName: 'Build executable' - - ${{ if eq(parameters.runBinaryTests, 'true') }}: - - script: | - export PATH=$PATH:$HOME/.cargo/bin - cargo test --bin boringtun-cli -- --test-threads=1 - displayName: 'Test executable' diff --git a/ci/azure-create-release-build.yml b/ci/azure-create-release-build.yml deleted file mode 100644 index 50b1db1e..00000000 --- a/ci/azure-create-release-build.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - artifacts: 'target/release' - name: '' - -steps: - - bash: | - set -ex - dst=$BUILD_ARTIFACTSTAGINGDIRECTORY - cp ${{ parameters.artifacts }}/boringtun-cli $dst/ - displayName: Create distribution tarball - - task: PublishPipelineArtifact@0 - inputs: - artifactName: ${{ parameters.name }} - targetPath: '$(Build.ArtifactStagingDirectory)' diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml deleted file mode 100644 index 843fac7c..00000000 --- a/ci/azure-install-rust.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - toolchain: 'stable' - -steps: - - bash: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" - displayName: Install rust - Unix - env: - TOOLCHAIN: ${{ parameters.toolchain }} - - script: | - rustc -Vv - cargo -V - displayName: Query rust and cargo versions From a49c18fe534af77176024e170d149609b531fb71 Mon Sep 17 00:00:00 2001 From: Noah Kennedy Date: Thu, 16 Jun 2022 16:53:30 -0500 Subject: [PATCH 2/3] add newline --- .github/workflows/on-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-push.yaml b/.github/workflows/on-push.yaml index 42109ddf..05c9ad66 100644 --- a/.github/workflows/on-push.yaml +++ b/.github/workflows/on-push.yaml @@ -48,4 +48,4 @@ jobs: with: toolchain: stable - uses: taiki-e/install-action@cargo-hack - - run: cargo hack test --each-feature \ No newline at end of file + - run: cargo hack test --each-feature From 1c0ae6ca19bfbb7c0d843297714341614c89ed2a Mon Sep 17 00:00:00 2001 From: Noah Kennedy Date: Thu, 16 Jun 2022 17:02:54 -0500 Subject: [PATCH 3/3] remove a file --- azure-pipelines.yml | 187 -------------------------------------------- 1 file changed, 187 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 1d4309fc..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,187 +0,0 @@ -jobs: - -- job: Windows - displayName: 'Windows' - pool: - vmImage: 'windows-latest' - continueOnError: true - steps: - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-toolchain stable --default-host x86_64-pc-windows-msvc - echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" - displayName: 'Install Rust' - - script: | - cargo build --lib --no-default-features - displayName: 'Build library' - - script: | - cargo test --lib --no-default-features - displayName: 'Test library' - -- job: macOS_x86_64 - displayName: 'macOS x86-64' - pool: - name: Self Hosted ARM - demands: agent.name -equals intelmac - continueOnError: true - steps: - - template: ci/azure-build.yml - - script: | - export PATH=$PATH:$HOME/.cargo/bin - rustup target add aarch64-apple-ios - cargo build --lib --no-default-features --target aarch64-apple-ios - displayName: 'Build library for iOS' - - script: | - export PATH=$PATH:$HOME/.cargo/bin - rustup component add rustfmt - cargo fmt --all -- --check - displayName: 'Cargo fmt' - -- job: macOS_arm64 - displayName: 'macOS arm64' - pool: - name: Self Hosted ARM - demands: agent.name -equals m1mac - continueOnError: true - steps: - - template: ci/azure-build.yml - - script: | - export PATH=$PATH:$HOME/.cargo/bin - rustup target add aarch64-apple-ios - cargo build --lib --no-default-features --target aarch64-apple-ios - displayName: 'Build library for iOS' - - script: | - export PATH=$PATH:$HOME/.cargo/bin - rustup component add rustfmt - cargo fmt --all -- --check - displayName: 'Cargo fmt' - -- job: Linux_x86_64 - displayName: 'Linux x86-64' - pool: - vmImage: 'ubuntu-20.04' - continueOnError: true - steps: - - script: | - sudo apt-get update - sudo apt-get install wireguard -y - displayName: 'Install wireguard' - - script: | - sudo apt-get install jq -y - sudo sh -c "cat /etc/docker/daemon.json | jq --arg cidr \"2001:db8:1::/64\" '. + {ipv6: true, \"fixed-cidr-v6\": \$cidr}' > temp.txt" - sudo mv temp.txt /etc/docker/daemon.json - sudo systemctl restart docker - displayName: 'Fix docker' - - template: ci/azure-build.yml - - script: | - export PATH=$PATH:$HOME/.cargo/bin - rustup component add rustfmt - cargo fmt --all -- --check - displayName: 'Cargo fmt' - -- job: Linux_aarch64 - displayName: 'Linux aarch64' - pool: - name: Self Hosted ARM - demands: agent.name -equals aarch64 - continueOnError: true - steps: - - script: | - docker stop $(docker ps -aq) - displayName: 'Fix docker' - - template: ci/azure-build.yml - -- job: Linux_armv7 - displayName: 'Linux armv7' - pool: - name: Self Hosted ARM - demands: agent.name -equals armv7 - continueOnError: true - steps: - - script: | - docker stop $(docker ps -aq) - displayName: 'Fix docker' - - template: ci/azure-build.yml - -- job: dist_darwin - displayName: "Create macOS Release" - pool: - vmImage: macOS-11 - steps: - - template: ci/azure-install-rust.yml - - script: cargo build --release - env: - MACOSX_DEPLOYMENT_TARGET: 10.7 - - template: ci/azure-create-release-build.yml - parameters: - name: dist_darwin - -- job: dist_linux - displayName: "Create Linux Release" - pool: - vmImage: 'ubuntu-20.04' - steps: - - template: ci/azure-install-rust.yml - - script: rustup target add x86_64-unknown-linux-musl - - script: | - sudo apt update -y - sudo apt install musl-tools -y - displayName: "Install musl-tools" - - script: | - set -ex - cargo build --target x86_64-unknown-linux-musl --release - - template: ci/azure-create-release-build.yml - parameters: - artifacts: target/x86_64-unknown-linux-musl/release - name: dist_linux - -- job: deploy - dependsOn: - - dist_darwin - - dist_linux - displayName: "Push to GitHub Releases" - pool: - vmImage: 'ubuntu-20.04' - steps: - - task: DownloadPipelineArtifact@0 - displayName: "Download Linux release" - inputs: - artifactName: dist_linux - targetPath: tmp/linux - - task: DownloadPipelineArtifact@0 - displayName: "Download macOS release" - inputs: - artifactName: dist_darwin - targetPath: tmp/darwin - - script: | - set -ex - mkdir -p gh-release - find . - tag=`git describe --tags` - mk() { - target=$1 - src=$2 - name=boringtun-$tag-$target - mkdir -p tmp/$name - cp README.md \ - LICENSE.md \ - tmp/$src/boringtun-cli \ - tmp/$name/ - chmod +x tmp/$name/boringtun* - tar czvf gh-release/$name.tar.gz -C tmp $name - } - mk x86_64-unknown-linux-musl linux - mk x86_64-apple-darwin darwin - displayName: "Prepare GitHub release tarball" - - task: PublishPipelineArtifact@0 - displayName: "Publish GitHub release tarball" - inputs: - artifactName: gh_release - targetPath: gh-release - - task: GithubRelease@0 - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) - displayName: 'Create GitHub release' - inputs: - gitHubConnection: ag_dubs-token - repositoryName: cloudflare/boringtun - assets: gh-release/*.tar.gz